diff options
Diffstat (limited to '')
-rw-r--r-- | src/audio/AudioLogic.cpp | 6 | ||||
-rw-r--r-- | src/audio/AudioManager.cpp | 2 | ||||
-rw-r--r-- | src/audio/AudioManager.h | 4 | ||||
-rw-r--r-- | src/audio/MusicManager.cpp | 18 | ||||
-rw-r--r-- | src/audio/sampman_miles.cpp | 20 | ||||
-rw-r--r-- | src/audio/sampman_oal.cpp | 20 |
6 files changed, 33 insertions, 37 deletions
diff --git a/src/audio/AudioLogic.cpp b/src/audio/AudioLogic.cpp index 83663449..2a83139e 100644 --- a/src/audio/AudioLogic.cpp +++ b/src/audio/AudioLogic.cpp @@ -3032,7 +3032,7 @@ cAudioManager::ProcessVehicleOneShots(cVehicleParams& params) m_sQueueSample.m_nSampleIndex = SFX_GLASS_CRACK; m_sQueueSample.m_nBankIndex = SFX_BANK_0; m_sQueueSample.m_nCounter = 68; - emittingVol = m_anRandomTable[1] % 30 + 80; //GetRandomNumberInRange(1, 80, 109) + emittingVol = m_anRandomTable[1] % 30 + 80; m_sQueueSample.m_nFrequency = SampleManager.GetSampleBaseFrequency(SFX_GLASS_CRACK); m_sQueueSample.m_nReleasingVolumeModificator = 5; m_sQueueSample.m_fSpeedMultiplier = 0.0f; @@ -3827,8 +3827,8 @@ uint8 gJumboVolOffsetPercentage; void DoJumboVolOffset() { - if (!(AudioManager.GetFrameCounter() % (AudioManager.GetRandomNumber(0) % 6 + 3))) - gJumboVolOffsetPercentage = AudioManager.GetRandomNumber(1) % 60; + if (!(AudioManager.m_FrameCounter % (AudioManager.m_anRandomTable[0] % 6 + 3))) + gJumboVolOffsetPercentage = AudioManager.m_anRandomTable[1] % 60; } void diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp index d348737a..398224f0 100644 --- a/src/audio/AudioManager.cpp +++ b/src/audio/AudioManager.cpp @@ -674,7 +674,7 @@ cAudioManager::AddReflectionsToRequestedQueue() for (uint32 i = 0; i < ARRAY_SIZE(m_afReflectionsDistances); i++) { if ( CTimer::GetIsSlowMotionActive() ) - m_afReflectionsDistances[i] = GetRandomNumberInRange(i % 4, 0, 2) * 100.f / 8.f; + m_afReflectionsDistances[i] = (m_anRandomTable[i % 4] % 3) * 100.f / 8.f; reflectionDistance = m_afReflectionsDistances[i]; if (reflectionDistance > 0.0f && reflectionDistance < 100.f && reflectionDistance < m_sQueueSample.m_fSoundIntensity) { diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h index 28623f95..196144b3 100644 --- a/src/audio/AudioManager.h +++ b/src/audio/AudioManager.h @@ -251,10 +251,6 @@ public: ~cAudioManager(); // getters - uint32 GetFrameCounter() const { return m_FrameCounter; } - float GetReflectionsDistance(int32 idx) const { return m_afReflectionsDistances[idx]; } - int32 GetRandomNumber(int32 idx) const { return m_anRandomTable[idx]; } - int32 GetRandomNumberInRange(int32 idx, int32 low, int32 high) const { return (m_anRandomTable[idx] % (high - low + 1)) + low; } bool8 IsMissionAudioSamplePlaying(uint8 slot); // { return m_sMissionAudio.m_nPlayStatus == 1; } bool8 ShouldDuckMissionAudio(uint8 slot); diff --git a/src/audio/MusicManager.cpp b/src/audio/MusicManager.cpp index 855de1d0..7033532c 100644 --- a/src/audio/MusicManager.cpp +++ b/src/audio/MusicManager.cpp @@ -132,23 +132,23 @@ cMusicManager::SetStartingTrackPositions(bool8 isNewGameTimer) if (IsInitialised()) { time_t timevalue = time(0); if (timevalue == -1) { - pos = AudioManager.GetRandomNumber(0); + pos = AudioManager.m_anRandomTable[0]; } else { tm* pTm = localtime(&timevalue); if (pTm->tm_sec == 0) - pTm->tm_sec = AudioManager.GetRandomNumber(0); + pTm->tm_sec = AudioManager.m_anRandomTable[0]; if (pTm->tm_min == 0) - pTm->tm_min = AudioManager.GetRandomNumber(1); + pTm->tm_min = AudioManager.m_anRandomTable[1]; if (pTm->tm_hour == 0) - pTm->tm_hour = AudioManager.GetRandomNumber(2); + pTm->tm_hour = AudioManager.m_anRandomTable[2]; if (pTm->tm_mday == 0) - pTm->tm_mday = AudioManager.GetRandomNumber(3); + pTm->tm_mday = AudioManager.m_anRandomTable[3]; if (pTm->tm_mon == 0) - pTm->tm_mon = AudioManager.GetRandomNumber(4); + pTm->tm_mon = AudioManager.m_anRandomTable[4]; if (pTm->tm_year == 0) - pTm->tm_year = AudioManager.GetRandomNumber(3); + pTm->tm_year = AudioManager.m_anRandomTable[3]; if (pTm->tm_wday == 0) - pTm->tm_wday = AudioManager.GetRandomNumber(2); + pTm->tm_wday = AudioManager.m_anRandomTable[2]; pos = pTm->tm_yday * pTm->tm_wday * pTm->tm_year @@ -1171,7 +1171,7 @@ cMusicManager::GetCarTuning() if (UsesPoliceRadio(veh)) return STREAMED_SOUND_RADIO_POLICE; if (UsesTaxiRadio(veh)) return STREAMED_SOUND_RADIO_TAXI; if (veh->m_nRadioStation == USERTRACK && !SampleManager.IsMP3RadioChannelAvailable()) - veh->m_nRadioStation = AudioManager.GetRandomNumber(2) % USERTRACK; + veh->m_nRadioStation = AudioManager.m_anRandomTable[2] % USERTRACK; return veh->m_nRadioStation; } diff --git a/src/audio/sampman_miles.cpp b/src/audio/sampman_miles.cpp index 73d4406d..06aac379 100644 --- a/src/audio/sampman_miles.cpp +++ b/src/audio/sampman_miles.cpp @@ -1383,7 +1383,7 @@ cSampleManager::Initialise(void) int32 randval; if ( bUseRandomTable ) - randval = AudioManager.GetRandomNumber(1); + randval = AudioManager.m_anRandomTable[1]; else randval = localtm->tm_sec * localtm->tm_min; @@ -1394,7 +1394,7 @@ cSampleManager::Initialise(void) randmp3 = randmp3->pNext; if ( bUseRandomTable ) - _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; + _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength; else { if ( localtm->tm_sec > 0 ) @@ -1403,7 +1403,7 @@ cSampleManager::Initialise(void) _CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength; } else - _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; + _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength; } } else @@ -1732,7 +1732,7 @@ cSampleManager::UpdateReverb(void) if ( !usingEAX ) return FALSE; - if ( AudioManager.GetFrameCounter() & 15 ) + if ( AudioManager.m_FrameCounter & 15 ) return FALSE; float fRatio = 0.0f; @@ -1740,13 +1740,13 @@ cSampleManager::UpdateReverb(void) #define MIN_DIST 0.5f #define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0) - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_NORTH), 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_SOUTH), 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_WEST), 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_EAST), 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_NORTH], 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_SOUTH], 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_WEST], 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_EAST], 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_NORTH) + AudioManager.GetReflectionsDistance(REFLECTION_SOUTH)) / 2.f, 4.0f, 1/3.f); - fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_WEST) + AudioManager.GetReflectionsDistance(REFLECTION_EAST)) / 2.f, 4.0f, 1/3.f); + fRatio += CALCULATE_RATIO((AudioManager.m_afReflectionsDistances[REFLECTION_NORTH] + AudioManager.m_afReflectionsDistances[REFLECTION_SOUTH]) / 2.f, 4.0f, 1/3.f); + fRatio += CALCULATE_RATIO((AudioManager.m_afReflectionsDistances[REFLECTION_WEST] + AudioManager.m_afReflectionsDistances[REFLECTION_EAST]) / 2.f, 4.0f, 1/3.f); #undef CALCULATE_RATIO #undef MIN_DIST diff --git a/src/audio/sampman_oal.cpp b/src/audio/sampman_oal.cpp index 60d26b7d..473e7ead 100644 --- a/src/audio/sampman_oal.cpp +++ b/src/audio/sampman_oal.cpp @@ -1107,7 +1107,7 @@ cSampleManager::Initialise(void) int32 randval; if ( bUseRandomTable ) - randval = AudioManager.GetRandomNumber(1); + randval = AudioManager.m_anRandomTable[1]; else randval = localtm->tm_sec * localtm->tm_min; @@ -1118,7 +1118,7 @@ cSampleManager::Initialise(void) randmp3 = randmp3->pNext; if ( bUseRandomTable ) - _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; + _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength; else { if ( localtm->tm_sec > 0 ) @@ -1127,7 +1127,7 @@ cSampleManager::Initialise(void) _CurMP3Pos = s*s*s*s*s*s*s*s % randmp3->nTrackLength; } else - _CurMP3Pos = AudioManager.GetRandomNumber(0) % randmp3->nTrackLength; + _CurMP3Pos = AudioManager.m_anRandomTable[0] % randmp3->nTrackLength; } } else @@ -1470,7 +1470,7 @@ bool8 cSampleManager::UpdateReverb(void) if ( !usingEAX && !_usingEFX ) return FALSE; - if ( AudioManager.GetFrameCounter() & 15 ) + if ( AudioManager.m_FrameCounter & 15 ) return FALSE; float fRatio = 0.0f; @@ -1478,13 +1478,13 @@ bool8 cSampleManager::UpdateReverb(void) #define MIN_DIST 0.5f #define CALCULATE_RATIO(value, maxDist, maxRatio) (value > MIN_DIST && value < maxDist ? value / maxDist * maxRatio : 0) - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_NORTH), 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_SOUTH), 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_WEST), 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO(AudioManager.GetReflectionsDistance(REFLECTION_CEIL_EAST), 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_NORTH], 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_SOUTH], 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_WEST], 10.0f, 1/2.f); + fRatio += CALCULATE_RATIO(AudioManager.m_afReflectionsDistances[REFLECTION_CEIL_EAST], 10.0f, 1/2.f); - fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_NORTH) + AudioManager.GetReflectionsDistance(REFLECTION_SOUTH)) / 2.f, 4.0f, 1/3.f); - fRatio += CALCULATE_RATIO((AudioManager.GetReflectionsDistance(REFLECTION_WEST) + AudioManager.GetReflectionsDistance(REFLECTION_EAST)) / 2.f, 4.0f, 1/3.f); + fRatio += CALCULATE_RATIO((AudioManager.m_afReflectionsDistances[REFLECTION_NORTH] + AudioManager.m_afReflectionsDistances[REFLECTION_SOUTH]) / 2.f, 4.0f, 1/3.f); + fRatio += CALCULATE_RATIO((AudioManager.m_afReflectionsDistances[REFLECTION_WEST] + AudioManager.m_afReflectionsDistances[REFLECTION_EAST]) / 2.f, 4.0f, 1/3.f); #undef CALCULATE_RATIO #undef MIN_DIST |