/**
* Constructor.
* @param data Pointer to a memory buffer containing this audio sample data
The application may free the data by calling free_data(), otherwise it
/**
* Constructor.
* @param data Pointer to a memory buffer containing this audio sample data
The application may free the data by calling free_data(), otherwise it
* @param len Byte length of array
* @param freq Frequency of the provided data (bytes per second)
* @param format OpenAL format id of the data
*/
* @param len Byte length of array
* @param freq Frequency of the provided data (bytes per second)
* @param format OpenAL format id of the data
*/
- SGSoundSample( unsigned char *data, int len, int freq,
+ SGSoundSample( void** data, int len, int freq, int format=AL_FORMAT_MONO8 );
+ SGSoundSample( const unsigned char** data, int len, int freq,
/**
* Test if this audio sample configuration has changed since the last call.
* Calling this function will reset the flag so calling it a second
/**
* Test if this audio sample configuration has changed since the last call.
* Calling this function will reset the flag so calling it a second
* at the next call op SoundGroup::update()
* @param _loop Define whether this sound should be played in a loop.
*/
* at the next call op SoundGroup::update()
* @param _loop Define whether this sound should be played in a loop.
*/
}
/**
* Check if this audio sample is set to be continuous looping.
* @return Return true if this audio sample is set to looping.
*/
}
/**
* Check if this audio sample is set to be continuous looping.
* @return Return true if this audio sample is set to looping.
*/
- inline void set_data( unsigned char* data ) { _data = data; }
+ 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;
+ }
/**
* Test if the source-id of this audio sample may be passed to OpenAL.
* @return true if the source-id is valid
*/
/**
* Test if the source-id of this audio sample may be passed to OpenAL.
* @return true if the source-id is valid
*/
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
* @param pos Relative position of this sound
*/
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
* @param pos Relative position of this sound
*/
/**
* Get the absolute position of this sound.
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
* @return Absolute position
*/
/**
* Get the absolute position of this sound.
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
* @return Absolute position
*/
/**
* Set the orientation of this sound.
* @param ori Quaternation containing the orientation information
*/
/**
* Set the orientation of this sound.
* @param ori Quaternation containing the orientation information
*/
- void set_orientation( const SGQuatd& ori );
+ inline void set_orientation( const SGQuatd& ori ) {
+ _orientation = ori; _changed = true;
+ }
+
+ inline void set_rotation( const SGQuatd& ec2body ) {
+ _rotation = ec2body; _changed = true;
+ }
/**
* Set direction of this sound relative to the orientation.
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
* @param dir Sound emission direction
*/
/**
* Set direction of this sound relative to the orientation.
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
* @param dir Sound emission direction
*/
* @param inner Inner cone angle (0 - 360 degrees)
* @param outer Outer cone angle (0 - 360 degrees)
* @param gain Remaining gain at the edge of the outer cone (0.0 - 1.0)
*/
void set_audio_cone( float inner, float outer, float gain ) {
* @param inner Inner cone angle (0 - 360 degrees)
* @param outer Outer cone angle (0 - 360 degrees)
* @param gain Remaining gain at the edge of the outer cone (0.0 - 1.0)
*/
void set_audio_cone( float inner, float outer, float gain ) {
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
* @return Orientaton vector
*/
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
* @return Orientaton vector
*/
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
* @return Velocity vector
*/
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
* @return Velocity vector
*/
private:
// Position of the source sound.
SGVec3d _absolute_pos; // absolute position
SGVec3d _relative_pos; // position relative to the base position
SGVec3d _direction; // orientation offset
private:
// Position of the source sound.
SGVec3d _absolute_pos; // absolute position
SGVec3d _relative_pos; // position relative to the base position
SGVec3d _direction; // orientation offset
// The position and orientation of this sound
SGQuatd _orientation; // base orientation
SGVec3f _orivec; // orientation vector for OpenAL
// The position and orientation of this sound
SGQuatd _orientation; // base orientation
SGVec3f _orivec; // orientation vector for OpenAL