summaryrefslogtreecommitdiffstats
path: root/src/audio
diff options
context:
space:
mode:
authoreray orçunus <erayorcunus@gmail.com>2020-07-06 18:26:06 +0200
committereray orçunus <erayorcunus@gmail.com>2020-07-06 18:26:41 +0200
commitc483a044b587691f70fd7e8cb5348c59a8509d76 (patch)
tree99d462a04fd5bc92a2461a976f10d89980a81ea6 /src/audio
parentFrontend: Stats, Briefs, gta_vc.set, slider ranges, fixes (diff)
downloadre3-c483a044b587691f70fd7e8cb5348c59a8509d76.tar
re3-c483a044b587691f70fd7e8cb5348c59a8509d76.tar.gz
re3-c483a044b587691f70fd7e8cb5348c59a8509d76.tar.bz2
re3-c483a044b587691f70fd7e8cb5348c59a8509d76.tar.lz
re3-c483a044b587691f70fd7e8cb5348c59a8509d76.tar.xz
re3-c483a044b587691f70fd7e8cb5348c59a8509d76.tar.zst
re3-c483a044b587691f70fd7e8cb5348c59a8509d76.zip
Diffstat (limited to '')
-rw-r--r--src/audio/DMAudio.cpp66
-rw-r--r--src/audio/DMAudio.h3
2 files changed, 58 insertions, 11 deletions
diff --git a/src/audio/DMAudio.cpp b/src/audio/DMAudio.cpp
index 7581114d..6859cba3 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;
}
diff --git a/src/audio/DMAudio.h b/src/audio/DMAudio.h
index bb1454c9..e7d3a23b 100644
--- a/src/audio/DMAudio.h
+++ b/src/audio/DMAudio.h
@@ -7,6 +7,9 @@
#define AEHANDLE_IS_FAILED(h) ((h)<0)
#define AEHANDLE_IS_OK(h) ((h)>=0)
+#define NO_AUDIO_PROVIDER -3
+#define AUDIO_PROVIDER_NOT_DETERMINED -99
+
class cAudioScriptObject;
class CEntity;