+ * Test if a audio sample is scheduled for playing.
+ * @return true if this audio sample is playing, false otherwise.
+ */
+ inline bool is_playing() { return _playing; }
+
+ /**
+ * Set the data associated with this audio sample
+ * @param data Pointer to a memory block containg this audio sample data.
+ This pointer will be set to NULL after calling this function.
+ */
+ inline void set_data( const unsigned char **data ) {
+ _data = (unsigned char*)*data; *data = NULL;
+ }
+ inline void set_data( const void **data ) {
+ _data = (unsigned char*)*data; *data = NULL;
+ }
+
+ /**
+ * Return the data associated with this audio sample.
+ * @return A pointer to this sound data of this audio sample.
+ */
+ inline void* get_data() const { return _data; }
+
+ /**
+ * Free the data associated with this audio sample
+ */
+ void free_data() {
+ if ( _data != NULL ) free( _data ); _data = NULL;
+ }
+
+ /**
+ * Set the source id of this source
+ * @param sid OpenAL source-id
+ */
+ virtual inline void set_source(unsigned int sid) {
+ _source = sid; _valid_source = true; _changed = true;
+ }
+
+ /**
+ * Get the OpenAL source id of this source
+ * @return OpenAL source-id
+ */
+ 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
+ */
+ virtual inline bool is_valid_source() const { return _valid_source; }
+
+ /**
+ * Set the source-id of this audio sample to invalid.
+ */
+ virtual inline void no_valid_source() { _valid_source = false; }
+
+ /**
+ * Set the OpenAL buffer-id of this source
+ * @param bid OpenAL buffer-id
+ */
+ inline void set_buffer(unsigned int bid) {
+ _buffer = bid; _valid_buffer = true; _changed = true;
+ }
+
+ /**
+ * Get the OpenAL buffer-id of this source
+ * @return OpenAL buffer-id
+ */
+ inline unsigned int get_buffer() { return _buffer; }
+
+ /**
+ * Test if the buffer-id of this audio sample may be passed to OpenAL.
+ * @return true if the buffer-id is valid
+ */
+ inline bool is_valid_buffer() const { return _valid_buffer; }
+
+ /**
+ * Set the buffer-id of this audio sample to invalid.
+ */
+ inline void no_valid_buffer() { _valid_buffer = false; }
+
+ /**
+ * Set the playback pitch of this audio sample.
+ * Should be between 0.0 and 2.0 for maximum compatibility.
+ * @param p Pitch
+ */
+ inline void set_pitch( float p ) {
+ if (p > 2.0) p = 2.0; else if (p < 0.01) p = 0.01;
+ _pitch = p; _changed = true;
+ }
+
+ /**
+ * Get the current pitch value of this audio sample.
+ * @return Pitch
+ */
+ inline float get_pitch() { return _pitch; }
+
+ /**
+ * Set the master volume of this sample. Should be between 0.0 and 1.0.
+ * The final volume is calculated by multiplying the master and audio sample
+ * volume.
+ * @param v Volume
+ */
+ inline void set_master_volume( float v ) {
+ if (v > 1.0) v = 1.0; else if (v < 0.0) v = 0.0;
+ _master_volume = v; _changed = true;
+ }
+
+ /**
+ * Set the volume of this audio sample. Should be between 0.0 and 1.0.
+ * The final volume is calculated by multiplying the master and audio sample
+ * volume.
+ * @param v Volume
+ */
+ inline void set_volume( float v ) {
+ if (v > 1.0) v = 1.0; else if (v < 0.0) v = 0.0;
+ _volume = v; _changed = true;
+ }
+
+ /**
+ * Get the final volume value of this audio sample.
+ * @return Volume