comparison 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
comparison
equal deleted inserted replaced
137:e3f4767d6037 138:70baf29577d8
124 ssize_t retval; 124 ssize_t retval;
125 int fd1[2]; 125 int fd1[2];
126 int fd2[2]; 126 int fd2[2];
127 pid_t pid; 127 pid_t pid;
128 128
129 /* TiMidity does all the conversions we need. */ 129 /*
130 memcpy(&sample->actual, &sample->desired, sizeof (Sound_AudioInfo)); 130 * Use the desired format if available, or pick sensible defaults.
131 * TiMidity does all the conversions we need.
132 */
133 if (sample->desired.rate == 0)
134 {
135 sample->actual.channels = 2;
136 sample->actual.rate = 44100;
137 sample->actual.format = AUDIO_S16SYS;
138 } /* if */
139 else
140 memcpy(&sample->actual, &sample->desired, sizeof (Sound_AudioInfo));
131 sample->flags = SOUND_SAMPLEFLAG_NONE; 141 sample->flags = SOUND_SAMPLEFLAG_NONE;
132 142
133 if (pipe(fd1) < 0 || pipe(fd2) < 0) 143 if (pipe(fd1) < 0 || pipe(fd2) < 0)
134 { 144 {
135 Sound_SetError("MIDI: Pipe error."); 145 Sound_SetError("MIDI: Pipe error.");