diff options
author | Chris Robinson <[email protected]> | 2010-01-12 08:26:25 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2010-01-12 08:26:25 -0800 |
commit | 5b9e6fe440a0adadf19597f36e707c85f12815e1 (patch) | |
tree | 94a0684bf017662d7268a1a45d61c5a418565521 /Alc/wave.c | |
parent | 35ba7d70dcb6910ec913ec70b91be951b77b489e (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.c | 32 |
1 files changed, 18 insertions, 14 deletions
@@ -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"); |