diff options
author | Roman Masanin <36927roma@gmail.com> | 2020-09-21 02:21:17 +0200 |
---|---|---|
committer | Roman Masanin <36927roma@gmail.com> | 2020-09-21 02:21:17 +0200 |
commit | 579d96534dfcd9206c659b582740bcadda3469a3 (patch) | |
tree | 44dcf6e830bd5fab96ccc2ac2c26110868b2ed6b | |
parent | cleanup processVehicleEngine and some fixes (diff) | |
download | re3-579d96534dfcd9206c659b582740bcadda3469a3.tar re3-579d96534dfcd9206c659b582740bcadda3469a3.tar.gz re3-579d96534dfcd9206c659b582740bcadda3469a3.tar.bz2 re3-579d96534dfcd9206c659b582740bcadda3469a3.tar.lz re3-579d96534dfcd9206c659b582740bcadda3469a3.tar.xz re3-579d96534dfcd9206c659b582740bcadda3469a3.tar.zst re3-579d96534dfcd9206c659b582740bcadda3469a3.zip |
-rw-r--r-- | src/audio/AudioLogic.cpp | 9 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 2 | ||||
-rw-r--r-- | src/audio/sampman_oal.cpp | 44 |
3 files changed, 28 insertions, 27 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 40d47e1b..e76bb99d 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -290,10 +290,11 @@ void cAudioManager::CalculateDistance(bool &distCalculated, float dist) { if (!distCalculated) { - if (dist <= 0.0) - m_sQueueSample.m_fDistance = 0.0; - else + if (dist > 0.0f) m_sQueueSample.m_fDistance = Sqrt(dist); + + else + m_sQueueSample.m_fDistance = 0.0f; distCalculated = true; } } @@ -1297,7 +1298,7 @@ cAudioManager::ProcessVehicleEngine(cVehicleParams* params) } void -cAudioManager::UpdateGasPedalAudio(CVehicle* veh, eVehicleType vehType) +cAudioManager::UpdateGasPedalAudio(CVehicle* veh, int vehType) { float gasPedal = Abs(veh->m_fGasPedal); float* gasPealAudioPtr; diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 4a32e9db..a93aa6f7 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -360,7 +360,7 @@ public: void ProcessVehicle(CVehicle *vehicle); bool ProcessVehicleDoors(cVehicleParams *params); void ProcessVehicleEngine(cVehicleParams *params); - void UpdateGasPedalAudio(CVehicle* veh, eVehicleType vehType); + void UpdateGasPedalAudio(CVehicle* veh, int vehType); void ProcessVehicleHorn(cVehicleParams *params); void ProcessVehicleOneShots(cVehicleParams *params); bool ProcessVehicleReverseWarning(cVehicleParams *params); diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index fe3ae51e..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; @@ -628,8 +628,8 @@ cSampleManager::Initialise(void) 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); } @@ -705,10 +705,10 @@ cSampleManager::Terminate(void) 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,7 +790,7 @@ cSampleManager::SetMonoMode(uint8 nMode) bool cSampleManager::LoadSampleBank(uint8 nBank) { - ASSERT( nBank < MAX_SAMPLEBANKS ); + ASSERT( nBank < MAX_SFX_BANKS); if ( CTimer::GetIsCodePaused() ) 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[SFX_BANK_0] ) return SFX_BANK_0; - return SAMPLEBANK_INVALID; + return INVALID_SFX_BANK; } int32 @@ -1492,7 +1492,7 @@ 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[SFX_BANK_0] + i ) { @@ -1501,8 +1501,8 @@ cSampleManager::InitialiseSampleBanks(void) } } - nSampleBankSize[SFX_BANK_0] = nSampleBankDiscStartOffset[SAMPLEBANK_PED] - nSampleBankDiscStartOffset[SFX_BANK_0]; - 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; } |