---
 src/output/plugins/PulseOutputPlugin.cxx | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/src/output/plugins/PulseOutputPlugin.cxx 
b/src/output/plugins/PulseOutputPlugin.cxx
index 120bad0..baa9e1f 100644
--- a/src/output/plugins/PulseOutputPlugin.cxx
+++ b/src/output/plugins/PulseOutputPlugin.cxx
@@ -575,9 +575,30 @@ pulse_output_open(AudioOutput *ao, AudioFormat 
&audio_format,
                return false;
        }
 
-       /* MPD doesn't support the other pulseaudio sample formats, so
-          we just force MPD to send us everything as 16 bit */
-       audio_format.format = SampleFormat::S16;
+       /* Use the sample formats that our version of PulseAudio and MPD
+          have in common, otherwise force MPD to send us 16 bit */
+       switch (audio_format.format) {
+       case SampleFormat::FLOAT:
+               ss.format = PA_SAMPLE_FLOAT32NE;
+               break;
+#ifdef PA_SAMPLE_S32NE
+       case SampleFormat::S32:
+               ss.format = PA_SAMPLE_S32NE;
+               break;
+#endif
+#ifdef PA_SAMPLE_S24_32NE
+       case SampleFormat::S24_P32:
+               ss.format = PA_SAMPLE_S24_32NE;
+               break;
+#endif
+       case SampleFormat::S16:
+               ss.format = PA_SAMPLE_S16NE;
+               break;
+       default:
+               audio_format.format = SampleFormat::S16;
+               ss.format = PA_SAMPLE_S16NE;
+               break;
+       }
 
        ss.format = PA_SAMPLE_S16NE;
        ss.rate = audio_format.sample_rate;
-- 
1.8.4.5

_______________________________________________
mpd-devel mailing list
[email protected]
http://mailman.blarg.de/listinfo/mpd-devel

Reply via email to