Mercurial > SDL_sound_CoreAudio
diff decoders/midi.c @ 138:70baf29577d8
Added default sample format.
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Mon, 15 Oct 2001 18:04:49 +0000 |
parents | 803ba4dabbce |
children | 1df5c106504e |
line wrap: on
line diff
--- 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)