]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/sample_openal.hxx
Merge branch 'jmt/magvar' into next
[simgear.git] / simgear / sound / sample_openal.hxx
index 56fc3d3aea366f76ee718b575dfe1cca0dbb46d2..d2cb1824763a7a76b3769397bc80a0956c9464e0 100644 (file)
@@ -172,7 +172,7 @@ public:
      * Free the data associated with this audio sample
      */
     void free_data() {
-        if ( _data ) free( _data ); _data = NULL;
+        if ( _data != NULL ) free( _data ); _data = NULL;
     }
 
     /**
@@ -285,7 +285,7 @@ public:
      * Set the frequency (in Herz) of this audio sample.
      * @param freq Frequency
      */
-    inline void set_frequency( int freq ) { _freq = freq; _changed = true; }
+    inline void set_frequency( int freq ) { _freq = freq; }
 
     /**
      * Returns the frequency (in Herz) of this audio sample.
@@ -322,14 +322,6 @@ public:
        _base_pos = pos; _changed = true;
     }
 
-    /**
-     * Set the base position offset in Cartesian coordinates
-     * @param offs offset in Cartesian coordinates
-     */
-    inline void set_position_offset( const SGVec3d& offs ) {
-       _base_offs = offs; _changed = true;
-    }
-
     /**
      * Get the absolute position of this sound.
      * This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
@@ -345,12 +337,8 @@ public:
         _orientation = ori; _changed = true;
     }
 
-    /**
-     * Set the rotation quatgernion of this sound.
-     * @param rotation Quaternion containing the rotation information
-     */
-    inline void set_rotation( const SGQuatd& rotation ) {
-        _rotation = rotation; _changed = true;
+    inline void set_rotation( const SGQuatd& ec2body ) {
+        _rotation = ec2body; _changed = true;
     }
 
     /**
@@ -359,20 +347,18 @@ public:
      * @param dir Sound emission direction
      */
     inline void set_direction( const SGVec3f& dir ) {
-        _direction = toVec3d(dir); _changed = true;
+        _direction = toVec3d(dir); _static_changed = true;
     }
 
     /**
      * Define the audio cone parameters for directional audio.
-     * Note: setting it to 1 degree will result in 0.5 degrees to both sides.
+     * Note: setting it to 2 degree will result in 1 degree to both sides.
      * @param inner Inner cone angle (0 - 360 degrees)
      * @param outer Outer cone angle (0 - 360 degrees)
      * @param gain Remaining gain at the edge of the outer cone (0.0 - 1.0)
      */
     void set_audio_cone( float inner, float outer, float gain ) {
-        _inner_angle = inner;
-        _outer_angle = outer;
-        _outer_gain = gain;
+        _inner_angle = inner; _outer_angle = outer; _outer_gain = gain;
         _static_changed = true;
     }
 
@@ -469,10 +455,10 @@ private:
 
     // The position and orientation of this sound
     SGQuatd _orientation;       // base orientation
-    SGQuatd _rotation;         // rotation vector for relative offsets
     SGVec3f _orivec;           // orientation vector for OpenAL
     SGVec3d _base_pos;         // base position
-    SGVec3d _base_offs;                // base offset position
+
+    SGQuatd _rotation;
 
     std::string _refname;      // name or file path
     unsigned char* _data;