comparison src/audio/dma/SDL_dmaaudio.c @ 1668:4da1ee79c9af SDL-1.3

more tweaking indent options
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 04:04:35 +0000
parents 782fd950bd46
children
comparison
equal deleted inserted replaced
1667:1fddae038bc8 1668:4da1ee79c9af
58 58
59 /* Open the audio device for playback, and don't block if busy */ 59 /* Open the audio device for playback, and don't block if busy */
60 #define OPEN_FLAGS (O_RDWR|O_NONBLOCK) 60 #define OPEN_FLAGS (O_RDWR|O_NONBLOCK)
61 61
62 /* Audio driver functions */ 62 /* Audio driver functions */
63 static int DMA_OpenAudio (_THIS, SDL_AudioSpec * spec); 63 static int DMA_OpenAudio(_THIS, SDL_AudioSpec * spec);
64 static void DMA_WaitAudio (_THIS); 64 static void DMA_WaitAudio(_THIS);
65 static void DMA_PlayAudio (_THIS); 65 static void DMA_PlayAudio(_THIS);
66 static Uint8 *DMA_GetAudioBuf (_THIS); 66 static Uint8 *DMA_GetAudioBuf(_THIS);
67 static void DMA_CloseAudio (_THIS); 67 static void DMA_CloseAudio(_THIS);
68 68
69 /* Audio driver bootstrap functions */ 69 /* Audio driver bootstrap functions */
70 70
71 static int 71 static int
72 Audio_Available (void) 72 Audio_Available(void)
73 { 73 {
74 int available; 74 int available;
75 int fd; 75 int fd;
76 76
77 available = 0; 77 available = 0;
78 78
79 fd = SDL_OpenAudioPath (NULL, 0, OPEN_FLAGS, 0); 79 fd = SDL_OpenAudioPath(NULL, 0, OPEN_FLAGS, 0);
80 if (fd >= 0) { 80 if (fd >= 0) {
81 int caps; 81 int caps;
82 struct audio_buf_info info; 82 struct audio_buf_info info;
83 83
84 if ((ioctl (fd, SNDCTL_DSP_GETCAPS, &caps) == 0) && 84 if ((ioctl(fd, SNDCTL_DSP_GETCAPS, &caps) == 0) &&
85 (caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) && 85 (caps & DSP_CAP_TRIGGER) && (caps & DSP_CAP_MMAP) &&
86 (ioctl (fd, SNDCTL_DSP_GETOSPACE, &info) == 0)) { 86 (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) == 0)) {
87 available = 1; 87 available = 1;
88 } 88 }
89 close (fd); 89 close(fd);
90 } 90 }
91 return (available); 91 return (available);
92 } 92 }
93 93
94 static void 94 static void
95 Audio_DeleteDevice (SDL_AudioDevice * device) 95 Audio_DeleteDevice(SDL_AudioDevice * device)
96 { 96 {
97 SDL_free (device->hidden); 97 SDL_free(device->hidden);
98 SDL_free (device); 98 SDL_free(device);
99 } 99 }
100 100
101 static SDL_AudioDevice * 101 static SDL_AudioDevice *
102 Audio_CreateDevice (int devindex) 102 Audio_CreateDevice(int devindex)
103 { 103 {
104 SDL_AudioDevice *this; 104 SDL_AudioDevice *this;
105 105
106 /* Initialize all variables that we clean on shutdown */ 106 /* Initialize all variables that we clean on shutdown */
107 this = (SDL_AudioDevice *) SDL_malloc (sizeof (SDL_AudioDevice)); 107 this = (SDL_AudioDevice *) SDL_malloc(sizeof(SDL_AudioDevice));
108 if (this) { 108 if (this) {
109 SDL_memset (this, 0, (sizeof *this)); 109 SDL_memset(this, 0, (sizeof *this));
110 this->hidden = (struct SDL_PrivateAudioData *) 110 this->hidden = (struct SDL_PrivateAudioData *)
111 SDL_malloc ((sizeof *this->hidden)); 111 SDL_malloc((sizeof *this->hidden));
112 } 112 }
113 if ((this == NULL) || (this->hidden == NULL)) { 113 if ((this == NULL) || (this->hidden == NULL)) {
114 SDL_OutOfMemory (); 114 SDL_OutOfMemory();
115 if (this) { 115 if (this) {
116 SDL_free (this); 116 SDL_free(this);
117 } 117 }
118 return (0); 118 return (0);
119 } 119 }
120 SDL_memset (this->hidden, 0, (sizeof *this->hidden)); 120 SDL_memset(this->hidden, 0, (sizeof *this->hidden));
121 audio_fd = -1; 121 audio_fd = -1;
122 122
123 /* Set the function pointers */ 123 /* Set the function pointers */
124 this->OpenAudio = DMA_OpenAudio; 124 this->OpenAudio = DMA_OpenAudio;
125 this->WaitAudio = DMA_WaitAudio; 125 this->WaitAudio = DMA_WaitAudio;
137 Audio_Available, Audio_CreateDevice 137 Audio_Available, Audio_CreateDevice
138 }; 138 };
139 139
140 /* This function waits until it is possible to write a full sound buffer */ 140 /* This function waits until it is possible to write a full sound buffer */
141 static void 141 static void
142 DMA_WaitAudio (_THIS) 142 DMA_WaitAudio(_THIS)
143 { 143 {
144 fd_set fdset; 144 fd_set fdset;
145 145
146 /* Check to see if the thread-parent process is still alive */ 146 /* Check to see if the thread-parent process is still alive */
147 { 147 {
148 static int cnt = 0; 148 static int cnt = 0;
149 /* Note that this only works with thread implementations 149 /* Note that this only works with thread implementations
150 that use a different process id for each thread. 150 that use a different process id for each thread.
151 */ 151 */
152 if (parent && (((++cnt) % 10) == 0)) { /* Check every 10 loops */ 152 if (parent && (((++cnt) % 10) == 0)) { /* Check every 10 loops */
153 if (kill (parent, 0) < 0) { 153 if (kill(parent, 0) < 0) {
154 this->enabled = 0; 154 this->enabled = 0;
155 } 155 }
156 } 156 }
157 } 157 }
158 158
159 /* See if we need to use timed audio synchronization */ 159 /* See if we need to use timed audio synchronization */
160 if (frame_ticks) { 160 if (frame_ticks) {
161 /* Use timer for general audio synchronization */ 161 /* Use timer for general audio synchronization */
162 Sint32 ticks; 162 Sint32 ticks;
163 163
164 ticks = ((Sint32) (next_frame - SDL_GetTicks ())) - FUDGE_TICKS; 164 ticks = ((Sint32) (next_frame - SDL_GetTicks())) - FUDGE_TICKS;
165 if (ticks > 0) { 165 if (ticks > 0) {
166 SDL_Delay (ticks); 166 SDL_Delay(ticks);
167 } 167 }
168 } else { 168 } else {
169 /* Use select() for audio synchronization */ 169 /* Use select() for audio synchronization */
170 struct timeval timeout; 170 struct timeval timeout;
171 FD_ZERO (&fdset); 171 FD_ZERO(&fdset);
172 FD_SET (audio_fd, &fdset); 172 FD_SET(audio_fd, &fdset);
173 timeout.tv_sec = 10; 173 timeout.tv_sec = 10;
174 timeout.tv_usec = 0; 174 timeout.tv_usec = 0;
175 #ifdef DEBUG_AUDIO 175 #ifdef DEBUG_AUDIO
176 fprintf (stderr, "Waiting for audio to get ready\n"); 176 fprintf(stderr, "Waiting for audio to get ready\n");
177 #endif 177 #endif
178 if (select (audio_fd + 1, NULL, &fdset, NULL, &timeout) <= 0) { 178 if (select(audio_fd + 1, NULL, &fdset, NULL, &timeout) <= 0) {
179 const char *message = 179 const char *message =
180 #ifdef AUDIO_OSPACE_HACK 180 #ifdef AUDIO_OSPACE_HACK
181 "Audio timeout - buggy audio driver? (trying ospace)"; 181 "Audio timeout - buggy audio driver? (trying ospace)";
182 #else 182 #else
183 "Audio timeout - buggy audio driver? (disabled)"; 183 "Audio timeout - buggy audio driver? (disabled)";
184 #endif 184 #endif
185 /* In general we should never print to the screen, 185 /* In general we should never print to the screen,
186 but in this case we have no other way of letting 186 but in this case we have no other way of letting
187 the user know what happened. 187 the user know what happened.
188 */ 188 */
189 fprintf (stderr, "SDL: %s\n", message); 189 fprintf(stderr, "SDL: %s\n", message);
190 #ifdef AUDIO_OSPACE_HACK 190 #ifdef AUDIO_OSPACE_HACK
191 /* We may be able to use GET_OSPACE trick */ 191 /* We may be able to use GET_OSPACE trick */
192 frame_ticks = (float) (this->spec->samples * 1000) / 192 frame_ticks = (float) (this->spec->samples * 1000) /
193 this->spec->freq; 193 this->spec->freq;
194 next_frame = SDL_GetTicks () + frame_ticks; 194 next_frame = SDL_GetTicks() + frame_ticks;
195 #else 195 #else
196 this->enabled = 0; 196 this->enabled = 0;
197 /* Don't try to close - may hang */ 197 /* Don't try to close - may hang */
198 audio_fd = -1; 198 audio_fd = -1;
199 #ifdef DEBUG_AUDIO 199 #ifdef DEBUG_AUDIO
200 fprintf (stderr, "Done disabling audio\n"); 200 fprintf(stderr, "Done disabling audio\n");
201 #endif 201 #endif
202 #endif /* AUDIO_OSPACE_HACK */ 202 #endif /* AUDIO_OSPACE_HACK */
203 } 203 }
204 #ifdef DEBUG_AUDIO 204 #ifdef DEBUG_AUDIO
205 fprintf (stderr, "Ready!\n"); 205 fprintf(stderr, "Ready!\n");
206 #endif 206 #endif
207 } 207 }
208 } 208 }
209 209
210 static void 210 static void
211 DMA_PlayAudio (_THIS) 211 DMA_PlayAudio(_THIS)
212 { 212 {
213 /* If timer synchronization is enabled, set the next write frame */ 213 /* If timer synchronization is enabled, set the next write frame */
214 if (frame_ticks) { 214 if (frame_ticks) {
215 next_frame += frame_ticks; 215 next_frame += frame_ticks;
216 } 216 }
217 return; 217 return;
218 } 218 }
219 219
220 static Uint8 * 220 static Uint8 *
221 DMA_GetAudioBuf (_THIS) 221 DMA_GetAudioBuf(_THIS)
222 { 222 {
223 count_info info; 223 count_info info;
224 int playing; 224 int playing;
225 int filling; 225 int filling;
226 226
227 /* Get number of blocks, looping if we're not using select() */ 227 /* Get number of blocks, looping if we're not using select() */
228 do { 228 do {
229 if (ioctl (audio_fd, SNDCTL_DSP_GETOPTR, &info) < 0) { 229 if (ioctl(audio_fd, SNDCTL_DSP_GETOPTR, &info) < 0) {
230 /* Uh oh... */ 230 /* Uh oh... */
231 this->enabled = 0; 231 this->enabled = 0;
232 return (NULL); 232 return (NULL);
233 } 233 }
234 } 234 }
235 while (frame_ticks && (info.blocks < 1)); 235 while (frame_ticks && (info.blocks < 1));
236 #ifdef DEBUG_AUDIO 236 #ifdef DEBUG_AUDIO
237 if (info.blocks > 1) { 237 if (info.blocks > 1) {
238 printf ("Warning: audio underflow (%d frags)\n", info.blocks - 1); 238 printf("Warning: audio underflow (%d frags)\n", info.blocks - 1);
239 } 239 }
240 #endif 240 #endif
241 playing = info.ptr / this->spec.size; 241 playing = info.ptr / this->spec.size;
242 filling = (playing + 1) % num_buffers; 242 filling = (playing + 1) % num_buffers;
243 return (dma_buf + (filling * this->spec.size)); 243 return (dma_buf + (filling * this->spec.size));
244 } 244 }
245 245
246 static void 246 static void
247 DMA_CloseAudio (_THIS) 247 DMA_CloseAudio(_THIS)
248 { 248 {
249 if (dma_buf != NULL) { 249 if (dma_buf != NULL) {
250 munmap (dma_buf, dma_len); 250 munmap(dma_buf, dma_len);
251 dma_buf = NULL; 251 dma_buf = NULL;
252 } 252 }
253 if (audio_fd >= 0) { 253 if (audio_fd >= 0) {
254 close (audio_fd); 254 close(audio_fd);
255 audio_fd = -1; 255 audio_fd = -1;
256 } 256 }
257 } 257 }
258 258
259 static int 259 static int
260 DMA_ReopenAudio (_THIS, const char *audiodev, int format, int stereo, 260 DMA_ReopenAudio(_THIS, const char *audiodev, int format, int stereo,
261 SDL_AudioSpec * spec) 261 SDL_AudioSpec * spec)
262 { 262 {
263 int frag_spec; 263 int frag_spec;
264 int value; 264 int value;
265 265
266 /* Close and then reopen the audio device */ 266 /* Close and then reopen the audio device */
267 close (audio_fd); 267 close(audio_fd);
268 audio_fd = open (audiodev, O_RDWR, 0); 268 audio_fd = open(audiodev, O_RDWR, 0);
269 if (audio_fd < 0) { 269 if (audio_fd < 0) {
270 SDL_SetError ("Couldn't open %s: %s", audiodev, strerror (errno)); 270 SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
271 return (-1); 271 return (-1);
272 } 272 }
273 273
274 /* Calculate the final parameters for this audio specification */ 274 /* Calculate the final parameters for this audio specification */
275 SDL_CalculateAudioSpec (spec); 275 SDL_CalculateAudioSpec(spec);
276 276
277 /* Determine the power of two of the fragment size */ 277 /* Determine the power of two of the fragment size */
278 for (frag_spec = 0; (0x01 << frag_spec) < spec->size; ++frag_spec); 278 for (frag_spec = 0; (0x01 << frag_spec) < spec->size; ++frag_spec);
279 if ((0x01 << frag_spec) != spec->size) { 279 if ((0x01 << frag_spec) != spec->size) {
280 SDL_SetError ("Fragment size must be a power of two"); 280 SDL_SetError("Fragment size must be a power of two");
281 return (-1); 281 return (-1);
282 } 282 }
283 283
284 /* Set the audio buffering parameters */ 284 /* Set the audio buffering parameters */
285 if (ioctl (audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0) { 285 if (ioctl(audio_fd, SNDCTL_DSP_SETFRAGMENT, &frag_spec) < 0) {
286 SDL_SetError ("Couldn't set audio fragment spec"); 286 SDL_SetError("Couldn't set audio fragment spec");
287 return (-1); 287 return (-1);
288 } 288 }
289 289
290 /* Set the audio format */ 290 /* Set the audio format */
291 value = format; 291 value = format;
292 if ((ioctl (audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || 292 if ((ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || (value != format)) {
293 (value != format)) { 293 SDL_SetError("Couldn't set audio format");
294 SDL_SetError ("Couldn't set audio format");
295 return (-1); 294 return (-1);
296 } 295 }
297 296
298 /* Set mono or stereo audio */ 297 /* Set mono or stereo audio */
299 value = (spec->channels > 1); 298 value = (spec->channels > 1);
300 if ((ioctl (audio_fd, SNDCTL_DSP_STEREO, &stereo) < 0) || 299 if ((ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo) < 0) ||
301 (value != stereo)) { 300 (value != stereo)) {
302 SDL_SetError ("Couldn't set audio channels"); 301 SDL_SetError("Couldn't set audio channels");
303 return (-1); 302 return (-1);
304 } 303 }
305 304
306 /* Set the DSP frequency */ 305 /* Set the DSP frequency */
307 value = spec->freq; 306 value = spec->freq;
308 if (ioctl (audio_fd, SNDCTL_DSP_SPEED, &value) < 0) { 307 if (ioctl(audio_fd, SNDCTL_DSP_SPEED, &value) < 0) {
309 SDL_SetError ("Couldn't set audio frequency"); 308 SDL_SetError("Couldn't set audio frequency");
310 return (-1); 309 return (-1);
311 } 310 }
312 spec->freq = value; 311 spec->freq = value;
313 312
314 /* We successfully re-opened the audio */ 313 /* We successfully re-opened the audio */
315 return (0); 314 return (0);
316 } 315 }
317 316
318 static int 317 static int
319 DMA_OpenAudio (_THIS, SDL_AudioSpec * spec) 318 DMA_OpenAudio(_THIS, SDL_AudioSpec * spec)
320 { 319 {
321 char audiodev[1024]; 320 char audiodev[1024];
322 int format; 321 int format;
323 int stereo; 322 int stereo;
324 int value; 323 int value;
327 326
328 /* Reset the timer synchronization flag */ 327 /* Reset the timer synchronization flag */
329 frame_ticks = 0.0; 328 frame_ticks = 0.0;
330 329
331 /* Open the audio device */ 330 /* Open the audio device */
332 audio_fd = SDL_OpenAudioPath (audiodev, sizeof (audiodev), OPEN_FLAGS, 0); 331 audio_fd = SDL_OpenAudioPath(audiodev, sizeof(audiodev), OPEN_FLAGS, 0);
333 if (audio_fd < 0) { 332 if (audio_fd < 0) {
334 SDL_SetError ("Couldn't open %s: %s", audiodev, strerror (errno)); 333 SDL_SetError("Couldn't open %s: %s", audiodev, strerror(errno));
335 return (-1); 334 return (-1);
336 } 335 }
337 dma_buf = NULL; 336 dma_buf = NULL;
338 ioctl (audio_fd, SNDCTL_DSP_RESET, 0); 337 ioctl(audio_fd, SNDCTL_DSP_RESET, 0);
339 338
340 /* Get a list of supported hardware formats */ 339 /* Get a list of supported hardware formats */
341 if (ioctl (audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) { 340 if (ioctl(audio_fd, SNDCTL_DSP_GETFMTS, &value) < 0) {
342 SDL_SetError ("Couldn't get audio format list"); 341 SDL_SetError("Couldn't get audio format list");
343 return (-1); 342 return (-1);
344 } 343 }
345 344
346 /* Try for a closest match on audio format */ 345 /* Try for a closest match on audio format */
347 format = 0; 346 format = 0;
348 for (test_format = SDL_FirstAudioFormat (spec->format); 347 for (test_format = SDL_FirstAudioFormat(spec->format);
349 !format && test_format;) { 348 !format && test_format;) {
350 #ifdef DEBUG_AUDIO 349 #ifdef DEBUG_AUDIO
351 fprintf (stderr, "Trying format 0x%4.4x\n", test_format); 350 fprintf(stderr, "Trying format 0x%4.4x\n", test_format);
352 #endif 351 #endif
353 switch (test_format) { 352 switch (test_format) {
354 case AUDIO_U8: 353 case AUDIO_U8:
355 if (value & AFMT_U8) { 354 if (value & AFMT_U8) {
356 format = AFMT_U8; 355 format = AFMT_U8;
384 default: 383 default:
385 format = 0; 384 format = 0;
386 break; 385 break;
387 } 386 }
388 if (!format) { 387 if (!format) {
389 test_format = SDL_NextAudioFormat (); 388 test_format = SDL_NextAudioFormat();
390 } 389 }
391 } 390 }
392 if (format == 0) { 391 if (format == 0) {
393 SDL_SetError ("Couldn't find any hardware audio formats"); 392 SDL_SetError("Couldn't find any hardware audio formats");
394 return (-1); 393 return (-1);
395 } 394 }
396 spec->format = test_format; 395 spec->format = test_format;
397 396
398 /* Set the audio format */ 397 /* Set the audio format */
399 value = format; 398 value = format;
400 if ((ioctl (audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || 399 if ((ioctl(audio_fd, SNDCTL_DSP_SETFMT, &value) < 0) || (value != format)) {
401 (value != format)) { 400 SDL_SetError("Couldn't set audio format");
402 SDL_SetError ("Couldn't set audio format");
403 return (-1); 401 return (-1);
404 } 402 }
405 403
406 /* Set mono or stereo audio (currently only two channels supported) */ 404 /* Set mono or stereo audio (currently only two channels supported) */
407 stereo = (spec->channels > 1); 405 stereo = (spec->channels > 1);
408 ioctl (audio_fd, SNDCTL_DSP_STEREO, &stereo); 406 ioctl(audio_fd, SNDCTL_DSP_STEREO, &stereo);
409 if (stereo) { 407 if (stereo) {
410 spec->channels = 2; 408 spec->channels = 2;
411 } else { 409 } else {
412 spec->channels = 1; 410 spec->channels = 1;
413 } 411 }
414 412
415 /* Because some drivers don't allow setting the buffer size 413 /* Because some drivers don't allow setting the buffer size
416 after setting the format, we must re-open the audio device 414 after setting the format, we must re-open the audio device
417 once we know what format and channels are supported 415 once we know what format and channels are supported
418 */ 416 */
419 if (DMA_ReopenAudio (this, audiodev, format, stereo, spec) < 0) { 417 if (DMA_ReopenAudio(this, audiodev, format, stereo, spec) < 0) {
420 /* Error is set by DMA_ReopenAudio() */ 418 /* Error is set by DMA_ReopenAudio() */
421 return (-1); 419 return (-1);
422 } 420 }
423 421
424 /* Memory map the audio buffer */ 422 /* Memory map the audio buffer */
425 if (ioctl (audio_fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { 423 if (ioctl(audio_fd, SNDCTL_DSP_GETOSPACE, &info) < 0) {
426 SDL_SetError ("Couldn't get OSPACE parameters"); 424 SDL_SetError("Couldn't get OSPACE parameters");
427 return (-1); 425 return (-1);
428 } 426 }
429 spec->size = info.fragsize; 427 spec->size = info.fragsize;
430 spec->samples = spec->size / ((spec->format & 0xFF) / 8); 428 spec->samples = spec->size / ((spec->format & 0xFF) / 8);
431 spec->samples /= spec->channels; 429 spec->samples /= spec->channels;
432 num_buffers = info.fragstotal; 430 num_buffers = info.fragstotal;
433 dma_len = num_buffers * spec->size; 431 dma_len = num_buffers * spec->size;
434 dma_buf = (Uint8 *) mmap (NULL, dma_len, PROT_WRITE, MAP_SHARED, 432 dma_buf = (Uint8 *) mmap(NULL, dma_len, PROT_WRITE, MAP_SHARED,
435 audio_fd, 0); 433 audio_fd, 0);
436 if (dma_buf == MAP_FAILED) { 434 if (dma_buf == MAP_FAILED) {
437 SDL_SetError ("DMA memory map failed"); 435 SDL_SetError("DMA memory map failed");
438 dma_buf = NULL; 436 dma_buf = NULL;
439 return (-1); 437 return (-1);
440 } 438 }
441 SDL_memset (dma_buf, spec->silence, dma_len); 439 SDL_memset(dma_buf, spec->silence, dma_len);
442 440
443 /* Check to see if we need to use select() workaround */ 441 /* Check to see if we need to use select() workaround */
444 { 442 {
445 char *workaround; 443 char *workaround;
446 workaround = SDL_getenv ("SDL_DSP_NOSELECT"); 444 workaround = SDL_getenv("SDL_DSP_NOSELECT");
447 if (workaround) { 445 if (workaround) {
448 frame_ticks = (float) (spec->samples * 1000) / spec->freq; 446 frame_ticks = (float) (spec->samples * 1000) / spec->freq;
449 next_frame = SDL_GetTicks () + frame_ticks; 447 next_frame = SDL_GetTicks() + frame_ticks;
450 } 448 }
451 } 449 }
452 450
453 /* Trigger audio playback */ 451 /* Trigger audio playback */
454 value = 0; 452 value = 0;
455 ioctl (audio_fd, SNDCTL_DSP_SETTRIGGER, &value); 453 ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value);
456 value = PCM_ENABLE_OUTPUT; 454 value = PCM_ENABLE_OUTPUT;
457 if (ioctl (audio_fd, SNDCTL_DSP_SETTRIGGER, &value) < 0) { 455 if (ioctl(audio_fd, SNDCTL_DSP_SETTRIGGER, &value) < 0) {
458 SDL_SetError ("Couldn't trigger audio output"); 456 SDL_SetError("Couldn't trigger audio output");
459 return (-1); 457 return (-1);
460 } 458 }
461 459
462 /* Get the parent process id (we're the parent of the audio thread) */ 460 /* Get the parent process id (we're the parent of the audio thread) */
463 parent = getpid (); 461 parent = getpid();
464 462
465 /* We're ready to rock and roll. :-) */ 463 /* We're ready to rock and roll. :-) */
466 return (0); 464 return (0);
467 } 465 }
468 466