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.
oldstable
Robert Reif 2006-04-05 20:48:44 -04:00 committed by Alexandre Julliard
parent 2eb46bb464
commit 44b7760e6a
3 changed files with 16 additions and 2 deletions

View File

@ -1141,8 +1141,8 @@ HRESULT DirectSoundDevice_Create(DirectSoundDevice ** ppDevice)
* 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;

View File

@ -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)

View File

@ -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