Mercurial > sdl-ios-xcode
comparison src/audio/paudio/SDL_paudio.c @ 2938:2929ed239d2a
Adjusted default choice of audio driver.
If a driver can definitely see available devices, it is chosen. Otherwise,
we'll take the first driver that initializes but saw no devices...this might
be because it can't enumerate them, or there really aren't any available.
This prevents the dsp driver from hogging control when there are no /dev/dsp*
nodes (for example, on a Linux box with ALSA and no OSS emulation).
author | Ryan C. Gordon <icculus@icculus.org> |
---|---|
date | Thu, 01 Jan 2009 07:54:58 +0000 |
parents | 99210400e8b9 |
children | 1e431c2631ee |
comparison
equal
deleted
inserted
replaced
2937:017d4334accf | 2938:2929ed239d2a |
---|---|
526 } | 526 } |
527 | 527 |
528 static int | 528 static int |
529 PAUDIO_Init(SDL_AudioDriverImpl * impl) | 529 PAUDIO_Init(SDL_AudioDriverImpl * impl) |
530 { | 530 { |
531 /* !!! FIXME: not right for device enum? */ | |
531 int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); | 532 int fd = OpenAudioPath(NULL, 0, OPEN_FLAGS, 0); |
532 if (fd < 0) { | 533 if (fd < 0) { |
533 SDL_SetError("PAUDIO: Couldn't open audio device"); | 534 SDL_SetError("PAUDIO: Couldn't open audio device"); |
534 return 0; | 535 return 0; |
535 } | 536 } |
541 impl->PlayDevice = DSP_WaitDevice; | 542 impl->PlayDevice = DSP_WaitDevice; |
542 impl->GetDeviceBuf = DSP_GetDeviceBuf; | 543 impl->GetDeviceBuf = DSP_GetDeviceBuf; |
543 impl->CloseDevice = DSP_CloseDevice; | 544 impl->CloseDevice = DSP_CloseDevice; |
544 impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ | 545 impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ |
545 | 546 |
546 return 1; | 547 /* !!! FIXME: device enum might make this 1. */ |
548 return 2; /* 2 == definitely has an audio device. */ | |
547 } | 549 } |
548 | 550 |
549 AudioBootStrap PAUDIO_bootstrap = { | 551 AudioBootStrap PAUDIO_bootstrap = { |
550 PAUDIO_DRIVER_NAME, "AIX Paudio", PAUDIO_Init, 0 | 552 PAUDIO_DRIVER_NAME, "AIX Paudio", PAUDIO_Init, 0 |
551 }; | 553 }; |