diff options
author | Chris Robinson <[email protected]> | 2012-01-17 15:26:22 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-01-17 15:26:22 -0800 |
commit | e0966d99a199ec1b4673609e2f91c5ebc7b776af (patch) | |
tree | e1edeec279f936e43b5b413a230c578efb249c2a /Alc/backends/portaudio.c | |
parent | 66a700729bf3590a11807e4df5ef82c5e2c3d336 (diff) |
Retry opening the PortAudio device with 16-bit short if 32-bit float output fails
Diffstat (limited to 'Alc/backends/portaudio.c')
-rw-r--r-- | Alc/backends/portaudio.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Alc/backends/portaudio.c b/Alc/backends/portaudio.c index 4275ad80..a24e2aaf 100644 --- a/Alc/backends/portaudio.c +++ b/Alc/backends/portaudio.c @@ -175,6 +175,9 @@ static ALCenum pa_open_playback(ALCdevice *device, const ALCchar *deviceName) (float)device->Frequency; outParams.hostApiSpecificStreamInfo = NULL; + outParams.channelCount = ((device->FmtChans == DevFmtMono) ? 1 : 2); + +retry_open: switch(device->FmtType) { case DevFmtByte: @@ -193,14 +196,16 @@ static ALCenum pa_open_playback(ALCdevice *device, const ALCchar *deviceName) outParams.sampleFormat = paFloat32; break; } - outParams.channelCount = ((device->FmtChans == DevFmtMono) ? 1 : 2); - - SetDefaultChannelOrder(device); err = Pa_OpenStream(&data->stream, NULL, &outParams, device->Frequency, device->UpdateSize, paNoFlag, pa_callback, device); if(err != paNoError) { + if(device->FmtType == DevFmtFloat) + { + device->FmtType = DevFmtShort; + goto retry_open; + } ERR("Pa_OpenStream() returned an error: %s\n", Pa_GetErrorText(err)); device->ExtraData = NULL; free(data); @@ -224,6 +229,7 @@ static ALCenum pa_open_playback(ALCdevice *device, const ALCchar *deviceName) device->Flags &= ~DEVICE_CHANNELS_REQUEST; device->FmtChans = ((outParams.channelCount==1) ? DevFmtMono : DevFmtStereo); } + SetDefaultChannelOrder(device); return ALC_NO_ERROR; } |