Commit 25deae6c authored by Max Kellermann's avatar Max Kellermann

decoder/wildmidi: move code to wildmidi_output()

parent 62000670
......@@ -65,6 +65,17 @@ wildmidi_finish(void)
WildMidi_Shutdown();
}
static DecoderCommand
wildmidi_output(Decoder &decoder, midi *wm)
{
char buffer[4096];
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 +105,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 =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment