From 0356b40735519dfb5620b7cece3d3b4478703f1b Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Wed, 9 Dec 2020 15:07:28 -0600 Subject: [PATCH 1/2] dsound: add X_DSVOICEPROPS to log for further troubleshooting --- src/core/hle/DSOUND/XbDSoundLogging.cpp | 14 ++++++++++++++ src/core/hle/DSOUND/XbDSoundLogging.hpp | 1 + 2 files changed, 15 insertions(+) diff --git a/src/core/hle/DSOUND/XbDSoundLogging.cpp b/src/core/hle/DSOUND/XbDSoundLogging.cpp index 916c22afb..8b0fb8718 100644 --- a/src/core/hle/DSOUND/XbDSoundLogging.cpp +++ b/src/core/hle/DSOUND/XbDSoundLogging.cpp @@ -275,6 +275,20 @@ LOGRENDER(X_DSI3DL2BUFFER) ; } +LOGRENDER(X_DSVOICEPROPS) +{ + return os + LOGRENDER_MEMBER(dwMixBinCount) + LOGRENDER_MEMBER_ARRAY_TYPE(X_DSMIXBINVOLUMEPAIR, MixBinVolumePairs, dwMixBinCount) + LOGRENDER_MEMBER(lPitch) + LOGRENDER_MEMBER(l3DDistanceVolume) + LOGRENDER_MEMBER(l3DConeVolume) + LOGRENDER_MEMBER(l3DDopplerPitch) + LOGRENDER_MEMBER(lI3DL2DirectVolume) + LOGRENDER_MEMBER(lI3DL2RoomVolume) + ; +} + LOGRENDER(X_DSI3DL2OBSTRUCTION) { return os diff --git a/src/core/hle/DSOUND/XbDSoundLogging.hpp b/src/core/hle/DSOUND/XbDSoundLogging.hpp index 9d99b21ba..dae895c19 100644 --- a/src/core/hle/DSOUND/XbDSoundLogging.hpp +++ b/src/core/hle/DSOUND/XbDSoundLogging.hpp @@ -83,6 +83,7 @@ LOGRENDER_HEADER(X_DSFILTERDESC) LOGRENDER_HEADER(X_DSI3DL2BUFFER) LOGRENDER_HEADER(X_DSI3DL2OBSTRUCTION) LOGRENDER_HEADER(X_DSI3DL2OCCLUSION) +LOGRENDER_HEADER(X_DSVOICEPROPS) LOGRENDER_HEADER(DSLFODESC) LOGRENDER_HEADER(WAVEFORMATEX) LOGRENDER_HEADER(XBOXADPCMWAVEFORMAT) From a02efe04666b431cb67466c04e16f4b6024c465a Mon Sep 17 00:00:00 2001 From: RadWolfie Date: Wed, 9 Dec 2020 15:20:35 -0600 Subject: [PATCH 2/2] dsound: fix overall mixbin volume than only input volume(s) --- .../DSOUND/DirectSound/DirectSoundInline.hpp | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp b/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp index bd215786f..a4ae45224 100644 --- a/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp +++ b/src/core/hle/DSOUND/DirectSound/DirectSoundInline.hpp @@ -1298,26 +1298,28 @@ static inline HRESULT HybridDirectSoundBuffer_SetMixBinVolumes_8( HRESULT hRet = DSERR_INVALIDPARAM; if (pMixBins != xbox::zeroptr && pMixBins->lpMixBinVolumePairs != xbox::zeroptr) { - LONG maxVolume = DSBVOLUME_MIN; - // Let's normalize audio level except for low frequency (subwoofer) + // Update the mixbin volume only, do not reassign volume pair array. for (DWORD i = 0; i < pMixBins->dwCount; i++) { - // Update the mixbin volume only, do not reassign volume pair array. const auto& it_in = pMixBins->lpMixBinVolumePairs[i]; - auto it_out = std::find_if(Xb_VoiceProperties.MixBinVolumePairs, Xb_VoiceProperties.MixBinVolumePairs+Xb_VoiceProperties.dwMixBinCount, + auto it_out = std::find_if(Xb_VoiceProperties.MixBinVolumePairs, Xb_VoiceProperties.MixBinVolumePairs + Xb_VoiceProperties.dwMixBinCount, [&it_in](const auto& e) { return e.dwMixBin == it_in.dwMixBin; }); // Once found a match, set the volume. // NOTE If titles input duplicate with different volume, // it will override previous value. - if (it_out != Xb_VoiceProperties.MixBinVolumePairs+Xb_VoiceProperties.dwMixBinCount) { + if (it_out != Xb_VoiceProperties.MixBinVolumePairs + Xb_VoiceProperties.dwMixBinCount) { it_out->lVolume = it_in.lVolume; } + } - // Since we cannot set per-channel volumes, we want to pick "dominant" volume - if (it_in.dwMixBin != XDSMIXBIN_LOW_FREQUENCY && it_in.dwMixBin < XDSMIXBIN_SPEAKERS_MAX) { - if (it_in.lVolume > maxVolume) { - maxVolume = it_in.lVolume; + // Since we cannot set per-channel volumes, we want to pick "dominant" volume + LONG maxVolume = DSBVOLUME_MIN; + for(unsigned i = 0; i < Xb_VoiceProperties.dwMixBinCount; i++) { + const auto& it_out = Xb_VoiceProperties.MixBinVolumePairs[i]; + if (it_out.dwMixBin != XDSMIXBIN_LOW_FREQUENCY && it_out.dwMixBin < XDSMIXBIN_SPEAKERS_MAX) { + if (maxVolume < it_out.lVolume) { + maxVolume = it_out.lVolume; } } }