diff --git a/src/liberty/audio/sampman.h b/src/liberty/audio/sampman.h index 00c445ae..aa5e7509 100644 --- a/src/liberty/audio/sampman.h +++ b/src/liberty/audio/sampman.h @@ -173,6 +173,7 @@ public: char GetCDAudioDriveLetter (void); void UpdateEffectsVolume(void); + void UpdateStreamsVolume(void); #ifdef DC_SH4 void UpdateChannelVolume(uint32 nChannel); diff --git a/src/liberty/audio/sampman_dc.cpp b/src/liberty/audio/sampman_dc.cpp index 3769f886..1e3ff96d 100644 --- a/src/liberty/audio/sampman_dc.cpp +++ b/src/liberty/audio/sampman_dc.cpp @@ -545,6 +545,7 @@ void cSampleManager::SetMusicMasterVolume(uint8 nVolume) { m_nMusicVolume = nVolume; + UpdateStreamsVolume(); } void @@ -558,6 +559,7 @@ void cSampleManager::SetMusicFadeVolume(uint8 nVolume) { m_nMusicFadeVolume = nVolume; + UpdateStreamsVolume(); } void @@ -1228,12 +1230,29 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream) return rv; } + +static uint8 nStreamVolumes[MAX_STREAMS]; +static uint8 nStreamPans[MAX_STREAMS]; +static uint8 nStreamEffect[MAX_STREAMS]; +void +cSampleManager::UpdateStreamsVolume(void) +{ + if(_bSampmanInitialised) { + for (int nStream = 0; nStream < MAX_STREAMS; nStream++) { + SetStreamedVolumeAndPan(nStreamVolumes[nStream], nStreamPans[nStream], nStreamEffect[nStream], nStream); + } + } +} + void cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); if (nVolume > MAX_VOLUME) nVolume = MAX_VOLUME; + nStreamVolumes[nStream] = nVolume; + nStreamPans[nStream] = nPan; + nStreamEffect[nStream] = nEffectFlag; nVolume = linearlize_volume(nVolume); //nVolume * 255 / MAX_VOLUME; nVolume = m_nMusicFadeVolume * nVolume * m_nMusicVolume >> 14; if (streams[nStream].vol != nVolume || streams[nStream].nPan != nPan) { diff --git a/src/miami/audio/sampman.h b/src/miami/audio/sampman.h index fff40c50..10b3e61f 100644 --- a/src/miami/audio/sampman.h +++ b/src/miami/audio/sampman.h @@ -198,6 +198,7 @@ public: char GetCDAudioDriveLetter (void); void UpdateEffectsVolume(void); + void UpdateStreamsVolume(void); #ifdef DC_SH4 void UpdateChannelVolume(uint32 nChannel); diff --git a/src/miami/audio/sampman_dc.cpp b/src/miami/audio/sampman_dc.cpp index 5f3c1779..f8def416 100644 --- a/src/miami/audio/sampman_dc.cpp +++ b/src/miami/audio/sampman_dc.cpp @@ -538,7 +538,6 @@ cSampleManager::UpdateEffectsVolume(void) } } - void cSampleManager::SetEffectsMasterVolume(uint8 nVolume) { @@ -550,6 +549,7 @@ void cSampleManager::SetMusicMasterVolume(uint8 nVolume) { m_nMusicVolume = nVolume; + UpdateStreamsVolume(); } void @@ -569,6 +569,7 @@ void cSampleManager::SetMusicFadeVolume(uint8 nVolume) { m_nMusicFadeVolume = nVolume; + UpdateStreamsVolume(); } void @@ -1310,12 +1311,28 @@ cSampleManager::GetStreamedFilePosition(uint8 nStream) return rv; } +static uint8 nStreamVolumes[MAX_STREAMS]; +static uint8 nStreamPans[MAX_STREAMS]; +static uint8 nStreamEffect[MAX_STREAMS]; +void +cSampleManager::UpdateStreamsVolume(void) +{ + if(_bSampmanInitialised) { + for (int nStream = 0; nStream < MAX_STREAMS; nStream++) { + SetStreamedVolumeAndPan(nStreamVolumes[nStream], nStreamPans[nStream], nStreamEffect[nStream], nStream); + } + } +} + void cSampleManager::SetStreamedVolumeAndPan(uint8 nVolume, uint8 nPan, uint8 nEffectFlag, uint8 nStream) { ASSERT( nStream < MAX_STREAMS ); if (nVolume > MAX_VOLUME) nVolume = MAX_VOLUME; + nStreamVolumes[nStream] = nVolume; + nStreamPans[nStream] = nPan; + nStreamEffect[nStream] = nEffectFlag; nVolume = linearlize_volume(nVolume); //nVolume * 255 / MAX_VOLUME; nVolume = m_nMusicFadeVolume * nVolume * m_nMusicVolume >> 14; if (streams[nStream].vol != nVolume || streams[nStream].nPan != nPan) {