From ce0e35b05273d902c8bbc79b11835f7ca1eab141 Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Sun, 10 May 2020 22:05:20 -0500 Subject: [PATCH] oops, volume is signed integer --- .../hle/DSOUND/DirectSound/DirectSoundInline.hpp | 6 +++--- src/core/hle/DSOUND/common/XbInternalDSVoice.cpp | 12 ++++++------ src/core/hle/DSOUND/common/XbInternalStruct.hpp | 14 +++++++------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp b/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp index 3a7533239..714a28219 100644 --- a/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp +++ b/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp @@ -687,7 +687,7 @@ static inline HRESULT DSoundBufferSynchPlaybackFlagAdd( static inline HRESULT DSoundBufferUpdateHostVolume( LPDIRECTSOUNDBUFFER8 pDSBuffer, uint32_t dwEmuFlags, - uint32_t volume + int32_t volume ) { @@ -1183,7 +1183,7 @@ static inline HRESULT HybridDirectSoundBuffer_SetHeadroom( } else { hRet = DS_OK; Xb_Voice->SetHeadroom(dwHeadroom); - uint32_t volume = Xb_Voice->GetVolume(); + int32_t volume = Xb_Voice->GetVolume(); hRet = DSoundBufferUpdateHostVolume(pDSBuffer, dwEmuFlags, volume); } @@ -1315,7 +1315,7 @@ static inline HRESULT HybridDirectSoundBuffer_SetMixBinVolumes_8( } if (counter > 0) { Xb_volumeMixBin = volume / (LONG)counter; - uint32_t Xb_volume = Xb_Voice->GetVolume(); + int32_t Xb_volume = Xb_Voice->GetVolume(); hRet = HybridDirectSoundBuffer_SetVolume(pDSBuffer, Xb_volume, EmuFlags, Xb_volumeMixBin, Xb_Voice); } else { diff --git a/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp b/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp index 5b68ae8ae..d4ae3b2e3 100644 --- a/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp +++ b/src/core/hle/DSOUND/common/XbInternalDSVoice.cpp @@ -163,8 +163,8 @@ XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D) funcs.GetFrequencyDefault = reinterpret_cast(::GetFrequencyDefault_4034_lower<_u::_settings_4034_lower>); funcs.GetPitch = reinterpret_cast(::GetPitch<_u::_settings_4034_lower>); funcs.SetPitch = reinterpret_cast(::SetPitch<_u::_settings_4034_lower>); - funcs.GetVolume = reinterpret_cast(::GetVolume<_u::_settings_4034_lower>); - funcs.SetVolume = reinterpret_cast(::SetVolume<_u::_settings_4034_lower>); + funcs.GetVolume = reinterpret_cast(::GetVolume<_u::_settings_4034_lower>); + funcs.SetVolume = reinterpret_cast(::SetVolume<_u::_settings_4034_lower>); funcs.GetHeadroom = reinterpret_cast(::GetHeadroom<_u::_settings_4034_lower>); funcs.SetHeadroom = reinterpret_cast(::SetHeadroom<_u::_settings_4034_lower>); } @@ -177,8 +177,8 @@ XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D) funcs.GetFrequencyDefault = reinterpret_cast(::GetFrequencyDefault_4039_upper<_u::_settings_4039_only>); funcs.GetPitch = reinterpret_cast(::GetPitch<_u::_settings_4039_only>); funcs.SetPitch = reinterpret_cast(::SetPitch<_u::_settings_4039_only>); - funcs.GetVolume = reinterpret_cast(::GetVolume<_u::_settings_4039_only>); - funcs.SetVolume = reinterpret_cast(::SetVolume<_u::_settings_4039_only>); + funcs.GetVolume = reinterpret_cast(::GetVolume<_u::_settings_4039_only>); + funcs.SetVolume = reinterpret_cast(::SetVolume<_u::_settings_4039_only>); funcs.GetHeadroom = reinterpret_cast(::GetHeadroom<_u::_settings_4039_only>); funcs.SetHeadroom = reinterpret_cast(::SetHeadroom<_u::_settings_4039_only>); } @@ -191,8 +191,8 @@ XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D) funcs.GetFrequencyDefault = reinterpret_cast(::GetFrequencyDefault_4039_upper<_u::_settings_4134_upper>); funcs.GetPitch = reinterpret_cast(::GetPitch<_u::_settings_4134_upper>); funcs.SetPitch = reinterpret_cast(::SetPitch<_u::_settings_4134_upper>); - funcs.GetVolume = reinterpret_cast(::GetVolume<_u::_settings_4134_upper>); - funcs.SetVolume = reinterpret_cast(::SetVolume<_u::_settings_4134_upper>); + funcs.GetVolume = reinterpret_cast(::GetVolume<_u::_settings_4134_upper>); + funcs.SetVolume = reinterpret_cast(::SetVolume<_u::_settings_4134_upper>); funcs.GetHeadroom = reinterpret_cast(::GetHeadroom<_u::_settings_4134_upper>); funcs.SetHeadroom = reinterpret_cast(::SetHeadroom<_u::_settings_4134_upper>); } diff --git a/src/core/hle/DSOUND/common/XbInternalStruct.hpp b/src/core/hle/DSOUND/common/XbInternalStruct.hpp index 23cfa109c..cb9dc9bb1 100644 --- a/src/core/hle/DSOUND/common/XbInternalStruct.hpp +++ b/src/core/hle/DSOUND/common/XbInternalStruct.hpp @@ -111,7 +111,7 @@ struct CDirectSoundVoice : CUnknownGenericManager { uint16_t unknown_0C; // 0x00C // zero'd - unknown XBOXADPCMWAVEFORMAT* p_audio_format; // 0x010 // Same as XBOXADPCMWAVEFORMAT / WAVEFORMATEX structure uint32_t pitch; // 0x014 // Always init and custom pitch from SetFrequency, SetPitch, SetFormat, etc calls. - uint32_t volume; // 0x018 // default: (set volume - headroom) + int32_t volume; // 0x018 // default: (set volume - headroom) uint32_t headroom; // 0x01C // default: (set headroom then update volume) } settings_4034_lower; @@ -123,7 +123,7 @@ struct CDirectSoundVoice : CUnknownGenericManager { int32_t nSamplesPerSec_default; // 0x018 // Always original frequency for check if SetFrequency is given with 0 then use original one. uint32_t bitsPerSample; // 0x01C uint32_t pitch; // 0x020 // Always init and custom pitch from SetFrequency, SetPitch, SetFormat, etc calls. - uint32_t volume; // 0x024 // (set volume - headroom) + int32_t volume; // 0x024 // (set volume - headroom) uint32_t headroom; // 0x028 // (set headroom then update volume) uint32_t unknown_2C[(0x300 - 0x2C) / 4]; // 0x02C - 0x300 (unknown size, likely over 0x200 size. } settings_4039_only; @@ -136,7 +136,7 @@ struct CDirectSoundVoice : CUnknownGenericManager { uint32_t nSamplesPerSec_default; // 0x010 // Always original frequency for check if SetFrequency is given with 0 then use original one. uint32_t bitsPerSample; // 0x014 int32_t pitch; // 0x018 // Always init and custom pitch from SetFrequency, SetPitch, SetFormat, etc calls. - uint32_t volume; // 0x01C // (set volume - headroom) + int32_t volume; // 0x01C // (set volume - headroom) uint32_t headroom; // 0x020 // (set headroom then update volume) uint32_t unknown_24[(0x300 - 0x24) / 4]; // 0x024 - 0x300 (unknown size, likely over 0x200 size. } settings_4134_upper; @@ -156,8 +156,8 @@ struct CDirectSoundVoice : CUnknownGenericManager { pGetUint32 GetFrequencyDefault; pGetInt32 GetPitch; pSetInt32 SetPitch; - pGetUint32 GetVolume; - pSetUint32 SetVolume; + pGetInt32 GetVolume; + pSetInt32 SetVolume; pGetUint32 GetHeadroom; pSetUint32 SetHeadroom; } funcs; @@ -178,10 +178,10 @@ struct CDirectSoundVoice : CUnknownGenericManager { inline void SetPitch(int32_t pitch) { funcs.SetPitch(u, pitch); }; - inline uint32_t GetVolume() { + inline int32_t GetVolume() { return funcs.GetVolume(u); }; - inline void SetVolume(uint32_t volume) { + inline void SetVolume(int32_t volume) { funcs.SetVolume(u, volume); }; inline uint32_t GetHeadroom() {