diff options
author | Sergeanur <s.anureev@yandex.ua> | 2020-09-21 18:55:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-21 18:55:51 +0200 |
commit | bde17bb3954354510a5a1ffb6e5b7b8381a16470 (patch) | |
tree | 17316b0f2f789947f024fffb00d27ecad3b43f0c /src/audio/sampman_oal.cpp | |
parent | Fix build (renamed var name in definiton file) (diff) | |
parent | fix enum edditing effects for oal target and small improvements (diff) | |
download | re3-bde17bb3954354510a5a1ffb6e5b7b8381a16470.tar re3-bde17bb3954354510a5a1ffb6e5b7b8381a16470.tar.gz re3-bde17bb3954354510a5a1ffb6e5b7b8381a16470.tar.bz2 re3-bde17bb3954354510a5a1ffb6e5b7b8381a16470.tar.lz re3-bde17bb3954354510a5a1ffb6e5b7b8381a16470.tar.xz re3-bde17bb3954354510a5a1ffb6e5b7b8381a16470.tar.zst re3-bde17bb3954354510a5a1ffb6e5b7b8381a16470.zip |
Diffstat (limited to 'src/audio/sampman_oal.cpp')
-rw-r--r-- | src/audio/sampman_oal.cpp | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 0b59766f..94e653b1 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -43,7 +43,7 @@ cSampleManager SampleManager; bool _bSampmanInitialised = false; -uint32 BankStartOffset[MAX_SAMPLEBANKS]; +uint32 BankStartOffset[MAX_SFX_BANKS]; int prevprovider=-1; int curprovider=-1; @@ -77,10 +77,10 @@ OggOpusFile *fpSampleDataHandle; #else FILE *fpSampleDataHandle; #endif -bool bSampleBankLoaded [MAX_SAMPLEBANKS]; -int32 nSampleBankDiscStartOffset [MAX_SAMPLEBANKS]; -int32 nSampleBankSize [MAX_SAMPLEBANKS]; -uintptr nSampleBankMemoryStartAddress[MAX_SAMPLEBANKS]; +bool bSampleBankLoaded [MAX_SFX_BANKS]; +int32 nSampleBankDiscStartOffset [MAX_SFX_BANKS]; +int32 nSampleBankSize [MAX_SFX_BANKS]; +uintptr nSampleBankMemoryStartAddress[MAX_SFX_BANKS]; int32 _nSampleDataEndOffset; int32 nPedSlotSfx [MAX_PEDSFX]; @@ -574,7 +574,7 @@ cSampleManager::Initialise(void) fpSampleDescHandle = NULL; fpSampleDataHandle = NULL; - for ( int32 i = 0; i < MAX_SAMPLEBANKS; i++ ) + for ( int32 i = 0; i < MAX_SFX_BANKS; i++ ) { bSampleBankLoaded[i] = false; nSampleBankDiscStartOffset[i] = 0; @@ -619,17 +619,17 @@ cSampleManager::Initialise(void) return false; } - nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = (uintptr)malloc(nSampleBankSize[SAMPLEBANK_MAIN]); - ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0); + nSampleBankMemoryStartAddress[SFX_BANK_0] = (uintptr)malloc(nSampleBankSize[SFX_BANK_0]); + ASSERT(nSampleBankMemoryStartAddress[SFX_BANK_0] != 0); - if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] == 0 ) + if ( nSampleBankMemoryStartAddress[SFX_BANK_0] == 0 ) { Terminate(); return false; } - nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX); - ASSERT(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0); + nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = (uintptr)malloc(PED_BLOCKSIZE*MAX_PEDSFX); + ASSERT(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0); } @@ -677,7 +677,7 @@ cSampleManager::Initialise(void) #endif } - LoadSampleBank(SAMPLEBANK_MAIN); + LoadSampleBank(SFX_BANK_0); return true; } @@ -699,16 +699,16 @@ cSampleManager::Terminate(void) CStream::Terminate(); - if ( nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] != 0 ) + if ( nSampleBankMemoryStartAddress[SFX_BANK_0] != 0 ) { - free((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN]); - nSampleBankMemoryStartAddress[SAMPLEBANK_MAIN] = 0; + free((void *)nSampleBankMemoryStartAddress[SFX_BANK_0]); + nSampleBankMemoryStartAddress[SFX_BANK_0] = 0; } - if ( nSampleBankMemoryStartAddress[SAMPLEBANK_PED] != 0 ) + if ( nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] != 0 ) { - free((void *)nSampleBankMemoryStartAddress[SAMPLEBANK_PED]); - nSampleBankMemoryStartAddress[SAMPLEBANK_PED] = 0; + free((void *)nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS]); + nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] = 0; } _bSampmanInitialised = false; @@ -790,14 +790,14 @@ cSampleManager::SetMonoMode(uint8 nMode) bool cSampleManager::LoadSampleBank(uint8 nBank) { - ASSERT( nBank < MAX_SAMPLEBANKS ); + ASSERT( nBank < MAX_SFX_BANKS); if ( CTimer::GetIsCodePaused() ) return false; if ( MusicManager.IsInitialised() && MusicManager.GetMusicMode() == MUSICMODE_CUTSCENE - && nBank != SAMPLEBANK_MAIN ) + && nBank != SFX_BANK_0 ) { return false; } @@ -831,7 +831,7 @@ cSampleManager::LoadSampleBank(uint8 nBank) void cSampleManager::UnloadSampleBank(uint8 nBank) { - ASSERT( nBank < MAX_SAMPLEBANKS ); + ASSERT( nBank < MAX_SFX_BANKS); bSampleBankLoaded[nBank] = false; } @@ -839,7 +839,7 @@ cSampleManager::UnloadSampleBank(uint8 nBank) bool cSampleManager::IsSampleBankLoaded(uint8 nBank) { - ASSERT( nBank < MAX_SAMPLEBANKS ); + ASSERT( nBank < MAX_SFX_BANKS); return bSampleBankLoaded[nBank]; } @@ -932,7 +932,7 @@ cSampleManager::LoadPedComment(uint32 nComment) if ( fseek(fpSampleDataHandle, m_aSamples[nComment].nOffset, SEEK_SET) != 0 ) return false; - if ( fread((void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize ) + if ( fread((void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot), 1, m_aSamples[nComment].nSize, fpSampleDataHandle) != m_aSamples[nComment].nSize ) return false; #endif @@ -940,7 +940,7 @@ cSampleManager::LoadPedComment(uint32 nComment) alBufferData(pedBuffers[nCurrentPedSlot], AL_FORMAT_MONO16, - (void *)(nSampleBankMemoryStartAddress[SAMPLEBANK_PED] + PED_BLOCKSIZE*nCurrentPedSlot), + (void *)(nSampleBankMemoryStartAddress[SFX_BANK_PED_COMMENTS] + PED_BLOCKSIZE*nCurrentPedSlot), m_aSamples[nComment].nSize, m_aSamples[nComment].nFrequency); @@ -953,13 +953,13 @@ cSampleManager::LoadPedComment(uint32 nComment) int32 cSampleManager::GetBankContainingSound(uint32 offset) { - if ( offset >= BankStartOffset[SAMPLEBANK_PED] ) - return SAMPLEBANK_PED; + if ( offset >= BankStartOffset[SFX_BANK_PED_COMMENTS] ) + return SFX_BANK_PED_COMMENTS; - if ( offset >= BankStartOffset[SAMPLEBANK_MAIN] ) - return SAMPLEBANK_MAIN; + if ( offset >= BankStartOffset[SFX_BANK_0] ) + return SFX_BANK_0; - return SAMPLEBANK_INVALID; + return INVALID_SFX_BANK; } int32 @@ -1460,7 +1460,7 @@ cSampleManager::Service(void) bool cSampleManager::InitialiseSampleBanks(void) { - int32 nBank = SAMPLEBANK_MAIN; + int32 nBank = SFX_BANK_0; fpSampleDescHandle = fopen(SampleBankDescFilename, "rb"); if ( fpSampleDescHandle == NULL ) @@ -1492,17 +1492,17 @@ cSampleManager::InitialiseSampleBanks(void) for ( int32 i = 0; i < TOTAL_AUDIO_SAMPLES; i++ ) { #ifdef FIX_BUGS - if (nBank >= MAX_SAMPLEBANKS) break; + if (nBank >= MAX_SFX_BANKS) break; #endif - if ( BankStartOffset[nBank] == BankStartOffset[SAMPLEBANK_MAIN] + i ) + if ( BankStartOffset[nBank] == BankStartOffset[SFX_BANK_0] + i ) { nSampleBankDiscStartOffset[nBank] = m_aSamples[i].nOffset; nBank++; } } - nSampleBankSize[SAMPLEBANK_MAIN] = nSampleBankDiscStartOffset[SAMPLEBANK_PED] - nSampleBankDiscStartOffset[SAMPLEBANK_MAIN]; - nSampleBankSize[SAMPLEBANK_PED] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SAMPLEBANK_PED]; + nSampleBankSize[SFX_BANK_0] = nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS] - nSampleBankDiscStartOffset[SFX_BANK_0]; + nSampleBankSize[SFX_BANK_PED_COMMENTS] = _nSampleDataEndOffset - nSampleBankDiscStartOffset[SFX_BANK_PED_COMMENTS]; return true; } |