# HG changeset patch # User Ryan C. Gordon # Date 1003169089 0 # Node ID 70baf29577d8b4e1245a8357966eb4d5cdc804e8 # Parent e3f4767d603712ccf2236cdc317843da48f06943 Added default sample format. diff -r e3f4767d6037 -r 70baf29577d8 decoders/midi.c --- a/decoders/midi.c Fri Oct 12 17:31:46 2001 +0000 +++ b/decoders/midi.c Mon Oct 15 18:04:49 2001 +0000 @@ -126,8 +126,18 @@ int fd2[2]; pid_t pid; - /* TiMidity does all the conversions we need. */ - memcpy(&sample->actual, &sample->desired, sizeof (Sound_AudioInfo)); + /* + * Use the desired format if available, or pick sensible defaults. + * TiMidity does all the conversions we need. + */ + if (sample->desired.rate == 0) + { + sample->actual.channels = 2; + sample->actual.rate = 44100; + sample->actual.format = AUDIO_S16SYS; + } /* if */ + else + memcpy(&sample->actual, &sample->desired, sizeof (Sound_AudioInfo)); sample->flags = SOUND_SAMPLEFLAG_NONE; if (pipe(fd1) < 0 || pipe(fd2) < 0)