Removed test for "driver is valid, but doesn't see any audio devices."

It was causing problems, and it really doesn't make sense to do it that way.

  Fixes Bugzilla #834.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404455
This commit is contained in:
Ryan C. Gordon 2010-01-26 06:01:33 +00:00
parent 3ec28279e8
commit edb477343d
22 changed files with 26 additions and 50 deletions

View file

@ -581,8 +581,6 @@ SDL_AudioInit(const char *driver_name)
int i = 0;
int initialized = 0;
int tried_to_init = 0;
int rc = 0;
int best_choice = -1;
if (SDL_WasInit(SDL_INIT_AUDIO)) {
SDL_AudioQuit(); /* shutdown driver if already running. */
@ -608,34 +606,14 @@ SDL_AudioInit(const char *driver_name)
SDL_memset(&current_audio, 0, sizeof(current_audio));
current_audio.name = backend->name;
current_audio.desc = backend->desc;
rc = backend->init(&current_audio.impl);
if (rc == 2) { /* init'd, and devices available. Take it! */
initialized = 1;
best_choice = i;
} else if (rc == 1) { /* init'd, but can't see any devices. */
if (current_audio.impl.Deinitialize) {
current_audio.impl.Deinitialize();
}
if (best_choice == -1) {
best_choice = i;
}
}
}
/* No definite choice. Pick one that works but can't promise a device. */
if ((!initialized) && (best_choice != -1)) {
const AudioBootStrap *backend = bootstrap[best_choice];
SDL_memset(&current_audio, 0, sizeof(current_audio));
current_audio.name = backend->name;
current_audio.desc = backend->desc;
initialized = (backend->init(&current_audio.impl) > 0);
initialized = backend->init(&current_audio.impl);
}
if (!initialized) {
/* specific drivers will set the error message if they fail... */
if (!tried_to_init) {
if (driver_name) {
SDL_SetError("%s not available", driver_name);
SDL_SetError("Audio target '%s' not available", driver_name);
} else {
SDL_SetError("No available audio device");
}

View file

@ -681,7 +681,7 @@ ALSA_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = ALSA_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: Add device enum! */
return 1; /* !!! FIXME: return 2 once device enum is implemented. */
return 1; /* this audio target is available. */
}

View file

@ -368,7 +368,7 @@ ARTS_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = ARTS_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
return 1;
return 1; /* this audio target is available. */
}

View file

@ -204,7 +204,7 @@ BEOSAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->ProvidesOwnCallbackThread = 1;
impl->OnlyHasDefaultOutputDevice = 1;
return 1;
return 1; /* this audio target is available. */
}
extern "C"

View file

@ -444,7 +444,8 @@ BSDAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = BSDAUDIO_Deinitialize;
build_device_lists();
return (outputDeviceCount > 0) ? 2 : 1;
return 1; /* this audio target is available. */
}

View file

@ -158,7 +158,7 @@ DISKAUD_Init(SDL_AudioDriverImpl * impl)
impl->GetDeviceBuf = DISKAUD_GetDeviceBuf;
impl->CloseDevice = DISKAUD_CloseDevice;
return 1;
return 1; /* this audio target is available. */
}
AudioBootStrap DISKAUD_bootstrap = {

View file

@ -524,7 +524,8 @@ DMA_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = DMA_Deinitialize;
build_device_lists();
return (outputDeviceCount > 0) ? 2 : 1;
return 1; /* this audio target is available. */
}
AudioBootStrap DMA_bootstrap = {

View file

@ -228,7 +228,7 @@ IRIXAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = DSP_CloseDevice;
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: not true, I think. */
return 1;
return 1; /* this audio target is available. */
}
AudioBootStrap IRIXAUDIO_bootstrap = {

View file

@ -381,7 +381,8 @@ DSP_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = DSP_Deinitialize;
build_device_lists();
return (outputDeviceCount > 0) ? 2 : 1;
return 1; /* this audio target is available. */
}

View file

@ -41,7 +41,7 @@ DUMMYAUD_Init(SDL_AudioDriverImpl * impl)
/* Set the function pointers */
impl->OpenDevice = DUMMYAUD_OpenDevice;
impl->OnlyHasDefaultOutputDevice = 1;
return 1;
return 1; /* this audio target is available. */
}
AudioBootStrap DUMMYAUD_bootstrap = {

View file

@ -341,7 +341,7 @@ ESD_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = ESD_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
return 2; /* return 2 (definitely have a "device"). */
return 1; /* this audio target is available. */
}

View file

@ -340,7 +340,7 @@ SDL_FS_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = SDL_FS_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
return 1;
return 1; /* this audio target is available. */
}

View file

@ -329,7 +329,7 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->OnlyHasDefaultOutputDevice = 1;
impl->HasCaptureSupport = 0; /* still needs to be written */
return 2; /* defitely have an audio device. */
return 1; /* this audio target is available. */
}
AudioBootStrap COREAUDIOIPHONE_bootstrap = {

View file

@ -574,7 +574,7 @@ COREAUDIO_Init(SDL_AudioDriverImpl * impl)
build_device_lists(); /* do an initial check for devices... */
return (outputDeviceCount > 0) ? 2 : 1;
return 1; /* this audio target is available. */
}
AudioBootStrap COREAUDIO_bootstrap = {

View file

@ -249,7 +249,7 @@ MME_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = MME_CloseDevice;
impl->OnlyHasDefaultOutputDevice = 1;
return 1;
return 1; /* this audio target is available. */
}
/* !!! FIXME: Windows "windib" driver is called waveout, too */

View file

@ -398,7 +398,7 @@ NAS_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = NAS_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: is this true? */
return 2; /* 2 == definitely has an audio device. */
return 1; /* this audio target is available. */
}
AudioBootStrap NAS_bootstrap = {

View file

@ -120,7 +120,7 @@ NDSAUD_Init(SDL_AudioDriverImpl * impl)
impl->OnlyHasDefaultOutputDevice = 1;
impl->OnlyHasDefaultInputDevice = 1;
return 2; /* 2 == definitely has an audio device. */
return 1; /* this audio target is available. */
}
AudioBootStrap NDSAUD_bootstrap = {

View file

@ -544,8 +544,7 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = DSP_CloseDevice;
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */
/* !!! FIXME: device enum might make this 1. */
return 2; /* 2 == definitely has an audio device. */
return 1; /* this audio target is available. */
}
AudioBootStrap PAUDIO_bootstrap = {

View file

@ -529,8 +529,7 @@ PULSEAUDIO_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = PULSEAUDIO_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1;
/* !!! FIXME: should test if server is available here, return 2 if so. */
return 1;
return 1; /* this audio target is available. */
}

View file

@ -883,8 +883,7 @@ QSA_Init(SDL_AudioDriverImpl * impl)
return 1;
}
/* At this point we are definitely has an audio device */
return 2;
return 1; /* this audio target is available. */
}
AudioBootStrap QSAAUDIO_bootstrap = {

View file

@ -327,8 +327,7 @@ WINWAVEOUT_Init(SDL_AudioDriverImpl * impl)
impl->CloseDevice = WINWAVEOUT_CloseDevice;
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: Is this true? */
/* !!! FIXME: not right for device enum? */
return 1;
return 1; /* this audio target is available. */
}
AudioBootStrap WINWAVEOUT_bootstrap = {

View file

@ -508,8 +508,7 @@ DSOUND_Init(SDL_AudioDriverImpl * impl)
impl->Deinitialize = DSOUND_Deinitialize;
impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME */
/* !!! FIXME: not right for device enum? */
return 1;
return 1; /* this audio target is available. */
}
AudioBootStrap DSOUND_bootstrap = {