This is based on a patch from Ian Scott in 2014. It was never committed, so I figured I'd fix the outstanding issue and resubmit it.
https://www.mail-archive.com/mpd-devel%40musicpd.org/msg00139.html --- src/output/plugins/PulseOutputPlugin.cxx | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx index b519947..dd4610f 100644 --- a/src/output/plugins/PulseOutputPlugin.cxx +++ b/src/output/plugins/PulseOutputPlugin.cxx @@ -679,12 +679,30 @@ PulseOutput::Open(AudioFormat &audio_format, Error &error) 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 16 bit */ pa_sample_spec ss; - ss.format = PA_SAMPLE_S16NE; + + switch (audio_format.format) { + case SampleFormat::FLOAT: + ss.format = PA_SAMPLE_FLOAT32NE; + break; + case SampleFormat::S32: + ss.format = PA_SAMPLE_S32NE; + break; + case SampleFormat::S24_P32: + ss.format = PA_SAMPLE_S24_32NE; + break; + case SampleFormat::S16: + ss.format = PA_SAMPLE_S16NE; + break; + default: + audio_format.format = SampleFormat::S16; + ss.format = PA_SAMPLE_S16NE; + break; + } + ss.rate = audio_format.sample_rate; ss.channels = audio_format.channels; -- 2.9.2 _______________________________________________ mpd-devel mailing list mpd-devel@musicpd.org http://mailman.blarg.de/listinfo/mpd-devel