1
0
Fork 0
mirror of https://git.rip/DMCA_FUCKER/re3.git synced 2024-12-23 08:40:07 +00:00

DMAudio fixes

This commit is contained in:
Sergeanur 2020-10-25 09:39:04 +02:00
parent 5e5854b914
commit aac0c3fb67
3 changed files with 26 additions and 36 deletions

View file

@ -113,33 +113,6 @@ cDMAudio::Get3DProviderName(uint8 id)
return AudioManager.Get3DProviderName(id); return AudioManager.Get3DProviderName(id);
} }
int8 cDMAudio::AutoDetect3DProviders(void)
{
for ( int32 i = 0; i < GetNum3DProvidersAvailable(); i++ )
{
wchar buff[64];
#ifdef AUDIO_OAL
if (defaultProvider >= 0 && defaultProvider < GetNum3DProvidersAvailable()) {
return i;
}
#endif
char *name = Get3DProviderName(i);
AsciiToUnicode(name, buff);
char *providername = UnicodeToAscii(buff);
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;
#endif
}
return -1;
}
int8 int8
cDMAudio::GetCurrent3DProviderIndex(void) cDMAudio::GetCurrent3DProviderIndex(void)
{ {
@ -350,7 +323,7 @@ cDMAudio::SetRadioInCar(uint32 radio)
} }
void void
cDMAudio::SetRadioChannel(int8 radio, int32 pos) cDMAudio::SetRadioChannel(uint8 radio, int32 pos)
{ {
MusicManager.SetRadioChannelByScript(radio, pos); MusicManager.SetRadioChannelByScript(radio, pos);
} }

View file

@ -35,8 +35,6 @@ public:
uint8 GetNum3DProvidersAvailable(void); uint8 GetNum3DProvidersAvailable(void);
char *Get3DProviderName(uint8 id); char *Get3DProviderName(uint8 id);
int8 AutoDetect3DProviders(void);
int8 GetCurrent3DProviderIndex(void); int8 GetCurrent3DProviderIndex(void);
int8 SetCurrent3DProvider(uint8 which); int8 SetCurrent3DProvider(uint8 which);
@ -86,6 +84,6 @@ public:
uint8 GetRadioInCar(void); uint8 GetRadioInCar(void);
void SetRadioInCar(uint32 radio); void SetRadioInCar(uint32 radio);
void SetRadioChannel(int8 radio, int32 pos); void SetRadioChannel(uint8 radio, int32 pos);
}; };
extern cDMAudio DMAudio; extern cDMAudio DMAudio;

View file

@ -277,12 +277,31 @@ bool CGame::InitialiseOnceAfterRW(void)
if ( DMAudio.GetNum3DProvidersAvailable() == 0 ) if ( DMAudio.GetNum3DProvidersAvailable() == 0 )
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1; FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = -1;
if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) if ( FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -99 || FrontEndMenuManager.m_nPrefsAudio3DProviderIndex == -2 ) {
{
CMenuManager::m_PrefsSpeakers = 0; CMenuManager::m_PrefsSpeakers = 0;
int8 provider = DMAudio.AutoDetect3DProviders(); int32 i;
if ( provider != -1 ) for (i = 0; i < DMAudio.GetNum3DProvidersAvailable(); i++) {
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = provider; wchar buff[64];
#ifdef AUDIO_OAL
extern int defaultProvider;
if (defaultProvider >= 0 && defaultProvider < DMAudio.GetNum3DProvidersAvailable())
break;
#endif
char *name = DMAudio.Get3DProviderName(i);
AsciiToUnicode(name, buff);
char *providername = UnicodeToAscii(buff);
strupr(providername);
#if defined(AUDIO_MSS)
if (strcmp(providername, "MILES FAST 2D POSITIONAL AUDIO") == 0)
break;
#elif defined(AUDIO_OAL)
if (strcmp(providername, "OPENAL SOFT") == 0)
break;
#endif
}
FrontEndMenuManager.m_nPrefsAudio3DProviderIndex = i;
} }
DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex); DMAudio.SetCurrent3DProvider(FrontEndMenuManager.m_nPrefsAudio3DProviderIndex);