diff options
Diffstat (limited to 'src/audio/DMAudio.cpp')
-rw-r--r-- | src/audio/DMAudio.cpp | 90 |
1 files changed, 67 insertions, 23 deletions
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp index 9d278046..b3c16941 100644 --- a/src/audio/DMAudio.cpp +++ b/src/audio/DMAudio.cpp @@ -112,25 +112,69 @@ cDMAudio::Get3DProviderName(uint8 id) return AudioManager.Get3DProviderName(id); } +// TODO(Miami): Content of this moved to cSampleManager or cAudioManager int8 cDMAudio::AutoDetect3DProviders(void) { + if (!AudioManager.IsAudioInitialised()) + return -1; + + int eax = -1, eax2 = -1, eax3 = -1, ds3dh = -1, ds3ds = -1; + for ( int32 i = 0; i < GetNum3DProvidersAvailable(); i++ ) { - wchar buff[64]; - - char *name = Get3DProviderName(i); - AsciiToUnicode(name, buff); - char *providername = UnicodeToAscii(buff); + char *providername = Get3DProviderName(i); strupr(providername); -#if defined(AUDIO_MSS) - if ( !strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") ) - return i; -#elif defined(AUDIO_OAL) - if ( !strcmp(providername, "OPENAL SOFT") ) - return i; + +#if defined(AUDIO_OAL) + if (!strcmp(providername, "OPENAL SOFT")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + return i; + } +#else + if (!strcmp(providername, "CREATIVE LABS EAX 3 (TM)")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) { + eax3 = i; + } + } + + if (!strcmp(providername, "CREATIVE LABS EAX 2 (TM)")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + eax2 = i; + } + + if (!strcmp(providername, "CREATIVE LABS EAX (TM)")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + eax = i; + } + + if (!strcmp(providername, "DIRECTSOUND3D HARDWARE SUPPORT")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + ds3dh = i; + } + + if (!strcmp(providername, "DIRECTSOUND3D SOFTWARE EMULATION")) { + SetCurrent3DProvider(i); + if (GetCurrent3DProviderIndex() == i) + ds3ds = i; + } #endif } + if (eax3 != -1) + return eax3; + if (eax2 != -1) + return eax2; + if (eax != -1) + return eax; + if (ds3dh != -1) + return ds3dh; + if (ds3ds != -1) + return ds3ds; return -1; } @@ -296,39 +340,39 @@ cDMAudio::StopCutSceneMusic(void) } void -cDMAudio::PreloadMissionAudio(Const char *missionAudio) +cDMAudio::PreloadMissionAudio(uint8 slot, Const char *missionAudio) { - AudioManager.PreloadMissionAudio(missionAudio); + AudioManager.PreloadMissionAudio(slot, missionAudio); } uint8 -cDMAudio::GetMissionAudioLoadingStatus(void) +cDMAudio::GetMissionAudioLoadingStatus(uint8 slot) { - return AudioManager.GetMissionAudioLoadingStatus(); + return AudioManager.GetMissionAudioLoadingStatus(slot); } void -cDMAudio::SetMissionAudioLocation(float x, float y, float z) +cDMAudio::SetMissionAudioLocation(uint8 slot, float x, float y, float z) { - AudioManager.SetMissionAudioLocation(x, y, z); + AudioManager.SetMissionAudioLocation(slot, x, y, z); } void -cDMAudio::PlayLoadedMissionAudio(void) +cDMAudio::PlayLoadedMissionAudio(uint8 slot) { - AudioManager.PlayLoadedMissionAudio(); + AudioManager.PlayLoadedMissionAudio(slot); } bool -cDMAudio::IsMissionAudioSampleFinished(void) +cDMAudio::IsMissionAudioSampleFinished(uint8 slot) { - return AudioManager.IsMissionAudioSampleFinished(); + return AudioManager.IsMissionAudioSampleFinished(slot); } void -cDMAudio::ClearMissionAudio(void) +cDMAudio::ClearMissionAudio(uint8 slot) { - AudioManager.ClearMissionAudio(); + AudioManager.ClearMissionAudio(slot); } uint8 |