aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/alsa.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2009-10-24 03:20:47 -0700
committerChris Robinson <[email protected]>2009-10-24 03:20:47 -0700
commit1f47fa92432a51625e87e45229534b47ff40897c (patch)
tree0948f637442b62062594073b27e821cbb034b222 /Alc/alsa.c
parent7b24a12a6639d3d325ec819c6a9fb783b0f1f24e (diff)
Try 32-bit float before 16-bit, and stereo before mono
Diffstat (limited to 'Alc/alsa.c')
-rw-r--r--Alc/alsa.c61
1 files changed, 41 insertions, 20 deletions
diff --git a/Alc/alsa.c b/Alc/alsa.c
index a4c23df9..c239c61a 100644
--- a/Alc/alsa.c
+++ b/Alc/alsa.c
@@ -557,26 +557,38 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
{
switch(aluChannelsFromFormat(device->Format))
{
- case 1: device->Format = AL_FORMAT_MONO16; break;
- case 2: device->Format = AL_FORMAT_STEREO16; break;
- case 4: device->Format = AL_FORMAT_QUAD16; break;
- case 6: device->Format = AL_FORMAT_51CHN16; break;
- case 7: device->Format = AL_FORMAT_61CHN16; break;
- case 8: device->Format = AL_FORMAT_71CHN16; break;
+ case 1: device->Format = AL_FORMAT_MONO_FLOAT32; break;
+ case 2: device->Format = AL_FORMAT_STEREO_FLOAT32; break;
+ case 4: device->Format = AL_FORMAT_QUAD32; break;
+ case 6: device->Format = AL_FORMAT_51CHN32; break;
+ case 7: device->Format = AL_FORMAT_61CHN32; break;
+ case 8: device->Format = AL_FORMAT_71CHN32; break;
}
- if((i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_S16)) < 0)
+ if((i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_FLOAT)) < 0)
{
switch(aluChannelsFromFormat(device->Format))
{
- case 1: device->Format = AL_FORMAT_MONO8; break;
- case 2: device->Format = AL_FORMAT_STEREO8; break;
- case 4: device->Format = AL_FORMAT_QUAD8; break;
- case 6: device->Format = AL_FORMAT_51CHN8; break;
- case 7: device->Format = AL_FORMAT_61CHN8; break;
- case 8: device->Format = AL_FORMAT_71CHN8; break;
+ case 1: device->Format = AL_FORMAT_MONO16; break;
+ case 2: device->Format = AL_FORMAT_STEREO16; break;
+ case 4: device->Format = AL_FORMAT_QUAD16; break;
+ case 6: device->Format = AL_FORMAT_51CHN16; break;
+ case 7: device->Format = AL_FORMAT_61CHN16; break;
+ case 8: device->Format = AL_FORMAT_71CHN16; break;
+ }
+ if((i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_S16)) < 0)
+ {
+ switch(aluChannelsFromFormat(device->Format))
+ {
+ case 1: device->Format = AL_FORMAT_MONO8; break;
+ case 2: device->Format = AL_FORMAT_STEREO8; break;
+ case 4: device->Format = AL_FORMAT_QUAD8; break;
+ case 6: device->Format = AL_FORMAT_51CHN8; break;
+ case 7: device->Format = AL_FORMAT_61CHN8; break;
+ case 8: device->Format = AL_FORMAT_71CHN8; break;
+ }
+ if((i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_U8)) < 0)
+ err = "set format";
}
- if((i=psnd_pcm_hw_params_set_format(data->pcmHandle, p, SND_PCM_FORMAT_U8)) < 0)
- err = "set format";
}
}
/* set channels (implicitly sets frame bits) */
@@ -584,12 +596,21 @@ static ALCboolean alsa_reset_playback(ALCdevice *device)
{
switch(aluBytesFromFormat(device->Format))
{
- case 1: device->Format = AL_FORMAT_MONO8; break;
- case 2: device->Format = AL_FORMAT_MONO16; break;
- case 4: device->Format = AL_FORMAT_MONO_FLOAT32; break;
+ case 1: device->Format = AL_FORMAT_STEREO8; break;
+ case 2: device->Format = AL_FORMAT_STEREO16; break;
+ case 4: device->Format = AL_FORMAT_STEREO_FLOAT32; break;
+ }
+ if((i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, 2)) < 0)
+ {
+ switch(aluBytesFromFormat(device->Format))
+ {
+ case 1: device->Format = AL_FORMAT_MONO8; break;
+ case 2: device->Format = AL_FORMAT_MONO16; break;
+ case 4: device->Format = AL_FORMAT_MONO_FLOAT32; break;
+ }
+ if((i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, 1)) < 0)
+ err = "set channels";
}
- if((i=psnd_pcm_hw_params_set_channels(data->pcmHandle, p, 1)) < 0)
- err = "set channels";
}
/* set periods (implicitly constrains period/buffer parameters) */
if(err == NULL && (i=psnd_pcm_hw_params_set_periods_near(data->pcmHandle, p, &periods, NULL)) < 0)