]> git.mxchange.org Git - simgear.git/blobdiff - simgear/sound/sample_openal.hxx
Pass current-dir down through XMLSound
[simgear.git] / simgear / sound / sample_openal.hxx
index d2cb1824763a7a76b3769397bc80a0956c9464e0..b2afba4f33fd1da89f138e491b038e115d0625dc 100644 (file)
@@ -35,6 +35,7 @@
 #endif
 
 #include <string>
+#include <cstdlib>
 
 #include <simgear/compiler.h>
 #include <simgear/debug/logstream.hxx>
@@ -42,7 +43,7 @@
 #include <simgear/structure/SGSharedPtr.hxx>
 #include <simgear/math/SGMath.hxx>
 
-// #include <plib/sg.h>
+class SGPath;
 
 /**
  * manages everything we need to know for an individual audio sample
@@ -59,11 +60,10 @@ public:
 
     /**
      * Constructor
-     * @param path Path name to sound
      * @param file File name of sound
        Buffer data is freed by the sample group
      */
-    SGSoundSample( const char *path, const char *file );
+    SGSoundSample(const char *file, const SGPath& currentDir);
 
     /**
      * Constructor.
@@ -90,6 +90,8 @@ public:
      */
     inline bool is_file() const { return _is_file; }
 
+    SGPath file_path() const;
+
     /**
      * Test if this audio sample configuration has changed since the last call.
      * Calling this function will reset the flag so calling it a second
@@ -115,7 +117,7 @@ public:
      * at the next call op SoundGroup::update()
      * @param _loop Define whether this sound should be played in a loop.
      */
-    void play( bool loop ) {
+    void play( bool loop = false ) {
         _playing = true; _loop = loop; _changed = true;
     }
 
@@ -128,7 +130,7 @@ public:
     /**
      * Schedule this audio sample to stop playing.
      */
-    void stop() {
+    virtual void stop() {
         _playing = false; _changed = true;
     }
 
@@ -158,7 +160,7 @@ public:
     inline void set_data( const unsigned char **data ) {
         _data = (unsigned char*)*data; *data = NULL;
     }
-    inline void set_data( void **data ) {
+    inline void set_data( const void **data ) {
         _data = (unsigned char*)*data; *data = NULL;
     }
 
@@ -179,7 +181,7 @@ public:
      * Set the source id of this source
      * @param sid OpenAL source-id
      */
-    void set_source(unsigned int sid) {
+    virtual inline void set_source(unsigned int sid) {
         _source = sid; _valid_source = true; _changed = true;
     }
 
@@ -187,24 +189,24 @@ public:
      * Get the OpenAL source id of this source
      * @return OpenAL source-id
      */
-    inline unsigned int get_source() { return _source; }
+    virtual inline unsigned int get_source() { return _source; }
 
     /**
      * Test if the source-id of this audio sample may be passed to OpenAL.
      * @return true if the source-id is valid
      */
-    inline bool is_valid_source() const { return _valid_source; }
+    virtual inline bool is_valid_source() const { return _valid_source; }
 
     /**
      * Set the source-id of this audio sample to invalid.
      */
-    inline void no_valid_source() { _valid_source = false; }
+    virtual inline void no_valid_source() { _valid_source = false; }
 
     /**
      * Set the OpenAL buffer-id of this source
      * @param bid OpenAL buffer-id
      */
-    void set_buffer(unsigned int bid) {
+    inline void set_buffer(unsigned int bid) {
         _buffer = bid; _valid_buffer = true; _changed = true;
     } 
 
@@ -443,6 +445,8 @@ public:
      */
     inline std::string get_sample_name() const { return _refname; }
 
+    inline virtual bool is_queue() const { return false; }
+
     void update_pos_and_orientation();
 
 private: