[PATCH 0/2] MR10048: dsound: Flush denormals in the mixing thread.
From: Matteo Bruni <mbruni@codeweavers.com> Notably from DSOUND_Calc3DBuffer() for distant sounds. The idea is to make secondarybuffer_is_audible() work with > 2 channels. --- dlls/dsound/mixer.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c index dbc84cbd04f..f7192bfb1b6 100644 --- a/dlls/dsound/mixer.c +++ b/dlls/dsound/mixer.c @@ -50,6 +50,13 @@ void DSOUND_RecalcVolPan(PDSVOLUMEPAN volpan) TRACE("Vol=%ld Pan=%ld\n", volpan->lVolume, volpan->lPan); /* the AmpFactors are expressed in 16.16 fixed point */ + if (volpan->lVolume == DSBVOLUME_MIN) + { + for (unsigned int i = 0; i < DS_MAX_CHANNELS; i++) + volpan->dwTotalAmpFactor[i] = 0; + TRACE("setting all channel volumes to 0\n"); + return; + } /* FIXME: use calculated vol and pan ampfactors */ temp = (double) (volpan->lVolume - (volpan->lPan > 0 ? volpan->lPan : 0)); volpan->dwTotalAmpFactor[0] = (ULONG) (pow(2.0, temp / 600.0) * 0xffff); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10048
From: Matteo Bruni <mbruni@codeweavers.com> I suspect denormals might be the cause of the unexplained slowness mentioned in a few of the later comments on bug 30639. Denormals can be much slower than normal floats, although the penalty is generally significant only on older CPUs. 64-bit processes default to flushing, so this only really matters for 32-bit. --- dlls/dsound/mixer.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c index f7192bfb1b6..623c15496a8 100644 --- a/dlls/dsound/mixer.c +++ b/dlls/dsound/mixer.c @@ -767,8 +767,10 @@ static void DSOUND_PerformMix(DirectSoundDevice *device) DWORD CALLBACK DSOUND_mixthread(void *p) { DirectSoundDevice *dev = p; + TRACE("(%p)\n", dev); SetThreadDescription(GetCurrentThread(), L"wine_dsound_mixer"); + _controlfp_s(NULL, _DN_FLUSH, _MCW_DN); while (dev->ref) { DWORD ret; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10048
This merge request was approved by Huw Davies. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10048
participants (3)
-
Huw Davies (@huw) -
Matteo Bruni -
Matteo Bruni (@Mystral)