Merge pull request #2067 from RadWolfie/dsound-fixes
Fix Audio Overall Volume Not Included From Input Sets of Volume
This commit is contained in:
commit
fe0c2db158
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue