Fix issues related to volume getting/setting

Not adding headroom to volume in HybridDirectSoundBuffer_SetMixBinVolumes_8
caused the sound to be attenuated by the headroom value every time
it was updated.
This commit is contained in:
Silent 2020-10-11 00:10:06 +02:00
parent a380927fba
commit ad6438f936
No known key found for this signature in database
GPG Key ID: AE53149BB0C45AF1
2 changed files with 3 additions and 3 deletions

View File

@ -1319,7 +1319,7 @@ static inline HRESULT HybridDirectSoundBuffer_SetMixBinVolumes_8(
}
if (counter > 0) {
Xb_volumeMixBin = volume / (LONG)counter;
int32_t Xb_volume = Xb_Voice->GetVolume();
int32_t Xb_volume = Xb_Voice->GetVolume() + Xb_Voice->GetHeadroom();
hRet = HybridDirectSoundBuffer_SetVolume(pDSBuffer, Xb_volume, EmuFlags,
Xb_volumeMixBin, Xb_Voice);
} else {

View File

@ -117,7 +117,7 @@ uint32_t GetVolume(T& settings)
// Interface for set volume
template<class T>
void SetVolume(T& settings, uint32_t volume)
void SetVolume(T& settings, int32_t volume)
{
settings.volume = volume - settings.headroom;
}
@ -133,7 +133,7 @@ uint32_t GetHeadroom(T& settings)
template<class T>
void SetHeadroom(T& settings, uint32_t set_headroom)
{
settings.volume = settings.volume - set_headroom - settings.headroom;
settings.volume = settings.volume + settings.headroom - set_headroom;
settings.headroom = set_headroom;
}