Robert Reif : dsound:
Set default primary buffer sample rate and bits per sample.
Alexandre Julliard
julliard at wine.codeweavers.com
Sat Apr 8 13:12:21 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 44b7760e6aba07680efc8c1120e793473677a5ec
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=44b7760e6aba07680efc8c1120e793473677a5ec
Author: Robert Reif <reif at earthlink.net>
Date: Wed Apr 5 20:48:44 2006 -0400
dsound: Set default primary buffer sample rate and bits per sample.
Programs that are written specifically for 2000 and xp don't bother to
set the primary buffer format because it's a noop. However wine is
patterned after win9x and DirectX 7 or earlier which has a real
primary buffer and expects the program to change the primary buffer
format if necessary.
---
dlls/dsound/dsound.c | 4 ++--
dlls/dsound/dsound_main.c | 12 ++++++++++++
dlls/dsound/dsound_private.h | 2 ++
3 files changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c
index 99400c2..a765fd0 100644
--- a/dlls/dsound/dsound.c
+++ b/dlls/dsound/dsound.c
@@ -1141,8 +1141,8 @@ HRESULT DirectSoundDevice_Create(DirectS
* WAVE_DIRECTSOUND flag.
*/
device->pwfx->wFormatTag = WAVE_FORMAT_PCM;
- device->pwfx->nSamplesPerSec = 22050;
- device->pwfx->wBitsPerSample = 8;
+ device->pwfx->nSamplesPerSec = ds_default_sample_rate;
+ device->pwfx->wBitsPerSample = ds_default_bits_per_sample;
device->pwfx->nChannels = 2;
device->pwfx->nBlockAlign = device->pwfx->wBitsPerSample * device->pwfx->nChannels / 8;
device->pwfx->nAvgBytesPerSec = device->pwfx->nSamplesPerSec * device->pwfx->nBlockAlign;
diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c
index 9ea9ea2..a1e71c4 100644
--- a/dlls/dsound/dsound_main.c
+++ b/dlls/dsound/dsound_main.c
@@ -108,6 +108,8 @@ int ds_snd_queue_min = DS_SND_QUEUE_MIN;
int ds_hw_accel = DS_HW_ACCEL_FULL;
int ds_default_playback = 0;
int ds_default_capture = 0;
+int ds_default_sample_rate = 22050;
+int ds_default_bits_per_sample = 8;
/*
* Get a config key from either the app-specific or the default config
@@ -188,6 +190,12 @@ void setup_dsound_options(void)
if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
ds_default_capture = atoi(buffer);
+ if (!get_config_key( hkey, appkey, "DefaultSampleRate", buffer, MAX_PATH ))
+ ds_default_sample_rate = atoi(buffer);
+
+ if (!get_config_key( hkey, appkey, "DefaultBitsPerSample", buffer, MAX_PATH ))
+ ds_default_bits_per_sample = atoi(buffer);
+
if (appkey) RegCloseKey( appkey );
if (hkey) RegCloseKey( hkey );
@@ -212,6 +220,10 @@ void setup_dsound_options(void)
WARN("ds_default_playback = %d (default=0)\n",ds_default_playback);
if (ds_default_capture != 0)
WARN("ds_default_capture = %d (default=0)\n",ds_default_playback);
+ if (ds_default_sample_rate != 22050)
+ WARN("ds_default_sample_rate = %d (default=22050)\n",ds_default_sample_rate);
+ if (ds_default_bits_per_sample != 8)
+ WARN("ds_default_bits_per_sample = %d (default=8)\n",ds_default_bits_per_sample);
}
const char * get_device_id(LPCGUID pGuid)
diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h
index c4db0eb..36931ac 100644
--- a/dlls/dsound/dsound_private.h
+++ b/dlls/dsound/dsound_private.h
@@ -40,6 +40,8 @@ extern int ds_snd_queue_min;
extern int ds_hw_accel;
extern int ds_default_playback;
extern int ds_default_capture;
+extern int ds_default_sample_rate;
+extern int ds_default_bits_per_sample;
/*****************************************************************************
* Predeclare the interface implementation structures
More information about the wine-cvs
mailing list