Mercurial > sdl-ios-xcode
comparison src/audio/nto/SDL_nto_audio.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 |
---|---|
432 | 432 |
433 | 433 |
434 static int | 434 static int |
435 NTO_Init(SDL_AudioDriverImpl * impl) | 435 NTO_Init(SDL_AudioDriverImpl * impl) |
436 { | 436 { |
437 /* !!! FIXME: not right for device enum? */ | |
437 /* See if we can open a nonblocking channel. */ | 438 /* See if we can open a nonblocking channel. */ |
438 snd_pcm_t *handle = NULL; | 439 snd_pcm_t *handle = NULL; |
439 int rval = snd_pcm_open_preferred(&handle, NULL, NULL, OPEN_FLAGS); | 440 int rval = snd_pcm_open_preferred(&handle, NULL, NULL, OPEN_FLAGS); |
440 if (rval < 0) { | 441 if (rval < 0) { |
441 SDL_SetError("NTO: couldn't open preferred audio device"); | 442 SDL_SetError("NTO: couldn't open preferred audio device"); |
453 impl->PlayDevice = NTO_PlayDevice; | 454 impl->PlayDevice = NTO_PlayDevice; |
454 impl->GetDeviceBuf = NTO_GetDeviceBuf; | 455 impl->GetDeviceBuf = NTO_GetDeviceBuf; |
455 impl->CloseDevice = NTO_CloseDevice; | 456 impl->CloseDevice = NTO_CloseDevice; |
456 impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ | 457 impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ |
457 | 458 |
458 return 1; | 459 /* !!! FIXME: device enum might make this 1. */ |
460 return 2; /* 2 == definitely has an audio device. */ | |
459 } | 461 } |
460 | 462 |
461 AudioBootStrap QNXNTOAUDIO_bootstrap = { | 463 AudioBootStrap QNXNTOAUDIO_bootstrap = { |
462 DRIVER_NAME, "QNX6 QSA-NTO Audio", NTO_Init, 0 | 464 DRIVER_NAME, "QNX6 QSA-NTO Audio", NTO_Init, 0 |
463 }; | 465 }; |