decoder/wildmidi: move code to wildmidi_output()
This commit is contained in:
parent
62000670e3
commit
25deae6cc7
@ -65,6 +65,17 @@ wildmidi_finish(void)
|
|||||||
WildMidi_Shutdown();
|
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
|
static void
|
||||||
wildmidi_file_decode(Decoder &decoder, Path path_fs)
|
wildmidi_file_decode(Decoder &decoder, Path path_fs)
|
||||||
{
|
{
|
||||||
@ -94,18 +105,11 @@ wildmidi_file_decode(Decoder &decoder, Path path_fs)
|
|||||||
|
|
||||||
DecoderCommand cmd;
|
DecoderCommand cmd;
|
||||||
do {
|
do {
|
||||||
char buffer[4096];
|
|
||||||
int len;
|
|
||||||
|
|
||||||
info = WildMidi_GetInfo(wm);
|
info = WildMidi_GetInfo(wm);
|
||||||
if (info == nullptr)
|
if (info == nullptr)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
len = WildMidi_GetOutput(wm, buffer, sizeof(buffer));
|
cmd = wildmidi_output(decoder, wm);
|
||||||
if (len <= 0)
|
|
||||||
break;
|
|
||||||
|
|
||||||
cmd = decoder_data(decoder, nullptr, buffer, len, 0);
|
|
||||||
|
|
||||||
if (cmd == DecoderCommand::SEEK) {
|
if (cmd == DecoderCommand::SEEK) {
|
||||||
unsigned long seek_where =
|
unsigned long seek_where =
|
||||||
|
Loading…
Reference in New Issue
Block a user