oops, volume is signed integer

This commit is contained in:
RadWolfie 2020-05-10 22:05:20 -05:00
parent 8b780f2d5c
commit ce0e35b052
3 changed files with 16 additions and 16 deletions

View File

@ -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 {

View File

@ -163,8 +163,8 @@ XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D)
funcs.GetFrequencyDefault = reinterpret_cast<pGetUint32>(::GetFrequencyDefault_4034_lower<_u::_settings_4034_lower>);
funcs.GetPitch = reinterpret_cast<pGetInt32>(::GetPitch<_u::_settings_4034_lower>);
funcs.SetPitch = reinterpret_cast<pSetInt32>(::SetPitch<_u::_settings_4034_lower>);
funcs.GetVolume = reinterpret_cast<pGetUint32>(::GetVolume<_u::_settings_4034_lower>);
funcs.SetVolume = reinterpret_cast<pSetUint32>(::SetVolume<_u::_settings_4034_lower>);
funcs.GetVolume = reinterpret_cast<pGetInt32>(::GetVolume<_u::_settings_4034_lower>);
funcs.SetVolume = reinterpret_cast<pSetInt32>(::SetVolume<_u::_settings_4034_lower>);
funcs.GetHeadroom = reinterpret_cast<pGetUint32>(::GetHeadroom<_u::_settings_4034_lower>);
funcs.SetHeadroom = reinterpret_cast<pSetUint32>(::SetHeadroom<_u::_settings_4034_lower>);
}
@ -177,8 +177,8 @@ XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D)
funcs.GetFrequencyDefault = reinterpret_cast<pGetUint32>(::GetFrequencyDefault_4039_upper<_u::_settings_4039_only>);
funcs.GetPitch = reinterpret_cast<pGetInt32>(::GetPitch<_u::_settings_4039_only>);
funcs.SetPitch = reinterpret_cast<pSetInt32>(::SetPitch<_u::_settings_4039_only>);
funcs.GetVolume = reinterpret_cast<pGetUint32>(::GetVolume<_u::_settings_4039_only>);
funcs.SetVolume = reinterpret_cast<pSetUint32>(::SetVolume<_u::_settings_4039_only>);
funcs.GetVolume = reinterpret_cast<pGetInt32>(::GetVolume<_u::_settings_4039_only>);
funcs.SetVolume = reinterpret_cast<pSetInt32>(::SetVolume<_u::_settings_4039_only>);
funcs.GetHeadroom = reinterpret_cast<pGetUint32>(::GetHeadroom<_u::_settings_4039_only>);
funcs.SetHeadroom = reinterpret_cast<pSetUint32>(::SetHeadroom<_u::_settings_4039_only>);
}
@ -191,8 +191,8 @@ XTL::CDirectSoundVoice::CDirectSoundVoice(bool is3D)
funcs.GetFrequencyDefault = reinterpret_cast<pGetUint32>(::GetFrequencyDefault_4039_upper<_u::_settings_4134_upper>);
funcs.GetPitch = reinterpret_cast<pGetInt32>(::GetPitch<_u::_settings_4134_upper>);
funcs.SetPitch = reinterpret_cast<pSetInt32>(::SetPitch<_u::_settings_4134_upper>);
funcs.GetVolume = reinterpret_cast<pGetUint32>(::GetVolume<_u::_settings_4134_upper>);
funcs.SetVolume = reinterpret_cast<pSetUint32>(::SetVolume<_u::_settings_4134_upper>);
funcs.GetVolume = reinterpret_cast<pGetInt32>(::GetVolume<_u::_settings_4134_upper>);
funcs.SetVolume = reinterpret_cast<pSetInt32>(::SetVolume<_u::_settings_4134_upper>);
funcs.GetHeadroom = reinterpret_cast<pGetUint32>(::GetHeadroom<_u::_settings_4134_upper>);
funcs.SetHeadroom = reinterpret_cast<pSetUint32>(::SetHeadroom<_u::_settings_4134_upper>);
}

View File

@ -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() {