Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

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.
  • Loading branch information
icculus committed Jan 26, 2010
1 parent e162db4 commit beefdea22c6e4bfdccd95a07b1d2cdcb682075ea
@@ -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");
}
@@ -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. */
}


@@ -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. */
}


@@ -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"
@@ -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. */
}


@@ -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 = {
@@ -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 = {
@@ -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 = {
@@ -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. */
}


@@ -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 = {
@@ -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. */
}


@@ -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. */
}


@@ -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 = {
@@ -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 = {
@@ -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 */
@@ -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 = {
@@ -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 = {
@@ -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 = {
@@ -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. */
}


@@ -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 = {
@@ -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 = {
@@ -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 = {

0 comments on commit beefdea

Please sign in to comment.