#include <SoundModule.h>
Public Member Functions | |
void | Init () |
Initializes the sound module. | |
void | SetID (const char *id) |
Sets the unique sound module id among network. | |
void | SendToID (const char *id) |
Starts sending voice data to a sound module. | |
void | PlayFromID (const char *id) |
Starts playing voice data coming from a sound module. | |
void | CancelSend (const char *id) |
Stops sending voice data to a sound module. | |
void | CancelPlay (const char *id) |
Stops playing voice data coming from a sound module. | |
void | CancelAllSend () |
Cancels all sending voice. | |
void | CancelAllPlay () |
Cancels all playing voice. | |
void | Iterate () |
Call at regular intervals to ensure proper working. | |
void | Destroy () |
Destroys the sound module. | |
CWavPlayer * | CreateWavPlayer (const char *filename) |
C3DWavPlayer * | Create3DWavPlayer (const char *filename) |
void | DestroyWavPlayer (CWavPlayer *wp) |
void | PlayWav (const char *filename) |
void | Play3DWav (const char *filename, const float *pos, float attn=DEFAULT_ATTENUATION, float attndist=DEFAULT_ATTENUATIONDISTANCE) |
virtual void | ReceivePacket (CPacket *packet) |
ech derived clas must implement its own receive package policy | |
void | SetVoiceVolume (float v) |
float | GetVoiceVolume () |
Returns the volume for voice communication sounds. | |
void | SetWavPlayerVolume (float v) |
float | GetWavPlayerVolume () |
Returns the volume for wav players. (CWavPlayer,C3DWavPlayer,PlayWav). | |
void | SetListenerPosition (const float *pos) |
void | SetListenerDirection (const float *at, const float *up) |
void | SetListenerVelocity (const float *vel) |
void | SetSpeedOfSound (float speed) |
Static Public Member Functions | |
static CSoundModule * | GetInstance () |
sub classes should implement this for easy access to self (which is a singleton) | |
Protected Attributes | |
string | ID |
Holds the sound module ID. | |
CEncodedVoiceRecorder | evr |
The voice recorder. | |
set< string > | sendlist |
The list of IDs that the recorded data is sent to. | |
map< string, CEncodedVoicePlayer > | playlist |
The list of IDs and associated voice players that incoming voice data is played. | |
string | record_options |
The sound options string for recording. Refer to the design report. |
CWavPlayer* CSoundModule::CreateWavPlayer | ( | const char * | filename | ) |
Creates a Wav Player.
filename | The name of the wave file. |
C3DWavPlayer* CSoundModule::Create3DWavPlayer | ( | const char * | filename | ) |
Creates a 3D Wav Player.
filename | The name of the wave file. |
void CSoundModule::DestroyWavPlayer | ( | CWavPlayer * | wp | ) |
Destroys a Wav Player
wp | The wav player or 3d wav player to be destroyed. |
void CSoundModule::PlayWav | ( | const char * | filename | ) |
Plays a Wav file.
filename | The name of the wav file. |
void CSoundModule::Play3DWav | ( | const char * | filename, | |
const float * | pos, | |||
float | attn = DEFAULT_ATTENUATION , |
|||
float | attndist = DEFAULT_ATTENUATIONDISTANCE | |||
) |
Plays a wav in the 3D environment.
filename | The name of the wav file. | |
pos | An array of 3 floats describing the position to play the wav in the world. | |
attn | Attenuation(diminishing) value. | |
attndist | Attenuation distance value. |
void CSoundModule::SetVoiceVolume | ( | float | v | ) |
Sets the volume for voice communication sounds.
v | The volume amount to be set. Should be between 0.0 and 1.0 inclusively. |
void CSoundModule::SetWavPlayerVolume | ( | float | v | ) |
Sets the volume for wav players. (CWavPlayer,C3DWavPlayer,PlayWav)
v | The volume amount to be set. Should be between 0.0 and 1.0 inclusively. |
void CSoundModule::SetListenerPosition | ( | const float * | pos | ) |
Sets the position of the listener for C3DWavPlayer instances.
pos | An array of 3 floats describing the position. |
void CSoundModule::SetListenerDirection | ( | const float * | at, | |
const float * | up | |||
) |
Sets the direction of the listener for C3DWavPlayer instances.
at | An array of 3 floats describing a vector which denotes the looking direction. | |
at | An array of 3 floats describing a vector which denotes the up direction of the listener. Up and At parameters should be perpendicular. |
void CSoundModule::SetListenerVelocity | ( | const float * | vel | ) |
Sets the velocity of the listener for C3DWavPlayer instances.
vel | An array of 3 floats describing a vector which denotes the velocity. |
void CSoundModule::SetSpeedOfSound | ( | float | speed | ) |
Sets the speed of sound for use of Doppler effect.
speed | A float denoting the speed of sound. |