summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-12-13 21:32:19 +0100
committerMax Kellermann <max@duempel.org>2011-12-13 21:32:19 +0100
commit96ad5b84446be0bf603895adaf0ec2e97bee11aa (patch)
treefad19e463afb4e6b0391efdfbdfeddcc04404499
parent097e5dfbdc2ec958045d5f4b5ec5e7cfa396360e (diff)
output/openal: force 16 bit playback, as 8 bit doesn't work
The OpenAL specification says that AL_FORMAT_MONO8 and AL_FORMAT_STEREO8 expect unsigned 8 bit samples, but MPD uses unsigned samples.
-rw-r--r--NEWS1
-rw-r--r--src/output/openal_plugin.c14
2 files changed, 5 insertions, 10 deletions
diff --git a/NEWS b/NEWS
index d66ca1d4f..bc229304a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
ver 0.16.7 (2011/??/??)
* output:
- httpd: fix excessive buffering
+ - openal: force 16 bit playback, as 8 bit doesn't work
ver 0.16.6 (2011/12/01)
diff --git a/src/output/openal_plugin.c b/src/output/openal_plugin.c
index 0a8f253b2..e5db8ac34 100644
--- a/src/output/openal_plugin.c
+++ b/src/output/openal_plugin.c
@@ -58,6 +58,10 @@ openal_output_quark(void)
static ALenum
openal_audio_format(struct audio_format *audio_format)
{
+ /* note: cannot map SAMPLE_FORMAT_S8 to AL_FORMAT_STEREO8 or
+ AL_FORMAT_MONO8 since OpenAL expects unsigned 8 bit
+ samples, while MPD uses signed samples */
+
switch (audio_format->format) {
case SAMPLE_FORMAT_S16:
if (audio_format->channels == 2)
@@ -69,16 +73,6 @@ openal_audio_format(struct audio_format *audio_format)
audio_format->channels = 1;
return openal_audio_format(audio_format);
- case SAMPLE_FORMAT_S8:
- if (audio_format->channels == 2)
- return AL_FORMAT_STEREO8;
- if (audio_format->channels == 1)
- return AL_FORMAT_MONO8;
-
- /* fall back to mono */
- audio_format->channels = 1;
- return openal_audio_format(audio_format);
-
default:
/* fall back to 16 bit */
audio_format->format = SAMPLE_FORMAT_S16;