]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/soundmgr_openal.hxx
Maik JUSTUS: fix/implement directional sound
[simgear.git] / simgear / sound / soundmgr_openal.hxx
index 3f7c4cbd1e767075ab87c29ed20b59da9b340b84..9e8dcd0a1b653cd595fd46b39ffb98259e831100 100644 (file)
@@ -5,7 +5,7 @@
 //
 // C++-ified by Curtis Olson, started March 2001.
 //
-// Copyright (C) 2001  Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 2001  Curtis L. Olson - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -19,7 +19,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 
 #if defined( __APPLE__ )
 # include <OpenAL/al.h>
+# include <OpenAL/alc.h>
 #else
 # include <AL/al.h>
+# include <AL/alc.h>
 #endif
 
 #include "sample_openal.hxx"
@@ -54,7 +56,7 @@ SG_USING_STD(map);
 SG_USING_STD(string);
 
 
-typedef map < string, SGSoundSample * > sample_map;
+typedef map < string, SGSharedPtr<SGSoundSample> > sample_map;
 typedef sample_map::iterator sample_map_iterator;
 typedef sample_map::const_iterator const_sample_map_iterator;
 
@@ -65,6 +67,9 @@ typedef sample_map::const_iterator const_sample_map_iterator;
 class SGSoundMgr
 {
 
+    ALCdevice *dev;
+    ALCcontext *context;
+
     // Position of the listener.
     ALfloat listener_pos[3];
 
@@ -174,6 +179,16 @@ public:
      */
     bool stop( const string& refname );
 
+    /**
+     * set overall volume for the application.
+     * @param vol 1.0 is default, must be greater than 0
+     */
+    inline void set_volume( const ALfloat vol ) {
+        if ( vol > 0.0 ) {
+            alListenerf( AL_GAIN, vol );
+        }
+    }
+
     /**
      * set the position of the listener (in opengl coordinates)
      */