My Project
Static Public Member Functions | List of all members
ParaScripting::ParaAudio Class Reference

Audio Engine functions. More...

#include <ParaScriptingAudio1.h>

Static Public Member Functions

static bool IsAudioEngineEnabled ()
 -------------— Audio Engine Functions -------------— get is audio engine enabled
 
static void EnableAudioEngine ()
 enable Audio Engine
 
static void DisableAudioEngine ()
 disable Audio Engine
 
static void SetVolume (float fVolume)
 Set the volume of all categories and all currently playing wave files. More...
 
static float GetVolume ()
 Get the volume of average if all categories. More...
 
static void PauseCategory (const char *strCategoryName)
 pause certain category in Audio Engine More...
 
static void ResumeCategory (const char *strCategoryName)
 resume certain category in Audio Engine More...
 
static void StopCategory (const char *strCategoryName)
 stop certain category in Audio Engine More...
 
static void EnableAudioBank (const char *strBankName)
 initialize the audio banks needed in Audio Engine This function is only for backward compatible, use LoadSoundBank(), LoadInMemoryWaveBank(), and LoadStreamWaveBank() instead. More...
 
static void DisableAudioBank (const char *strBankName)
 clean up the audio banks needed in Audio Engine More...
 
static int LoadSoundBank (const char *filename)
 Load a sound bank. More...
 
static int UnLoadSoundBank (const char *filename)
 unload a sound bank
 
static int LoadInMemoryWaveBank (const char *filename)
 Load an in memory wave bank. More...
 
static int UnLoadInMemoryWaveBank (const char *filename)
 unload a wave bank
 
static int LoadStreamWaveBank (const char *filename)
 Load an stream wave bank. More...
 
static int UnLoadStreamWaveBank (const char *filename)
 unload a wave bank
 
static string GetCurrentAudioBankName ()
 get the current audio bank name More...
 
static void SetAudioStereo ()
 set listener's sound output format to stereo
 
static void SetAudio5Point1 ()
 set listener's sound output format to 5.1 sound
 
static int GetAudioFormat ()
 get listener's sound output format More...
 
static void PlayBGMusic (const char *strBGMusicName)
 -------------— Background Functions -------------— play background music More...
 
static void PauseBGMusic ()
 pause background music More...
 
static void ResumeBGMusic ()
 resume background music More...
 
static void StopBGMusic ()
 stop background music More...
 
static bool IsBGMusicEnabled ()
 get is background music enabled
 
static void EnableBGMusic ()
 enable background music
 
static void DisableBGMusic ()
 disable background music
 
static float GetBGMusicVolume ()
 Get background music volume. More...
 
static void SetBGMusicVolume (const float fVolume)
 set background music volume More...
 
static void PlayDialog (const char *strDialogName, const char *strScript)
 -------------— Dialog Functions -------------— play dialog music More...
 
static void SkipDialog ()
 skip dialog music to the next marker
 
static void PauseDialog ()
 pause dialog music
 
static void ResumeDialog ()
 resume dialog music
 
static void StopDialog ()
 stop dialog music
 
static bool IsDialogEnabled ()
 get is dialog music enabled
 
static void EnableDialog ()
 enable dialog music
 
static void DisableDialog ()
 disable dialog music
 
static float GetDialogVolume ()
 get dialog volume More...
 
static void SetDialogVolume (const float fVolume)
 set dialog volume More...
 
static void PlayAmbientSound (const char *strAmbientSoundName)
 -------------— Ambient Sound Functions -------------— play ambient sound More...
 
static void PauseAmbientSound (const char *strAmbientSoundName)
 pause ambient sound More...
 
static void ResumeAmbientSound (const char *strAmbientSoundName)
 resume ambient sound More...
 
static void StopAmbientSound (const char *strAmbientSoundName)
 stop ambient sound More...
 
static bool IsAmbientSoundEnabled ()
 get is ambient sound enabled
 
static void EnableAmbientSound ()
 enable ambient sound music
 
static void DisableAmbientSound ()
 disable ambient sound music
 
static float GetAmbientSoundVolume ()
 get ambient sound volume More...
 
static void SetAmbientSoundVolume (const float fVolume)
 set ambient sound volume More...
 
static void PlayUISound (const char *strUISoundName)
 -------------— UserInterface Sound Functions -------------— play UI sound More...
 
static float GetUISoundVolume ()
 get UI sound volume More...
 
static void SetUISoundVolume (const float fVolume)
 set UI sound volume More...
 
static void PlayStatic3DSound (const char *str3DSoundName, const char *assetName, float x, float y, float z)
 -------------— 3D Sound Functions -------------— play 3D sound in static position More...
 
static void PauseStatic3DSound (const char *assetName)
 pause 3D sound in static position More...
 
static void ResumeStatic3DSound (const char *assetName)
 Resume 3D sound in static position. More...
 
static void StopStatic3DSound (const char *assetName)
 stop 3D sound in static position More...
 
static void PlayDynamic3DSound (const char *str3DSoundName, const char *objectName)
 play 3D sound to dynamic object More...
 
static float Get3DSoundVolume ()
 get 3D sound volume More...
 
static void Set3DSoundVolume (const float fVolume)
 set 3D sound volume More...
 
static void PlayInteractiveSound (const char *strInteractiveSoundName)
 -------------— Interactive Sound Functions -------------— play Interactive sound More...
 
static float GetInteractiveSoundVolume ()
 get interactive sound volume More...
 
static void SetInteractiveSoundVolume (const float fVolume)
 set interactive sound volume More...
 
static bool PlayWaveFile (const char *szWavePath, int nLoopCount)
 Prepare and play a wave object from a standard PCM, XMA (Xbox 360) file. More...
 
static bool PlayWaveFile1 (const char *szWavePath)
 
static bool StopWaveFile (const char *szWavePath, bool bImmediateStop)
 stop a wave file More...
 
static bool StopWaveFile1 (const char *szWavePath)
 
static bool ReleaseWaveFile (const char *szWavePath)
 release a wave file More...
 
static const char * GetRecordingDeviceEnum ()
 enumerate the available recording devices in this machine. More...
 
static const char * GetRecordingFormatEnum ()
 enumerate the available recording formats on this machine. More...
 
static bool SetRecordingOutput (const char *sOutputFile, int nDeviceIndex, int nWaveFormatIndex)
 set the recording output properties for recording with BeginRecording() and StopRecording() function. More...
 
static bool BeginRecording ()
 start recording to the current recording output
 
static bool PauseOrResumeRecording (int nState)
 
static bool StopRecording ()
 stop recording and save output to the current recording output
 
static bool IsRecording ()
 whether it is recording sound. More...
 
static bool IsRecordingPaused ()
 whether it is recording is paused. More...
 
static const char * GetLastRecordedData (int nTimeLength)
 try return a snapshot of the recorded wave data in the last nTimeLength time. More...
 
static bool IsAudioEngineEnabled ()
 -------------— Audio Engine Functions -------------— get is audio engine enabled
 
static void EnableAudioEngine (bool bEnable)
 enable Audio Engine
 
static void SetVolume (float fVolume)
 Set the volume of all categories and all currently playing wave files. More...
 
static float GetVolume ()
 Get the volume of average if all categories. More...
 
static ParaAudioSource Create (const char *sName, const char *sWavePath, bool bStream)
 create a given audio source by name. More...
 
static ParaAudioSource Get (const char *sName)
 get audio source by name. More...
 
static ParaAudioSource CreateGet (const char *sName, const char *sWavePath, bool bStream)
 get a given audio source by name. More...
 
static void SetDistanceModel (int eDistModel)
 set the audio distance model. More...
 
static bool PlayWaveFile (const char *szWavePath, int nLoop)
 Prepare and play a wave object from a standard wave file (wav, mp3, ogg/vorbis). More...
 
static bool PlayWaveFile1 (const char *szWavePath)
 
static int PlayMidiMsg (DWORD dwMsg)
 more information, please see: midiOutShortMsg More...
 
static bool StopWaveFile (const char *szWavePath, bool bImmediateStop)
 stop a wave file More...
 
static bool StopWaveFile1 (const char *szWavePath)
 
static bool ReleaseWaveFile (const char *szWavePath)
 release a wave file More...
 

Detailed Description

Audio Engine functions.

Member Function Documentation

§ Create()

ParaAudioSource ParaAudio::Create ( const char *  sName,
const char *  sWavePath,
bool  bStream 
)
static

create a given audio source by name.

If no audio source with the name is loaded before, we will create one new; otherwise we will overwrite the previous one.

Parameters
sNamethe audio source name. Usually same as the audio file path, however it can be any string.
sWavePathif NULL, it will defaults to sName. Please note, in order to play the same music at the same time, they must be created with different names.
bStreamwhether to stream the music once created.
Returns
CAudioSource2_ptr object returned. It may be null if failed.

§ CreateGet()

ParaAudioSource ParaAudio::CreateGet ( const char *  sName,
const char *  sWavePath,
bool  bStream 
)
static

get a given audio source by name.

If no audio source with the name is loaded before, we will create one.

Parameters
sNamethe audio source name. Usually same as the audio file path, however it can be any string.
sWavePathif NULL, it will defaults to sName. Please note, in order to play the same music at the same time, they must be created with different names.
bStreamwhether to stream the music once created.
Returns
CAudioSource2_ptr object returned. It may be null if failed.

§ DisableAudioBank()

static void ParaScripting::ParaAudio::DisableAudioBank ( const char *  strBankName)
static

clean up the audio banks needed in Audio Engine

Parameters
strBankNamesound and wave bank name

§ EnableAudioBank()

static void ParaScripting::ParaAudio::EnableAudioBank ( const char *  strBankName)
static

initialize the audio banks needed in Audio Engine This function is only for backward compatible, use LoadSoundBank(), LoadInMemoryWaveBank(), and LoadStreamWaveBank() instead.

Parameters
strBankNamesound and wave bank name. If the name is Name, then the following files are loaded automatically. in memory wave bank: "audio/Name/Name-InMemory.xwb" stream wave bank: "audio/Name/Name-Stream.xwb" sound bank: "audio/Name/Haqi.xsb"

§ Get()

ParaAudioSource ParaAudio::Get ( const char *  sName)
static

get audio source by name.

The source should be created by Create() function.

§ Get3DSoundVolume()

static float ParaScripting::ParaAudio::Get3DSoundVolume ( )
static

get 3D sound volume

Parameters
fVolume3D sound volume

§ GetAmbientSoundVolume()

static float ParaScripting::ParaAudio::GetAmbientSoundVolume ( )
static

get ambient sound volume

Parameters
fVolumeambient sound volume

§ GetAudioFormat()

static int ParaScripting::ParaAudio::GetAudioFormat ( )
static

get listener's sound output format

Returns
: 2:Stereo 6:5Point1

§ GetBGMusicVolume()

static float ParaScripting::ParaAudio::GetBGMusicVolume ( )
static

Get background music volume.

Parameters
fVolumebackground music volume

§ GetCurrentAudioBankName()

static string ParaScripting::ParaAudio::GetCurrentAudioBankName ( )
static

get the current audio bank name

Returns
: current audio bank name

§ GetDialogVolume()

static float ParaScripting::ParaAudio::GetDialogVolume ( )
static

get dialog volume

Parameters
fVolumedialog volume

§ GetInteractiveSoundVolume()

static float ParaScripting::ParaAudio::GetInteractiveSoundVolume ( )
static

get interactive sound volume

Parameters
fVolumeinteractive sound volume

§ GetLastRecordedData()

static const char* ParaScripting::ParaAudio::GetLastRecordedData ( int  nTimeLength)
static

try return a snapshot of the recorded wave data in the last nTimeLength time.

just turn the music to strings to be displayed by the GUI.

§ GetRecordingDeviceEnum()

static const char* ParaScripting::ParaAudio::GetRecordingDeviceEnum ( )
static

enumerate the available recording devices in this machine.

returned as strings separated by ';' this function is not thread safe

§ GetRecordingFormatEnum()

static const char* ParaScripting::ParaAudio::GetRecordingFormatEnum ( )
static

enumerate the available recording formats on this machine.

returned as strings separated by ';' this function is not thread safe

§ GetUISoundVolume()

static float ParaScripting::ParaAudio::GetUISoundVolume ( )
static

get UI sound volume

Parameters
fVolumeUI sound volume

§ GetVolume() [1/2]

float ParaAudio::GetVolume ( )
static

Get the volume of average if all categories.

Returns
usually between [0,1], where 0 is silent and 1 is full. value larger than 1 is also possible.

§ GetVolume() [2/2]

static float ParaScripting::ParaAudio::GetVolume ( )
static

Get the volume of average if all categories.

Returns
usually between [0,1], where 0 is silent and 1 is full. value larger than 1 is also possible.

§ IsRecording()

static bool ParaScripting::ParaAudio::IsRecording ( )
static

whether it is recording sound.

§ IsRecordingPaused()

static bool ParaScripting::ParaAudio::IsRecordingPaused ( )
static

whether it is recording is paused.

§ LoadInMemoryWaveBank()

static int ParaScripting::ParaAudio::LoadInMemoryWaveBank ( const char *  filename)
static

Load an in memory wave bank.

note: Currently only one can be loaded at a time, future version may support many.

Parameters
filenamethe logical "*-InMemory.xwb". It can be an asset file. such as "audio/name/name-InMemory.xwb"
Returns
: S_OK if loaded. E_PENDING if we are downloading. E_FAIL if cannot load.

§ LoadSoundBank()

static int ParaScripting::ParaAudio::LoadSoundBank ( const char *  filename)
static

Load a sound bank.

note: Currently only one can be loaded at a time, future version may support many.

Parameters
filenamethe logical *.xsb sound bank file path. It can be an asset file. such as "audio/name/name.xsb"
Returns
: S_OK if loaded. E_PENDING if we are downloading. E_FAIL if cannot load.

§ LoadStreamWaveBank()

static int ParaScripting::ParaAudio::LoadStreamWaveBank ( const char *  filename)
static

Load an stream wave bank.

note: Currently only one can be loaded at a time, future version may support many.

Parameters
filenamethe logical "*-Stream.xwb". It can be an asset file. such as "audio/name/name-Stream.xwb"
Returns
: S_OK if loaded. E_PENDING if we are downloading. E_FAIL if cannot load.

§ PauseAmbientSound()

static void ParaScripting::ParaAudio::PauseAmbientSound ( const char *  strAmbientSoundName)
static

pause ambient sound

Parameters
strAmbientSoundNameambient sound name

§ PauseBGMusic()

static void ParaScripting::ParaAudio::PauseBGMusic ( )
static

pause background music

Parameters
strBGMusicNamebackground music name

§ PauseCategory()

static void ParaScripting::ParaAudio::PauseCategory ( const char *  strCategoryName)
static

pause certain category in Audio Engine

Parameters
strCategoryNamecategory name

§ PauseOrResumeRecording()

static bool ParaScripting::ParaAudio::PauseOrResumeRecording ( int  nState)
static
Parameters
nState0 for toggle pause and resume. -1 for pause, 1 for resume.

§ PauseStatic3DSound()

static void ParaScripting::ParaAudio::PauseStatic3DSound ( const char *  assetName)
static

pause 3D sound in static position

Parameters
assetName3D sound asset name, this is the KEY to the 3D Sound

§ PlayAmbientSound()

static void ParaScripting::ParaAudio::PlayAmbientSound ( const char *  strAmbientSoundName)
static

-------------— Ambient Sound Functions -------------— play ambient sound

Parameters
strAmbientSoundNameambient sound name

§ PlayBGMusic()

static void ParaScripting::ParaAudio::PlayBGMusic ( const char *  strBGMusicName)
static

-------------— Background Functions -------------— play background music

Parameters
strBGMusicNamebackground music name

§ PlayDialog()

static void ParaScripting::ParaAudio::PlayDialog ( const char *  strDialogName,
const char *  strScript 
)
static

-------------— Dialog Functions -------------— play dialog music

Parameters
strDialogNamedialog music name

§ PlayDynamic3DSound()

static void ParaScripting::ParaAudio::PlayDynamic3DSound ( const char *  str3DSoundName,
const char *  objectName 
)
static

play 3D sound to dynamic object

Parameters
str3DSoundName3D sound name
objectName3D sound object name, this is the KEY to the 3D Sound this is the name of the base class BaseObject

§ PlayInteractiveSound()

static void ParaScripting::ParaAudio::PlayInteractiveSound ( const char *  strInteractiveSoundName)
static

-------------— Interactive Sound Functions -------------— play Interactive sound

Parameters
strInteractiveSoundNameinteractive sound name NOTE: Interactive sound is now behave like UI sound, and it don't promise Zero-Latency

§ PlayMidiMsg()

int ParaScripting::ParaAudio::PlayMidiMsg ( DWORD  dwMsg)
static

more information, please see: midiOutShortMsg

Parameters
dwMsgMIDI message. The message is packed into a DWORD value with the first byte of the message in the low-order byte. The message is packed into this parameter as follows.

§ PlayStatic3DSound()

static void ParaScripting::ParaAudio::PlayStatic3DSound ( const char *  str3DSoundName,
const char *  assetName,
float  x,
float  y,
float  z 
)
static

-------------— 3D Sound Functions -------------— play 3D sound in static position

Parameters
str3DSoundName3D sound name
assetName3D sound asset name, this is the KEY to the 3D Sound
x,y,z3D sound position

§ PlayUISound()

static void ParaScripting::ParaAudio::PlayUISound ( const char *  strUISoundName)
static

-------------— UserInterface Sound Functions -------------— play UI sound

Parameters
strUISoundNameUI sound name

§ PlayWaveFile() [1/2]

bool ParaAudio::PlayWaveFile ( const char *  szWavePath,
int  nLoopCount 
)
static

Prepare and play a wave object from a standard PCM, XMA (Xbox 360) file.

If a wave file is already prepared before. It will be reused.

Parameters
szWavePathPath to the wave file.
nLoopCountNumber of times to loop this file. If there is no loop region, but the loop count is nonzero, the entire wave is looped.

§ PlayWaveFile() [2/2]

static bool ParaScripting::ParaAudio::PlayWaveFile ( const char *  szWavePath,
int  nLoop 
)
static

Prepare and play a wave object from a standard wave file (wav, mp3, ogg/vorbis).

If a wave file is already prepared before. It will be reused.

Parameters
szWavePathPath to the wave file. It can be from asset_manifest or relative to current directory path.
nLoop0 means non-looping. 1 means looping.

§ ReleaseWaveFile() [1/2]

bool ParaAudio::ReleaseWaveFile ( const char *  szWavePath)
static

release a wave file

Parameters
szWavePathPath to the wave file.

§ ReleaseWaveFile() [2/2]

static bool ParaScripting::ParaAudio::ReleaseWaveFile ( const char *  szWavePath)
static

release a wave file

Parameters
szWavePathPath to the wave file.

§ ResumeAmbientSound()

static void ParaScripting::ParaAudio::ResumeAmbientSound ( const char *  strAmbientSoundName)
static

resume ambient sound

Parameters
strAmbientSoundNameambient sound name

§ ResumeBGMusic()

static void ParaScripting::ParaAudio::ResumeBGMusic ( )
static

resume background music

Parameters
strBGMusicNamebackground music name

§ ResumeCategory()

static void ParaScripting::ParaAudio::ResumeCategory ( const char *  strCategoryName)
static

resume certain category in Audio Engine

Parameters
strCategoryNamecategory name

§ ResumeStatic3DSound()

static void ParaScripting::ParaAudio::ResumeStatic3DSound ( const char *  assetName)
static

Resume 3D sound in static position.

Parameters
assetName3D sound asset name, this is the KEY to the 3D Sound

§ Set3DSoundVolume()

static void ParaScripting::ParaAudio::Set3DSoundVolume ( const float  fVolume)
static

set 3D sound volume

Parameters
fVolume3D sound volume

§ SetAmbientSoundVolume()

static void ParaScripting::ParaAudio::SetAmbientSoundVolume ( const float  fVolume)
static

set ambient sound volume

Parameters
fVolumeambient sound volume

§ SetBGMusicVolume()

static void ParaScripting::ParaAudio::SetBGMusicVolume ( const float  fVolume)
static

set background music volume

Parameters
fVolumebackground music volume

§ SetDialogVolume()

static void ParaScripting::ParaAudio::SetDialogVolume ( const float  fVolume)
static

set dialog volume

Parameters
fVolumedialog volume

§ SetDistanceModel()

void ParaScripting::ParaAudio::SetDistanceModel ( int  eDistModel)
static

set the audio distance model.

see: http://connect.creativelabs.com/openal/Documentation/OpenAL%201.1%20Specification.htm

Parameters
eDistModelint of following. enum ParaAudioDistanceModelEnum { Audio_DistModel_NONE = 0, Audio_DistModel_INVERSE_DISTANCE, Audio_DistModel_INVERSE_DISTANCE_CLAMPED, Audio_DistModel_LINEAR_DISTANCE, Audio_DistModel_LINEAR_DISTANCE_CLAMPED, Audio_DistModel_EXPONENT_DISTANCE, Audio_DistModel_EXPONENT_DISTANCE_CLAMPED, };

§ SetInteractiveSoundVolume()

static void ParaScripting::ParaAudio::SetInteractiveSoundVolume ( const float  fVolume)
static

set interactive sound volume

Parameters
fVolumeinteractive sound volume

§ SetRecordingOutput()

static bool ParaScripting::ParaAudio::SetRecordingOutput ( const char *  sOutputFile,
int  nDeviceIndex,
int  nWaveFormatIndex 
)
static

set the recording output properties for recording with BeginRecording() and StopRecording() function.

Parameters
sOutputFilethe output file. it can be nil. Default is "temp/soundcapture.wav",
nDeviceIndex-1 to use the current one. or it should be a valid index as in GetRecordingDeviceEnum();
nWaveFormatIndex-1 to use the current one. or it should be a valid index as in GetRecordingFormatEnum();

§ SetUISoundVolume()

static void ParaScripting::ParaAudio::SetUISoundVolume ( const float  fVolume)
static

set UI sound volume

Parameters
fVolumeUI sound volume

§ SetVolume() [1/2]

void ParaAudio::SetVolume ( float  fVolume)
static

Set the volume of all categories and all currently playing wave files.

Parameters
fVolumeusually between [0,1], where 0 is silent and 1 is full. value larger than 1 is also possible.

§ SetVolume() [2/2]

static void ParaScripting::ParaAudio::SetVolume ( float  fVolume)
static

Set the volume of all categories and all currently playing wave files.

Parameters
fVolumeusually between [0,1], where 0 is silent and 1 is full. value larger than 1 is also possible.

§ StopAmbientSound()

static void ParaScripting::ParaAudio::StopAmbientSound ( const char *  strAmbientSoundName)
static

stop ambient sound

Parameters
strAmbientSoundNameambient sound name

§ StopBGMusic()

static void ParaScripting::ParaAudio::StopBGMusic ( )
static

stop background music

Parameters
strBGMusicNamebackground music name

§ StopCategory()

static void ParaScripting::ParaAudio::StopCategory ( const char *  strCategoryName)
static

stop certain category in Audio Engine

Parameters
strCategoryNamecategory name

§ StopStatic3DSound()

static void ParaScripting::ParaAudio::StopStatic3DSound ( const char *  assetName)
static

stop 3D sound in static position

Parameters
assetName3D sound asset name, this is the KEY to the 3D Sound

§ StopWaveFile() [1/2]

bool ParaAudio::StopWaveFile ( const char *  szWavePath,
bool  bImmediateStop 
)
static

stop a wave file

Parameters
szWavePathPath to the wave file.
bImmediateStopif false, it plays the wave to completion, then stops. For looping waves, this flag plays the current iteration to completion, then stops (ignoring any subsequent iterations). In either case, any release (or tail) is played. To stop the wave immediately, use true.

§ StopWaveFile() [2/2]

static bool ParaScripting::ParaAudio::StopWaveFile ( const char *  szWavePath,
bool  bImmediateStop 
)
static

stop a wave file

Parameters
szWavePathPath to the wave file.
bImmediateStopif false, it plays the wave to completion, then stops. For looping waves, this flag plays the current iteration to completion, then stops (ignoring any subsequent iterations). In either case, any release (or tail) is played. To stop the wave immediately, use true.

The documentation for this class was generated from the following files: