18 #include "util/mutex.h" 52 typedef map<string, ParaAudio_3DCUE> POOL_3DCUE_TYPE;
73 HRESULT InitAudioEngine();
79 void CleanupAudioEngine();
112 const char* GetRecordingDeviceEnum();
118 const char* GetRecordingFormatEnum();
126 bool SetRecordingOutput(
const char* sOutputFile,
int nDeviceIndex,
int nWaveFormatIndex);
129 bool BeginRecording();
135 bool IsRecordingPaused();
140 const char* GetLastRecordedData(
int nTimeLength);
145 bool PauseOrResumeRecording(
int nState);
148 bool StopRecording();
153 void SetVolume(
float fVolume);
161 HRESULT InitSoundCapture();
164 HRESULT ReleaseSoundCapture();
169 HRESULT ScanAvailableInputFormats();
174 void GetWaveFormatFromIndex( INT nIndex, WAVEFORMATEX* pwfx );
179 void ConvertWaveFormatToString( WAVEFORMATEX* pwfx, TCHAR* strFormatName,
int cchFormatName );
182 HRESULT InitNotifications();
185 HRESULT DestoryNotifications();
187 const static int NUM_REC_NOTIFICATIONS = 10;
189 LPDIRECTSOUNDCAPTURE m_pDSCapture;
190 LPDIRECTSOUNDCAPTUREBUFFER m_pDSBCapture;
191 LPDIRECTSOUNDNOTIFY m_pDSNotify;
192 GUID m_guidCaptureDevice;
194 WAVEFORMATEX m_wfxInput;
195 DSBPOSITIONNOTIFY m_aPosNotify[ NUM_REC_NOTIFICATIONS + 1 ];
196 BOOL m_abInputFormatSupported[20];
197 DWORD m_dwCaptureBufferSize;
198 DWORD m_dwNextCaptureOffset;
199 DWORD m_dwNotifySize;
201 bool m_bCaptureDeviceAvailable;
203 int m_nCaptureDeviceIndex;
205 int m_nWaveFormatIndex;
207 string m_sCapureFileName;
210 string m_strCaptureFormats;
213 HRESULT RecordCapturedData();
216 static unsigned int __stdcall RecordSoundLoop(
void* parameter);
219 HANDLE m_hRecordingThread;
228 bool IsAudioEngineEnabled();
230 HRESULT EnableAudioEngine( );
232 HRESULT DisableAudioEngine( );
235 HRESULT PauseCategory(
const char * strCategoryName);
238 HRESULT ResumeCategory(
const char * strCategoryName);
241 HRESULT StopCategory(
const char * strCategoryName);
244 HRESULT EnableAudioBank(
const char * strBankName);
247 HRESULT DisableAudioBank(
const char * strBankName);
250 string GetCurrentAudioBankName();
252 HRESULT SetAudioStereo();
254 HRESULT SetAudio5Point1();
257 int GetAudioFormat();
262 HRESULT PlayBGMusic(
const char * strBGMusicName );
265 HRESULT PauseBGMusic( );
268 HRESULT ResumeBGMusic( );
271 HRESULT StopBGMusic( );
273 bool IsBGMusicEnabled();
275 HRESULT EnableBGMusic( );
277 HRESULT DisableBGMusic( );
280 float GetBGMusicVolume( );
283 HRESULT SetBGMusicVolume(
const float fVolume );
288 HRESULT PlayDialog(
const char * strDialogName ,
const char * strScript);
290 HRESULT SkipDialog( );
293 HRESULT PauseDialog( );
296 HRESULT ResumeDialog( );
299 HRESULT StopDialog( );
301 bool IsDialogEnabled();
303 HRESULT EnableDialog( );
305 HRESULT DisableDialog( );
308 float GetDialogVolume( );
311 HRESULT SetDialogVolume(
const float fVolume );
316 HRESULT PlayAmbientSound(
const char * strAmbientSoundName );
319 HRESULT PauseAmbientSound(
const char * strAmbientSoundName );
322 HRESULT ResumeAmbientSound(
const char * strAmbientSoundName );
325 HRESULT StopAmbientSound(
const char * strAmbientSoundName );
327 bool IsAmbientSoundEnabled();
329 HRESULT EnableAmbientSound( );
331 HRESULT DisableAmbientSound( );
334 float GetAmbientSoundVolume( );
337 HRESULT SetAmbientSoundVolume(
const float fVolume );
342 HRESULT PlayUISound(
const char * strUISoundName );
345 float GetUISoundVolume( );
348 HRESULT SetUISoundVolume(
const float fVolume );
356 HRESULT PlayStatic3DSound(
const char * str3DSoundName,
const char * assetName,
float x,
float y,
float z);
359 HRESULT PauseStatic3DSound(
const char * assetName );
362 HRESULT ResumeStatic3DSound(
const char * assetName );
365 HRESULT StopStatic3DSound(
const char * assetName );
370 HRESULT PlayDynamic3DSound(
const char * str3DSoundName,
const char * objectName );
373 float Get3DSoundVolume( );
376 HRESULT Set3DSoundVolume(
const float fVolume );
382 HRESULT PlayInteractiveSound(
const char * strInteractiveSoundName );
385 float GetInteractiveSoundVolume( );
388 HRESULT SetInteractiveSoundVolume(
const float fVolume );
397 HRESULT LoadSoundBank(
const char* filename);
399 HRESULT UnLoadSoundBank(
const char* filename=NULL);
406 HRESULT LoadInMemoryWaveBank(
const char* filename);
408 HRESULT UnLoadInMemoryWaveBank(
const char* filename=NULL);
415 HRESULT LoadStreamWaveBank(
const char* filename);
417 HRESULT UnLoadStreamWaveBank(
const char* filename=NULL);
420 HRESULT FindMediaFileCch(CHAR* strDestPath,
int cchDest, LPCSTR strFilename);
421 HRESULT PlayAmbientWater();
430 IXACTEngine* m_pEngine;
433 HANDLE m_hStreamingWaveBankFile;
434 VOID* m_pbWaveBankInMemory;
438 bool m_bEnableAudioEngine;
439 bool m_bEnableBGMusic;
440 bool m_bEnableDialogMusic;
441 bool m_bEnableAmbientSound;
442 bool m_bEnableUISound;
443 bool m_bEnable3DSound;
444 bool m_bEnableInteractiveSound;
447 float m_fBGMusicVolume;
448 float m_fDialogMusicVolume;
449 float m_fAmbientSoundVolume;
450 float m_fUISoundVolume;
451 float m_f3DSoundVolume;
452 float m_fInteractiveSoundVolume;
456 string m_strCurrentAudioBankName;
458 bool m_bInitializeBanks;
461 typedef pair <XACTINDEX, IXACTCue*> CuePointerPair;
464 map<XACTINDEX, IXACTCue*> m_mapAmbientCuePointer;
468 X3DAUDIO_HANDLE m_x3DInstance;
470 int m_nFrameToApply3DAudio;
472 X3DAUDIO_DSP_SETTINGS m_dspSettings;
474 X3DAUDIO_LISTENER m_listener;
476 X3DAUDIO_EMITTER m_emitter;
478 FLOAT32 m_DelayTimes[2];
480 FLOAT32 m_MatrixCoefficients[2 * 2];
483 POOL_3DCUE_TYPE m_pool_3D_Static_Cues;
485 POOL_3DCUE_TYPE m_pool_3D_Dynamic_Cues;
491 bool m_bHandleStreamingWaveBankPrepared;
492 bool m_bHandleDialogCuePrepared;
493 bool m_bHandleDialogCueStop;
494 bool m_bHandleBGCuePrepared;
495 bool m_bHandleBGCueStop;
498 IXACTSoundBank* m_pSoundBank;
499 IXACTWaveBank* m_pWaveBankInMemory;
500 IXACTWaveBank* m_pWaveBankStream;
503 bool m_bStreamingWaveBankPrepared;
507 XACTINDEX m_iCurrentBGMusic;
508 IXACTCue* m_pCurrentBGMusic;
512 XACTINDEX m_iCurrentDialog;
513 IXACTCue* m_pCurrentDialog;
516 map<string, IXACTWave*> m_codeDrivenFiles;
519 IXACTWaveBank* GetWaveBankStream();
520 IXACTCue* GetCurrentDialog();
521 IXACTCue* GetCurrentBGMusic();
522 void SetHandleStreamingWaveBankPrepared(
bool bHandle );
523 void SetHandleDialogCuePrepared(
bool bHandle );
524 void SetHandleDialogCueStop(
bool bHandle );
525 void SetHandleBGCuePrepared(
bool bHandle );
526 void SetHandleBGCueStop(
bool bHandle );
543 HRESULT PlayWaveFile(PCSTR szWavePath,XACTLOOPCOUNT nLoopCount, WORD wStreamingPacketSize=0,DWORD dwPlayOffset=0, DWORD dwAlignment=2048);
552 HRESULT StopWaveFile(PCSTR szWavePath, DWORD dwFlags);
559 HRESULT ReleaseWaveFile(PCSTR szWavePath);
565 bool IsWaveFileInQueue(
const string& filename);
Vector3 vEmitterPosition
position of the emitter
Definition: AudioEngine.h:35
IXACTCue * pCue
pointer to the cue instance
Definition: AudioEngine.h:33
different physics engine has different winding order.
Definition: EventBinding.h:32
string strKeyName
identity of a 3D cue instance this may be the name of the object in ParaEngine or the script defined ...
Definition: AudioEngine.h:39
Class: CAudioEngine.
Definition: AudioEngine.h:49
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
Struct: ParaAudio_3DCUE.
Definition: AudioEngine.h:28
bool IsValidAndEnabled()
return true if the audio is both valid and enabled.
Definition: AudioEngine.h:95
cross platform mutex
Definition: mutex.h:95
bool bActive
true if playing, false if stopped for garbage collection
Definition: AudioEngine.h:31