static int Audio_Available(void) { int available; int status; snd_pcm_t *handle; available = 0; if (LoadALSALibrary() < 0) { return available; } status = SDL_NAME(snd_pcm_open)(&handle, get_audio_device(2), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK); if ( status >= 0 ) { available = 1; SDL_NAME(snd_pcm_close)(handle); } UnloadALSALibrary(); return(available); }
static int LoadALSALibrary(void) { int retval = 0; if (alsa_handle == NULL) { alsa_handle = SDL_LoadObject(alsa_library); if (alsa_handle == NULL) { retval = -1; /* Don't call SDL_SetError(): SDL_LoadObject already did. */ } else { retval = load_alsa_syms(); if (retval < 0) { UnloadALSALibrary(); } } } return retval; }
static int LoadALSALibrary(void) { int i, retval = -1; alsa_handle = SDL_LoadObject(alsa_library); if (alsa_handle) { alsa_loaded = 1; retval = 0; for (i = 0; i < SDL_arraysize(alsa_functions); i++) { *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name); if (!*alsa_functions[i].func) { retval = -1; UnloadALSALibrary(); break; } } } return retval; }
static int LoadALSALibrary(void) { int retval = 0; if (alsa_handle == NULL) { alsa_handle = dlopen(alsa_library, RTLD_NOW); if (alsa_handle == NULL) { retval = -1; SDL_SetError("ALSA: dlopen('%s') failed: %s\n", alsa_library, strerror(errno)); } else { retval = load_alsa_syms(); if (retval < 0) { UnloadALSALibrary(); } } } return retval; }
static int LoadALSALibrary(void) { int i, retval = -1; /* alsa_handle = SDL_LoadObject(alsa_library);*/ alsa_handle = dlopen(alsa_library,RTLD_NOW); if (alsa_handle) { alsa_loaded = 1; retval = 0; for (i = 0; i < SDL_arraysize(alsa_functions); i++) { /* *alsa_functions[i].func = SDL_LoadFunction(alsa_handle,alsa_functions[i].name);*/ #if HAVE_DLVSYM *alsa_functions[i].func = dlvsym(alsa_handle,alsa_functions[i].name,"ALSA_0.9"); if (!*alsa_functions[i].func) #endif *alsa_functions[i].func = dlsym(alsa_handle,alsa_functions[i].name); if (!*alsa_functions[i].func) { retval = -1; UnloadALSALibrary(); break; } } } return retval; }
static void Audio_DeleteDevice(SDL_AudioDevice *device) { SDL_free(device->hidden); SDL_free(device); UnloadALSALibrary(); }
static void ALSA_Deinitialize(void) { UnloadALSALibrary(); }