decoder/wildmidi: add fallbacks for libwildmidi<0.4

Fix build breakage from commit ea639269d8
This commit is contained in:
Max Kellermann 2019-06-26 23:13:12 +02:00
parent 39b40ac1fd
commit f07f8f7d88
1 changed files with 10 additions and 1 deletions

View File

@ -47,12 +47,21 @@ wildmidi_init(const ConfigBlock &block)
utf8.c_str()));
}
#ifdef LIBWILDMIDI_VERSION
/* WildMidi_ClearError() requires libwildmidi 0.4 */
WildMidi_ClearError();
AtScopeExit() { WildMidi_ClearError(); };
#endif
if (WildMidi_Init(path.c_str(), wildmidi_audio_format.sample_rate,
0) != 0)
0) != 0) {
#ifdef LIBWILDMIDI_VERSION
/* WildMidi_GetError() requires libwildmidi 0.4 */
throw PluginUnavailable(WildMidi_GetError());
#else
throw PluginUnavailable("WildMidi_Init() failed");
#endif
}
return true;
}