# HG changeset patch # User Ryan C. Gordon # Date 1264485693 0 # Node ID 4160ba33b597530047a88170cabe68b290d3fe75 # Parent 17376128fb56c1024b0e824429308219af5b540e 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. diff -r 17376128fb56 -r 4160ba33b597 src/audio/SDL_audio.c --- a/src/audio/SDL_audio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/SDL_audio.c Tue Jan 26 06:01:33 2010 +0000 @@ -581,8 +581,6 @@ 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_memset(¤t_audio, 0, sizeof(current_audio)); current_audio.name = backend->name; current_audio.desc = backend->desc; - rc = backend->init(¤t_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(¤t_audio, 0, sizeof(current_audio)); - current_audio.name = backend->name; - current_audio.desc = backend->desc; - initialized = (backend->init(¤t_audio.impl) > 0); + initialized = backend->init(¤t_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"); } diff -r 17376128fb56 -r 4160ba33b597 src/audio/alsa/SDL_alsa_audio.c --- a/src/audio/alsa/SDL_alsa_audio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/alsa/SDL_alsa_audio.c Tue Jan 26 06:01:33 2010 +0000 @@ -681,7 +681,7 @@ 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. */ } diff -r 17376128fb56 -r 4160ba33b597 src/audio/arts/SDL_artsaudio.c --- a/src/audio/arts/SDL_artsaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/arts/SDL_artsaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -368,7 +368,7 @@ impl->Deinitialize = ARTS_Deinitialize; impl->OnlyHasDefaultOutputDevice = 1; - return 1; + return 1; /* this audio target is available. */ } diff -r 17376128fb56 -r 4160ba33b597 src/audio/baudio/SDL_beaudio.cc --- a/src/audio/baudio/SDL_beaudio.cc Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/baudio/SDL_beaudio.cc Tue Jan 26 06:01:33 2010 +0000 @@ -204,7 +204,7 @@ impl->ProvidesOwnCallbackThread = 1; impl->OnlyHasDefaultOutputDevice = 1; - return 1; + return 1; /* this audio target is available. */ } extern "C" diff -r 17376128fb56 -r 4160ba33b597 src/audio/bsd/SDL_bsdaudio.c --- a/src/audio/bsd/SDL_bsdaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/bsd/SDL_bsdaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -444,7 +444,8 @@ impl->Deinitialize = BSDAUDIO_Deinitialize; build_device_lists(); - return (outputDeviceCount > 0) ? 2 : 1; + + return 1; /* this audio target is available. */ } diff -r 17376128fb56 -r 4160ba33b597 src/audio/disk/SDL_diskaudio.c --- a/src/audio/disk/SDL_diskaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/disk/SDL_diskaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -158,7 +158,7 @@ impl->GetDeviceBuf = DISKAUD_GetDeviceBuf; impl->CloseDevice = DISKAUD_CloseDevice; - return 1; + return 1; /* this audio target is available. */ } AudioBootStrap DISKAUD_bootstrap = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/dma/SDL_dmaaudio.c --- a/src/audio/dma/SDL_dmaaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/dma/SDL_dmaaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -524,7 +524,8 @@ impl->Deinitialize = DMA_Deinitialize; build_device_lists(); - return (outputDeviceCount > 0) ? 2 : 1; + + return 1; /* this audio target is available. */ } AudioBootStrap DMA_bootstrap = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/dmedia/SDL_irixaudio.c --- a/src/audio/dmedia/SDL_irixaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/dmedia/SDL_irixaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -228,7 +228,7 @@ impl->CloseDevice = DSP_CloseDevice; impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: not true, I think. */ - return 1; + return 1; /* this audio target is available. */ } AudioBootStrap IRIXAUDIO_bootstrap = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/dsp/SDL_dspaudio.c --- a/src/audio/dsp/SDL_dspaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/dsp/SDL_dspaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -381,7 +381,8 @@ impl->Deinitialize = DSP_Deinitialize; build_device_lists(); - return (outputDeviceCount > 0) ? 2 : 1; + + return 1; /* this audio target is available. */ } diff -r 17376128fb56 -r 4160ba33b597 src/audio/dummy/SDL_dummyaudio.c --- a/src/audio/dummy/SDL_dummyaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/dummy/SDL_dummyaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -41,7 +41,7 @@ /* Set the function pointers */ impl->OpenDevice = DUMMYAUD_OpenDevice; impl->OnlyHasDefaultOutputDevice = 1; - return 1; + return 1; /* this audio target is available. */ } AudioBootStrap DUMMYAUD_bootstrap = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/esd/SDL_esdaudio.c --- a/src/audio/esd/SDL_esdaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/esd/SDL_esdaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -341,7 +341,7 @@ impl->Deinitialize = ESD_Deinitialize; impl->OnlyHasDefaultOutputDevice = 1; - return 2; /* return 2 (definitely have a "device"). */ + return 1; /* this audio target is available. */ } diff -r 17376128fb56 -r 4160ba33b597 src/audio/fusionsound/SDL_fsaudio.c --- a/src/audio/fusionsound/SDL_fsaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/fusionsound/SDL_fsaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -340,7 +340,7 @@ impl->Deinitialize = SDL_FS_Deinitialize; impl->OnlyHasDefaultOutputDevice = 1; - return 1; + return 1; /* this audio target is available. */ } diff -r 17376128fb56 -r 4160ba33b597 src/audio/iphoneos/SDL_coreaudio_iphone.c --- a/src/audio/iphoneos/SDL_coreaudio_iphone.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/iphoneos/SDL_coreaudio_iphone.c Tue Jan 26 06:01:33 2010 +0000 @@ -329,7 +329,7 @@ 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 = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/macosx/SDL_coreaudio.c --- a/src/audio/macosx/SDL_coreaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/macosx/SDL_coreaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -574,7 +574,7 @@ build_device_lists(); /* do an initial check for devices... */ - return (outputDeviceCount > 0) ? 2 : 1; + return 1; /* this audio target is available. */ } AudioBootStrap COREAUDIO_bootstrap = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/mme/SDL_mmeaudio.c --- a/src/audio/mme/SDL_mmeaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/mme/SDL_mmeaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -249,7 +249,7 @@ impl->CloseDevice = MME_CloseDevice; impl->OnlyHasDefaultOutputDevice = 1; - return 1; + return 1; /* this audio target is available. */ } /* !!! FIXME: Windows "windib" driver is called waveout, too */ diff -r 17376128fb56 -r 4160ba33b597 src/audio/nas/SDL_nasaudio.c --- a/src/audio/nas/SDL_nasaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/nas/SDL_nasaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -398,7 +398,7 @@ 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 = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/nds/SDL_ndsaudio.c --- a/src/audio/nds/SDL_ndsaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/nds/SDL_ndsaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -120,7 +120,7 @@ impl->OnlyHasDefaultOutputDevice = 1; impl->OnlyHasDefaultInputDevice = 1; - return 2; /* 2 == definitely has an audio device. */ + return 1; /* this audio target is available. */ } AudioBootStrap NDSAUD_bootstrap = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/paudio/SDL_paudio.c --- a/src/audio/paudio/SDL_paudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/paudio/SDL_paudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -544,8 +544,7 @@ 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 = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/pulseaudio/SDL_pulseaudio.c --- a/src/audio/pulseaudio/SDL_pulseaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/pulseaudio/SDL_pulseaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -529,8 +529,7 @@ 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. */ } diff -r 17376128fb56 -r 4160ba33b597 src/audio/qsa/SDL_qsa_audio.c --- a/src/audio/qsa/SDL_qsa_audio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/qsa/SDL_qsa_audio.c Tue Jan 26 06:01:33 2010 +0000 @@ -883,8 +883,7 @@ return 1; } - /* At this point we are definitely has an audio device */ - return 2; + return 1; /* this audio target is available. */ } AudioBootStrap QSAAUDIO_bootstrap = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/windib/SDL_dibaudio.c --- a/src/audio/windib/SDL_dibaudio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/windib/SDL_dibaudio.c Tue Jan 26 06:01:33 2010 +0000 @@ -327,8 +327,7 @@ 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 = { diff -r 17376128fb56 -r 4160ba33b597 src/audio/windx5/SDL_dx5audio.c --- a/src/audio/windx5/SDL_dx5audio.c Sun Jan 24 21:13:33 2010 +0000 +++ b/src/audio/windx5/SDL_dx5audio.c Tue Jan 26 06:01:33 2010 +0000 @@ -508,8 +508,7 @@ 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 = {