Commit 44b7760e authored by Robert Reif's avatar Robert Reif Committed by Alexandre Julliard

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.
parent 2eb46bb4
...@@ -1141,8 +1141,8 @@ HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice) ...@@ -1141,8 +1141,8 @@ HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice)
* WAVE_DIRECTSOUND flag. * WAVE_DIRECTSOUND flag.
*/ */
device->pwfx->wFormatTag = WAVE_FORMAT_PCM; device->pwfx->wFormatTag = WAVE_FORMAT_PCM;
device->pwfx->nSamplesPerSec = 22050; device->pwfx->nSamplesPerSec = ds_default_sample_rate;
device->pwfx->wBitsPerSample = 8; device->pwfx->wBitsPerSample = ds_default_bits_per_sample;
device->pwfx->nChannels = 2; device->pwfx->nChannels = 2;
device->pwfx->nBlockAlign = device->pwfx->wBitsPerSample * device->pwfx->nChannels / 8; device->pwfx->nBlockAlign = device->pwfx->wBitsPerSample * device->pwfx->nChannels / 8;
device->pwfx->nAvgBytesPerSec = device->pwfx->nSamplesPerSec * device->pwfx->nBlockAlign; device->pwfx->nAvgBytesPerSec = device->pwfx->nSamplesPerSec * device->pwfx->nBlockAlign;
......
...@@ -108,6 +108,8 @@ int ds_snd_queue_min = DS_SND_QUEUE_MIN; ...@@ -108,6 +108,8 @@ int ds_snd_queue_min = DS_SND_QUEUE_MIN;
int ds_hw_accel = DS_HW_ACCEL_FULL; int ds_hw_accel = DS_HW_ACCEL_FULL;
int ds_default_playback = 0; int ds_default_playback = 0;
int ds_default_capture = 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 * Get a config key from either the app-specific or the default config
...@@ -188,6 +190,12 @@ void setup_dsound_options(void) ...@@ -188,6 +190,12 @@ void setup_dsound_options(void)
if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH )) if (!get_config_key( hkey, appkey, "DefaultCapture", buffer, MAX_PATH ))
ds_default_capture = atoi(buffer); 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 (appkey) RegCloseKey( appkey );
if (hkey) RegCloseKey( hkey ); if (hkey) RegCloseKey( hkey );
...@@ -212,6 +220,10 @@ void setup_dsound_options(void) ...@@ -212,6 +220,10 @@ void setup_dsound_options(void)
WARN("ds_default_playback = %d (default=0)\n",ds_default_playback); WARN("ds_default_playback = %d (default=0)\n",ds_default_playback);
if (ds_default_capture != 0) if (ds_default_capture != 0)
WARN("ds_default_capture = %d (default=0)\n",ds_default_playback); 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) const char * get_device_id(LPCGUID pGuid)
......
...@@ -40,6 +40,8 @@ extern int ds_snd_queue_min; ...@@ -40,6 +40,8 @@ extern int ds_snd_queue_min;
extern int ds_hw_accel; extern int ds_hw_accel;
extern int ds_default_playback; extern int ds_default_playback;
extern int ds_default_capture; extern int ds_default_capture;
extern int ds_default_sample_rate;
extern int ds_default_bits_per_sample;
/***************************************************************************** /*****************************************************************************
* Predeclare the interface implementation structures * Predeclare the interface implementation structures
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment