aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/wave.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2010-01-12 08:26:25 -0800
committerChris Robinson <[email protected]>2010-01-12 08:26:25 -0800
commit5b9e6fe440a0adadf19597f36e707c85f12815e1 (patch)
tree94a0684bf017662d7268a1a45d61c5a418565521 /Alc/wave.c
parent35ba7d70dcb6910ec913ec70b91be951b77b489e (diff)
Only allow 8- and 16-bit, and mono and stereo, wave file output
Diffstat (limited to 'Alc/wave.c')
-rw-r--r--Alc/wave.c32
1 files changed, 18 insertions, 14 deletions
diff --git a/Alc/wave.c b/Alc/wave.c
index 09c8a63b..57322486 100644
--- a/Alc/wave.c
+++ b/Alc/wave.c
@@ -150,21 +150,25 @@ static ALCboolean wave_reset_playback(ALCdevice *device)
bits = aluBytesFromFormat(device->Format) * 8;
channels = aluChannelsFromFormat(device->Format);
- switch(bits)
- {
- case 8:
- case 16:
- case 32:
- if(channels == 0)
- {
- AL_PRINT("Unknown format?! %x\n", device->Format);
- return ALC_FALSE;
- }
- break;
- default:
- AL_PRINT("Unknown format?! %x\n", device->Format);
- return ALC_FALSE;
+ if(channels != 1 && channels != 2)
+ {
+ if(bits == 8)
+ device->Format = AL_FORMAT_STEREO8;
+ else
+ {
+ device->Format = AL_FORMAT_STEREO16;
+ bits = 16;
+ }
+ channels = 2;
+ }
+ else if(bits != 8 && bits != 16)
+ {
+ if(channels == 1)
+ device->Format = AL_FORMAT_MONO16;
+ else
+ device->Format = AL_FORMAT_STEREO16;
+ bits = 16;
}
fprintf(data->f, "RIFF");