mirror of
https://gitlab.com/skmp/dca3-game.git
synced 2025-08-31 10:21:45 +02:00
Merge branch 'skmp/fix-stream-volume-fades' into 'main'
streams: Update volumes on SetMusicMasterVolume/SetMusicFadeVolume See merge request skmp/dca3-game!84
This commit is contained in:
@@ -173,6 +173,7 @@ public:
|
||||
char GetCDAudioDriveLetter (void);
|
||||
|
||||
void UpdateEffectsVolume(void);
|
||||
void UpdateStreamsVolume(void);
|
||||
|
||||
#ifdef DC_SH4
|
||||
void UpdateChannelVolume(uint32 nChannel);
|
||||
|
@@ -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) {
|
||||
|
@@ -198,6 +198,7 @@ public:
|
||||
char GetCDAudioDriveLetter (void);
|
||||
|
||||
void UpdateEffectsVolume(void);
|
||||
void UpdateStreamsVolume(void);
|
||||
|
||||
#ifdef DC_SH4
|
||||
void UpdateChannelVolume(uint32 nChannel);
|
||||
|
@@ -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) {
|
||||
|
Reference in New Issue
Block a user