diff --git a/NEWS b/NEWS index 124a21af9..cfc6c72c0 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,12 @@ ver 0.20 (not yet released) * update - apply .mpdignore matches to subdirectories +ver 0.19.19 (not yet released) +* decoder + - wildmidi: support libWildMidi 0.4 +* output + - pulse: support 32 bit, 24 bit and floating point playback + ver 0.19.18 (2016/08/05) * decoder - ffmpeg: fix crash with older FFmpeg versions (< 3.0) diff --git a/src/decoder/plugins/WildmidiDecoderPlugin.cxx b/src/decoder/plugins/WildmidiDecoderPlugin.cxx index eef23e40a..bc135485a 100644 --- a/src/decoder/plugins/WildmidiDecoderPlugin.cxx +++ b/src/decoder/plugins/WildmidiDecoderPlugin.cxx @@ -65,6 +65,24 @@ wildmidi_finish(void) WildMidi_Shutdown(); } +static DecoderCommand +wildmidi_output(Decoder &decoder, midi *wm) +{ +#ifdef LIBWILDMIDI_VER_MAJOR + /* WildMidi 0.4 has switched from "char*" to "int8_t*" */ + int8_t buffer[4096]; +#else + /* pre 0.4 */ + char buffer[4096]; +#endif + + int length = WildMidi_GetOutput(wm, buffer, sizeof(buffer)); + if (length <= 0) + return DecoderCommand::STOP; + + return decoder_data(decoder, nullptr, buffer, length, 0); +} + static void wildmidi_file_decode(Decoder &decoder, Path path_fs) { @@ -94,18 +112,11 @@ wildmidi_file_decode(Decoder &decoder, Path path_fs) DecoderCommand cmd; do { - char buffer[4096]; - int len; - info = WildMidi_GetInfo(wm); if (info == nullptr) break; - len = WildMidi_GetOutput(wm, buffer, sizeof(buffer)); - if (len <= 0) - break; - - cmd = decoder_data(decoder, nullptr, buffer, len, 0); + cmd = wildmidi_output(decoder, wm); if (cmd == DecoderCommand::SEEK) { unsigned long seek_where = diff --git a/src/output/plugins/PulseOutputPlugin.cxx b/src/output/plugins/PulseOutputPlugin.cxx index b51994788..e8000bdf2 100644 --- a/src/output/plugins/PulseOutputPlugin.cxx +++ b/src/output/plugins/PulseOutputPlugin.cxx @@ -679,11 +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; + + 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.format = PA_SAMPLE_S16NE; ss.rate = audio_format.sample_rate; ss.channels = audio_format.channels;