Increase the number of audio channels to PS2 count and some small audio fixes

This commit is contained in:
Sergeanur
2021-05-23 16:14:30 +03:00
parent c9804510d1
commit 7a2dbd9112
9 changed files with 114 additions and 86 deletions

View File

@@ -13,10 +13,6 @@
cAudioManager AudioManager;
const int channels = ARRAY_SIZE(AudioManager.m_asActiveSamples);
const int policeChannel = channels + 1;
const int allChannels = channels + 2;
#define SPEED_OF_SOUND 343.f
#define TIME_SPENT 50
@@ -26,7 +22,7 @@ cAudioManager::cAudioManager()
m_bReverb = TRUE;
m_fSpeedOfSound = SPEED_OF_SOUND / TIME_SPENT;
m_nTimeSpent = TIME_SPENT;
m_nActiveSamples = NUM_SOUNDS_SAMPLES_SLOTS;
m_nActiveSamples = NUM_CHANNELS_GENERIC;
m_nActiveSampleQueue = 1;
ClearRequestedQueue();
m_nActiveSampleQueue = 0;
@@ -267,7 +263,7 @@ cAudioManager::ResetTimers(uint32 time)
}
ClearActiveSamples();
ClearMissionAudio();
SampleManager.StopChannel(policeChannel);
SampleManager.StopChannel(CHANNEL_POLICE_RADIO);
SampleManager.SetEffectsFadeVolume(0);
SampleManager.SetMusicFadeVolume(0);
MusicManager.ResetMusicAfterReload();
@@ -429,7 +425,7 @@ cAudioManager::ServiceSoundEffects()
{
m_bFifthFrameFlag = (m_FrameCounter++ % 5) == 0;
if (m_nUserPause && !m_nPreviousUserPause) {
for (int32 i = 0; i < allChannels; i++)
for (int32 i = 0; i < NUM_CHANNELS; i++)
SampleManager.StopChannel(i);
ClearRequestedQueue();
@@ -692,7 +688,12 @@ cAudioManager::UpdateReflections()
void
cAudioManager::AddReleasingSounds()
{
bool8 toProcess[44]; // why not 27? because PS2?
// in case someone would want to increase it
#ifdef FIX_BUGS
bool8 toProcess[NUM_CHANNELS_GENERIC];
#else
bool8 toProcess[44];
#endif
int8 queue = m_nActiveSampleQueue == 0 ? 1 : 0;