diff --git a/README.md b/README.md index 05ee69a3..4ea5e2ef 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,7 @@ Wine-Compholio contains fixes for the following Wine bugs: * Add implementation of WTSEnumerateProcessesW ([Wine Bug #29903](http://bugs.winehq.org/show_bug.cgi?id=29903 "Some Microsoft debuggers fail to enumerate processes due to wtsapi32.WTSEnumerateProcessesW() being a stub (Microsoft Visual Studio 2005, DbgCLR from .NET 2.0 SDK)")) * Add support for extra large and jumbo icon lists in shell32 ([Wine Bug #24721](http://bugs.winehq.org/show_bug.cgi?id=24721 "Explorer++ crashes when choosing to view large icons or extra large icons")) * Allow special characters in pipe names ([Wine Bug #28995](http://bugs.winehq.org/show_bug.cgi?id=28995 "Unable to use named pipes with \">\" character in the name")) +* Audio stuttering and performance drops in multiple applications ([Wine Bug #30639](http://bugs.winehq.org/show_bug.cgi?id=30639 "Audio stuttering and performance drops in Star Wolves 3")) * Fix for ConnectNamedPort return value in overlapped mode ([Wine Bug #16550](http://bugs.winehq.org/show_bug.cgi?id=16550 "ConnectNamedPort should never return OK in overlapped mode (affects chromium ui_tests.exe)")) * GetSecurityInfo returns NULL DACL for process object ([Wine Bug #15980](http://bugs.winehq.org/show_bug.cgi?id=15980 "Rhapsody 2 crashes on startup (GetSecurityInfo returns NULL DACL for process object)")) * Implement LoadIconMetric function ([Wine Bug #35375](http://bugs.winehq.org/show_bug.cgi?id=35375 "Multiple applications need Vista+ API COMCTL32.dll.380 a.k.a. 'LoadIconMetric' (Solidworks 2013 systray monitor, Microsoft One/SkyDrive)")) diff --git a/debian/changelog b/debian/changelog index 2728b1b8..f289fd0f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,10 +17,11 @@ wine-compholio (1.7.24) UNRELEASED; urgency=low * Added patch to use manual redirection for RunDLL_CallEntry16. * Added patch to set ldr.EntryPoint for main executable. * Added patch to fix invalid memory access in windowscodecs/PropertyBag. + * Added patch to use a linear resampler when there a large number of dsound mixing buffers. * Removed patch to create Vista directories (accepted upstream). * Removed strmbase/quartz locking fix patches (accepted upstream). * Removed windowscodecs/PropertyBag patch (accepted upstream). - -- Erich E. Hoover Thu, 07 Aug 2014 23:57:43 +0200 + -- Erich E. Hoover Thu, 07 Aug 2014 17:31:56 -0600 wine-compholio (1.7.23) unstable; urgency=low * Rewrite of patch system to simplify maintaining large patchsets. diff --git a/patches/Makefile b/patches/Makefile index c04fed05..5eafb5e8 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -10,6 +10,7 @@ PATCHLIST := Miscellaneous.ok \ atl-IOCS_Property.ok \ comctl32-LoadIconMetric.ok \ ddraw-Empty_Hardware_Flags.ok \ + dsound-Fast_Mixer.ok \ fonts-Missing_Fonts.ok \ iphlpapi-TCP_Table.ok \ kernel32-GetSystemTimes.ok \ @@ -160,6 +161,24 @@ ddraw-Empty_Hardware_Flags.ok: echo '+ { "ddraw-Empty_Hardware_Flags", "Erich E. Hoover", "Return empty D3D hardware flags for HEL device enumeration." },'; \ ) > ddraw-Empty_Hardware_Flags.ok +# Patchset dsound-Fast_Mixer +# | +# | Included patches: +# | * Add a linear resampler for use with a large number of dsound mixing buffers. [by Alexander E. Patrakov] +# | +# | This patchset fixes the following Wine bugs: +# | * [#30639] Audio stuttering and performance drops in Star Wolves 3 +# | +# | Modified files: +# | * dlls/dsound/dsound_main.c, dlls/dsound/dsound_private.h, dlls/dsound/mixer.c +# | +.INTERMEDIATE: dsound-Fast_Mixer.ok +dsound-Fast_Mixer.ok: + $(PATCH) < dsound-Fast_Mixer/0001-dsound-Add-a-linear-resampler-for-use-with-a-large-n.patch + @( \ + echo '+ { "dsound-Fast_Mixer", "Alexander E. Patrakov", "Add a linear resampler for use with a large number of dsound mixing buffers." },'; \ + ) > dsound-Fast_Mixer.ok + # Patchset fonts-Missing_Fonts # | # | Included patches: diff --git a/patches/dsound-Fast_Mixer/0001-dsound-Add-a-linear-resampler-for-use-with-a-large-n.patch b/patches/dsound-Fast_Mixer/0001-dsound-Add-a-linear-resampler-for-use-with-a-large-n.patch new file mode 100644 index 00000000..37502059 --- /dev/null +++ b/patches/dsound-Fast_Mixer/0001-dsound-Add-a-linear-resampler-for-use-with-a-large-n.patch @@ -0,0 +1,123 @@ +From c62167818f1d4f14eb98e1590beec11056e5712f Mon Sep 17 00:00:00 2001 +From: "Alexander E. Patrakov" +Date: Thu, 7 Aug 2014 17:15:00 -0600 +Subject: dsound: Add a linear resampler for use with a large number of mixing + buffers. + +--- + dlls/dsound/dsound_main.c | 5 +++++ + dlls/dsound/dsound_private.h | 1 + + dlls/dsound/mixer.c | 49 ++++++++++++++++++++++++++++++++++++++++-- + 3 files changed, 53 insertions(+), 2 deletions(-) + +diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c +index 0e3a313..492df48 100644 +--- a/dlls/dsound/dsound_main.c ++++ b/dlls/dsound/dsound_main.c +@@ -93,6 +93,7 @@ WCHAR wine_vxd_drv[] = { 'w','i','n','e','m','m','.','v','x','d', 0 }; + /* All default settings, you most likely don't want to touch these, see wiki on UsefulRegistryKeys */ + int ds_hel_buflen = 32768 * 2; + int ds_snd_queue_max = 10; ++int ds_hq_buffers_max = 4; + static HINSTANCE instance; + + /* +@@ -149,11 +150,15 @@ void setup_dsound_options(void) + ds_snd_queue_max = atoi(buffer); + + ++ if (!get_config_key( hkey, appkey, "HQBuffersMax", buffer, MAX_PATH )) ++ ds_hq_buffers_max = atoi(buffer); ++ + if (appkey) RegCloseKey( appkey ); + if (hkey) RegCloseKey( hkey ); + + TRACE("ds_hel_buflen = %d\n", ds_hel_buflen); + TRACE("ds_snd_queue_max = %d\n", ds_snd_queue_max); ++ TRACE("ds_hq_buffers_max = %d\n", ds_hq_buffers_max); + } + + static const char * get_device_id(LPCGUID pGuid) +diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h +index a8f5f42..2db769d 100644 +--- a/dlls/dsound/dsound_private.h ++++ b/dlls/dsound/dsound_private.h +@@ -32,6 +32,7 @@ + + extern int ds_hel_buflen DECLSPEC_HIDDEN; + extern int ds_snd_queue_max DECLSPEC_HIDDEN; ++extern int ds_hq_buffers_max DECLSPEC_HIDDEN; + + /***************************************************************************** + * Predeclare the interface implementation structures +diff --git a/dlls/dsound/mixer.c b/dlls/dsound/mixer.c +index 43b7dca..7f16c59 100644 +--- a/dlls/dsound/mixer.c ++++ b/dlls/dsound/mixer.c +@@ -247,7 +247,50 @@ static UINT cp_fields_noresample(IDirectSoundBufferImpl *dsb, UINT count) + return count; + } + +-static UINT cp_fields_resample(IDirectSoundBufferImpl *dsb, UINT count, float *freqAcc) ++static UINT cp_fields_resample_lq(IDirectSoundBufferImpl *dsb, UINT count, float *freqAcc) ++{ ++ UINT i, channel; ++ UINT istride = dsb->pwfx->nBlockAlign; ++ UINT ostride = dsb->device->pwfx->nChannels * sizeof(float); ++ UINT channels = dsb->mix_channels; ++ ++ float freqAdjust = dsb->freqAdjust; ++ float freqAcc_start = *freqAcc; ++ float freqAcc_end = freqAcc_start + count * freqAdjust; ++ UINT max_ipos = freqAcc_end; ++ ++ freqAcc_end -= (int)freqAcc_end; ++ ++ for(i = 0; i < count; ++i) { ++ float cur_freqAcc = freqAcc_start + i * freqAdjust; ++ float cur_freqAcc2; ++ UINT ipos = cur_freqAcc; ++ UINT idx = dsb->sec_mixpos + ipos * istride; ++ cur_freqAcc -= (int)cur_freqAcc; ++ cur_freqAcc2 = 1.0 - cur_freqAcc; ++ for (channel = 0; channel < channels; channel++) { ++ /** ++ * Generally we cannot cache the result of get_current_sample(). ++ * Consider the case of resampling from 192000 Hz to 44100 Hz - ++ * none of the values will get reused for the next value of i. ++ * OTOH, for resampling from 44100 Hz to 192000 Hz both values ++ * will likely be reused. ++ * ++ * So far, this possibility of saving calls to ++ * get_current_sample() is ignored. ++ */ ++ float s1 = get_current_sample(dsb, idx, channel); ++ float s2 = get_current_sample(dsb, idx + istride, channel); ++ float result = s1 * cur_freqAcc2 + s2 * cur_freqAcc; ++ dsb->put(dsb, i * ostride, channel, result); ++ } ++ } ++ ++ *freqAcc = freqAcc_end; ++ return max_ipos; ++} ++ ++static UINT cp_fields_resample_hq(IDirectSoundBufferImpl *dsb, UINT count, float *freqAcc) + { + UINT i, channel; + UINT istride = dsb->pwfx->nBlockAlign; +@@ -321,8 +364,10 @@ static void cp_fields(IDirectSoundBufferImpl *dsb, UINT count, float *freqAcc) + + if (dsb->freqAdjust == 1.0) + adv = cp_fields_noresample(dsb, count); /* *freqAcc is unmodified */ ++ else if (dsb->device->nrofbuffers > ds_hq_buffers_max) ++ adv = cp_fields_resample_lq(dsb, count, freqAcc); + else +- adv = cp_fields_resample(dsb, count, freqAcc); ++ adv = cp_fields_resample_hq(dsb, count, freqAcc); + + ipos = dsb->sec_mixpos + adv * dsb->pwfx->nBlockAlign; + if (ipos >= dsb->buflen) { +-- +1.7.9.5 + diff --git a/patches/dsound-Fast_Mixer/definition b/patches/dsound-Fast_Mixer/definition new file mode 100644 index 00000000..76250cfa --- /dev/null +++ b/patches/dsound-Fast_Mixer/definition @@ -0,0 +1,4 @@ +Author: Alexander E. Patrakov +Subject: Add a linear resampler for use with a large number of dsound mixing buffers. +Revision: 1 +Fixes: [30639] Audio stuttering and performance drops in multiple applications