]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/sample_openal.hxx
don't only complain that the volume is larger than 1.0, but say how much
[simgear.git] / simgear / sound / sample_openal.hxx
index 68b7af7aeff01e0951bff9502dc33dfb9dc0243e..417807837f423d301957e016142567fe9c9c625a 100644 (file)
@@ -16,7 +16,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$
 
@@ -37,6 +37,8 @@
 #include STL_STRING
 
 #include <simgear/debug/logstream.hxx>
+#include <simgear/structure/SGReferenced.hxx>
+#include <simgear/structure/SGSharedPtr.hxx>
 
 #include <plib/sg.h>
 
@@ -56,7 +58,7 @@ SG_USING_STD(string);
  * manages everything we need to know for an individual sound sample
  */
 
-class SGSoundSample {
+class SGSoundSample : public SGReferenced {
 
 private:
 
@@ -84,7 +86,6 @@ private:
     // configuration values
     ALenum format;
     ALsizei size;
-    ALvoid* data;
     ALsizei freq;
 
     double pitch;
@@ -98,26 +99,31 @@ private:
 
 public:
 
+     /**
+      * Empty constructor, can be used to read data to the systems
+      * memory and not to the driver.
+      */
+    SGSoundSample();
+
     /**
      * Constructor
      * @param path Path name to sound
      * @param file File name of sound
-     * @param cleanup Request clean up the intermediate data (this
        should usually be true unless you want to manipulate the data
        later.)
      */
-    SGSoundSample( const char *path, const char *file, bool cleanup );
+    SGSoundSample( const char *path, const char *file );
 
     /**
      * Constructor.
      * @param _data Pointer to a memory buffer containing the sample data
+       the application is responsible for freeing the buffer data.
      * @param len Byte length of array
      * @param _freq Frequency of the provided data (bytes per second)
-     * @param cleanup Request clean up the intermediate data (this
        should usually be true unless you want to manipulate the data
        later.)
      */
-    SGSoundSample( unsigned char *_data, int len, int _freq, bool cleanup );
+    SGSoundSample( unsigned char *_data, int len, int _freq );
 
     ~SGSoundSample();
 
@@ -180,13 +186,6 @@ public:
         return size;
     }
 
-    /**
-     * Return a pointer to the raw data
-     */
-    inline char *get_data() {
-        return (char *)data;
-    }
-
     /**
      * Set position of sound source (uses same coordinate system as opengl)
      */
@@ -224,6 +223,11 @@ public:
      * no longer audible.
      */
     void set_max_dist( ALfloat dist );
+
+    /**
+     * Load a sound file into a memory buffer only.
+     */
+    ALvoid* load_file(const char *path, const char *file);
 };