summaryrefslogtreecommitdiffstats
path: root/src/audio/sampman_oal.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r--src/audio/sampman_oal.cpp76
1 files changed, 61 insertions, 15 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp
index 9f3156cb..d0b88245 100644
--- a/src/audio/sampman_oal.cpp
+++ b/src/audio/sampman_oal.cpp
@@ -132,6 +132,7 @@ uint32 nNumMP3s;
CStream *aStream[MAX_STREAMS];
uint8 nStreamPan [MAX_STREAMS];
uint8 nStreamVolume[MAX_STREAMS];
+uint8 nStreamLoopedFlag[MAX_STREAMS];
///////////////////////////////////////////////////////////////
// Env Size Diffus Room RoomHF RoomLF DecTm DcHF DcLF Refl RefDel Ref Pan Revb RevDel Rev Pan EchTm EchDp ModTm ModDp AirAbs HFRef LFRef RRlOff FLAGS
@@ -469,6 +470,38 @@ int8 cSampleManager::SetCurrent3DProvider(uint8 nProvider)
return curprovider;
}
+int8
+cSampleManager::AutoDetect3DProviders()
+{
+ if (!AudioManager.IsAudioInitialised())
+ return -1;
+
+ int eax = -1, eax2 = -1, eax3 = -1, ds3dh = -1, ds3ds = -1;
+
+ for (uint32 i = 0; i < GetNum3DProvidersAvailable(); i++)
+ {
+ char* providername = Get3DProviderName(i);
+
+ if (!strcasecmp(providername, "OPENAL SOFT")) {
+ SetCurrent3DProvider(i);
+ if (GetCurrent3DProviderIndex() == i)
+ return i;
+ }
+ }
+
+ 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;
+}
+
bool
cSampleManager::IsMP3RadioChannelAvailable(void)
{
@@ -731,6 +764,12 @@ cSampleManager::SetMusicMasterVolume(uint8 nVolume)
}
void
+cSampleManager::SetMP3BoostVolume(uint8 nVolume)
+{
+ m_nMP3BoostVolume = nVolume;
+}
+
+void
cSampleManager::SetEffectsFadeVolume(uint8 nVolume)
{
m_nEffectsFadeVolume = nVolume;
@@ -752,7 +791,7 @@ cSampleManager::SetMonoMode(uint8 nMode)
bool
cSampleManager::LoadSampleBank(uint8 nBank)
{
- ASSERT( nBank < MAX_SFX_BANKS );
+ ASSERT( nBank < MAX_SFX_BANKS);
if ( CTimer::GetIsCodePaused() )
return false;
@@ -793,7 +832,7 @@ cSampleManager::LoadSampleBank(uint8 nBank)
void
cSampleManager::UnloadSampleBank(uint8 nBank)
{
- ASSERT( nBank < MAX_SFX_BANKS );
+ ASSERT( nBank < MAX_SFX_BANKS);
bSampleBankLoaded[nBank] = false;
}
@@ -801,7 +840,7 @@ cSampleManager::UnloadSampleBank(uint8 nBank)
bool
cSampleManager::IsSampleBankLoaded(uint8 nBank)
{
- ASSERT( nBank < MAX_SFX_BANKS );
+ ASSERT( nBank < MAX_SFX_BANKS);
return bSampleBankLoaded[nBank];
}
@@ -869,7 +908,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
case MUSICMODE_FRONTEND:
{
- if ( MusicManager.GetCurrentTrack() == STREAMED_SOUND_GAME_COMPLETED )
+ if ( MusicManager.GetCurrentTrack() == STREAMED_SOUND_CUTSCENE_FINALE)
return false;
break;
@@ -882,7 +921,7 @@ cSampleManager::LoadPedComment(uint32 nComment)
int samplesSize = m_aSamples[nComment].nSize / 2;
op_pcm_seek(fpSampleDataHandle, m_aSamples[nComment].nOffset / 2);
while (samplesSize > 0) {
- int size = op_read(fpSampleDataHandle, (opus_int16 *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE * nCurrentPedSlot + samplesRead),
+ int size = op_read(fpSampleDataHandle, (opus_int16 *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE * nCurrentPedSlot + samplesRead),
samplesSize, NULL);
if (size <= 0) {
return false;
@@ -1108,10 +1147,8 @@ cSampleManager::SetChannelEmittingVolume(uint32 nChannel, uint32 nVolume)
nChannelVolume[nChannel] = vol;
- // reduce channel volume when JB.MP3 or S4_BDBD.MP3 playing
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
- && MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
- && MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
+ && MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_FINALE )
{
nChannelVolume[nChannel] = vol / 4;
}
@@ -1150,10 +1187,8 @@ cSampleManager::SetChannelVolume(uint32 nChannel, uint32 nVolume)
nChannelVolume[nChannel] = vol;
- // reduce the volume for JB.MP3 and S4_BDBD.MP3
if ( MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE
- && MusicManager.GetCurrentTrack() != STREAMED_SOUND_NEWS_INTRO
- && MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_SAL4_BDBD )
+ && MusicManager.GetCurrentTrack() != STREAMED_SOUND_CUTSCENE_FINALE )
{
nChannelVolume[nChannel] = vol / 4;
}
@@ -1223,7 +1258,7 @@ cSampleManager::StopChannel(uint32 nChannel)
}
void
-cSampleManager::PreloadStreamedFile(uint8 nFile, uint8 nStream)
+cSampleManager::PreloadStreamedFile(uint32 nFile, uint8 nStream)
{
char filename[256];
@@ -1281,7 +1316,7 @@ cSampleManager::StartPreloadedStreamedFile(uint8 nStream)
}
bool
-cSampleManager::StartStreamedFile(uint8 nFile, uint32 nPos, uint8 nStream)
+cSampleManager::StartStreamedFile(uint32 nFile, uint32 nPos, uint8 nStream)
{
char filename[256];
@@ -1372,8 +1407,12 @@ cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffect
if ( stream )
{
- if ( nEffectFlag )
- stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14);
+ if ( nEffectFlag ) {
+ if ( nStream == 1 ) // TODO(MIAMI): || nStream == 2 when we have second mission channel?
+ stream->SetVolume(128*nVolume*m_nEffectsVolume >> 14);
+ else
+ stream->SetVolume(m_nEffectsFadeVolume*nVolume*m_nEffectsVolume >> 14);
+ }
else
stream->SetVolume(m_nMusicFadeVolume*nVolume*m_nMusicVolume >> 14);
@@ -1469,4 +1508,11 @@ cSampleManager::InitialiseSampleBanks(void)
return true;
}
+void
+cSampleManager::SetStreamedFileLoopFlag(uint8 nLoopFlag, uint8 nChannel)
+{
+ if (m_bInitialised)
+ nStreamLoopedFlag[nChannel] = nLoopFlag;
+}
+
#endif