Module: wine
Branch: master
Commit: e28da99e4c8a3350d957e1e3a97fda1536e7f8fa
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e28da99e4c8a3350d957e1e3a…
Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com>
Date: Thu Jun 21 20:29:59 2007 +0200
dsound: Tune some parameters for alsa waveout.
---
dlls/dsound/dsound_main.c | 4 ++--
dlls/dsound/dsound_private.h | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c
index 1f6dd26..483d51b 100644
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -61,9 +61,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound);
/* some stuff may get more responsive with lower values though... */
#define DS_EMULDRIVER 0 /* some games (Quake 2, UT) refuse to accept
emulated dsound devices. set to 0 ! */
-#define DS_HEL_MARGIN 5 /* HEL only: number of waveOut fragments ahead to mix in new buffers
+#define DS_HEL_MARGIN 2 /* HEL only: number of waveOut fragments ahead to mix in new buffers
* (keep this close or equal to DS_HEL_QUEUE for best results) */
-#define DS_HEL_QUEUE 5 /* HEL only: number of waveOut fragments ahead to queue to driver
+#define DS_HEL_QUEUE 2 /* HEL only: number of waveOut fragments ahead to queue to driver
* (this will affect HEL sound reliability and latency) */
#define DS_SND_QUEUE_MAX 10 /* max number of fragments to prebuffer */
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index ee2c9ec..42437a2 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -24,7 +24,7 @@
#define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
#define DS_HEL_BUFLEN 0x8000 /* HEL: The buffer length of the emulated buffer */
-#define DS_HEL_FRAGS 0x40 /* HEL only: number of waveOut fragments in primary buffer
+#define DS_HEL_FRAGS 0x10 /* HEL only: number of waveOut fragments in primary buffer
* (changing this won't help you) */
/* direct sound hardware acceleration levels */
Module: wine
Branch: master
Commit: 95912460021f5891b2a1ebf2c41e364f42fdbcd2
URL: http://source.winehq.org/git/wine.git/?a=commit;h=95912460021f5891b2a1ebf2c…
Author: Maarten Lankhorst <m.b.lankhorst(a)gmail.com>
Date: Fri Jun 8 13:57:51 2007 +0200
dsound: Give rougher estimates for fraglen to satisfy alsa.
---
dlls/dsound/primary.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c
index f229757..3e3fce4 100644
--- a/dlls/dsound/primary.c
+++ b/dlls/dsound/primary.c
@@ -44,8 +44,20 @@ static void DSOUND_RecalcPrimary(DirectSoundDevice *device)
nBlockAlign = device->pwfx->nBlockAlign;
if (device->hwbuf) {
DWORD fraglen;
- /* let fragment size approximate the timer delay */
- fraglen = (device->pwfx->nSamplesPerSec * DS_TIME_DEL / 1000) * nBlockAlign;
+ /* Alsa doesn't have continuous buffers, instead it has buffers with power of 2,
+ * If DS_TIME_DEL is about 10 ms, 512 * nBlockAlign is roughly correct */
+ fraglen = 512 * nBlockAlign;
+
+ /* Compensate for only being rougly accurate */
+ if (device->pwfx->nSamplesPerSec <= 26000)
+ fraglen /= 2;
+
+ if (device->pwfx->nSamplesPerSec <= 12000)
+ fraglen /= 2;
+
+ if (device->pwfx->nSamplesPerSec >= 80000)
+ fraglen *= 2;
+
/* reduce fragment size until an integer number of them fits in the buffer */
/* (FIXME: this may or may not be a good idea) */
while (device->buflen % fraglen) fraglen -= nBlockAlign;