]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/soundmgr_openal.hxx
initialize volume to a proper value
[simgear.git] / simgear / sound / soundmgr_openal.hxx
index 6a4df530dbea25f8539108a55aeaeba7a3d61548..f1f9bd17a178d5feb8d518a030f40a7c0312e73d 100644 (file)
@@ -95,7 +95,7 @@ public:
     SGSoundMgr();
     ~SGSoundMgr();
 
-    void init();
+    void init(const char *devname = NULL);
     void bind();
     void unbind();
     void update(double dt);
@@ -156,8 +156,12 @@ public:
      * Set the Cartesian position of the sound manager.
      * @param pos OpenAL listener position
      */
-    void set_position( const SGVec3d& pos ) {
-        _absolute_pos = pos; _changed = true;
+    void set_position( const SGVec3d& pos, const SGGeod& pos_geod ) {
+        _base_pos = pos; _geod_pos = pos_geod; _changed = true;
+    }
+
+    void set_position_offset( const SGVec3d& pos ) {
+        _offset_pos = pos; _changed = true;
     }
 
     /**
@@ -172,7 +176,7 @@ public:
      * This is the horizontal local frame; x=north, y=east, z=down
      * @param Velocity vector
      */
-    void set_velocity( const SGVec3f& vel ) {
+    void set_velocity( const SGVec3d& vel ) {
         _velocity = vel; _changed = true;
     }
 
@@ -181,7 +185,7 @@ public:
      * This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
      * @return Velocity vector of the OpenAL listener
      */
-    inline SGVec3f& get_velocity() { return _velocity; }
+    inline SGVec3f get_velocity() { return toVec3f(_velocity); }
 
     /**
      * Set the orientation of the sound manager
@@ -256,6 +260,14 @@ public:
      */
     inline bool has_changed() { return _changed; }
 
+    /**
+     * Some implementations seem to need the velocity miltyplied by a
+     * factor of 100 to make them distinct. I've not found if this is
+     * a problem in the implementation or in out code. Until then
+     * this function is used to detect the problematic implementations.
+     */
+    inline bool bad_doppler_effect() { return _bad_doppler; }
+
     /**
      * Load a sample file and return it's configuration and data.
      * @param samplepath Path to the file to load
@@ -281,9 +293,12 @@ private:
 
     // Position of the listener.
     SGVec3d _absolute_pos;
+    SGVec3d _offset_pos;
+    SGVec3d _base_pos;
+    SGGeod _geod_pos;
 
     // Velocity of the listener.
-    SGVec3f _velocity;
+    SGVec3d _velocity;
 
     // Orientation of the listener. 
     // first 3 elements are "at" vector, second 3 are "up" vector
@@ -296,7 +311,7 @@ private:
     vector<ALuint> _free_sources;
     vector<ALuint> _sources_in_use;
 
-    char *_devname;
+    bool _bad_doppler;
 
     bool testForALError(string s);
     bool testForALCError(string s);