void alcWinMMProbe(enum DevProbe type) { ALuint i; switch(type) { case DEVICE_PROBE: ProbePlaybackDevices(); if(NumPlaybackDevices > 0) AppendDeviceList(woDefault); break; case ALL_DEVICE_PROBE: ProbePlaybackDevices(); if(NumPlaybackDevices > 0) AppendAllDeviceList(woDefault); for(i = 0;i < NumPlaybackDevices;i++) { if(PlaybackDeviceList[i]) AppendAllDeviceList(PlaybackDeviceList[i]); } break; case CAPTURE_DEVICE_PROBE: ProbeCaptureDevices(); for(i = 0;i < NumCaptureDevices;i++) { if(CaptureDeviceList[i]) AppendCaptureDeviceList(CaptureDeviceList[i]); } break; } }
void alcWinMMProbe(int type) { ALuint i; if(type == DEVICE_PROBE) { ProbePlaybackDevices(); if(NumPlaybackDevices > 0) AppendDeviceList(woDefault); } else if(type == ALL_DEVICE_PROBE) { ProbePlaybackDevices(); if(NumPlaybackDevices > 0) AppendAllDeviceList(woDefault); for(i = 0;i < NumPlaybackDevices;i++) { if(PlaybackDeviceList[i]) AppendAllDeviceList(PlaybackDeviceList[i]); } } else if(type == CAPTURE_DEVICE_PROBE) { ProbeCaptureDevices(); for(i = 0;i < NumCaptureDevices;i++) { if(CaptureDeviceList[i]) AppendCaptureDeviceList(CaptureDeviceList[i]); } } }
void alcDSoundProbe(int type) { if(!DSoundLoad()) return; if(type == DEVICE_PROBE) AppendDeviceList(dsDevice); else if(type == ALL_DEVICE_PROBE) { HRESULT hr; ALuint i; for(i = 0;i < NumDevices;++i) free(DeviceList[i].name); free(DeviceList); DeviceList = NULL; NumDevices = 0; hr = pDirectSoundEnumerateA(DSoundEnumDevices, NULL); if(FAILED(hr)) AL_PRINT("Error enumerating DirectSound devices (%#x)!\n", (unsigned int)hr); else { for(i = 0;i < NumDevices;i++) AppendAllDeviceList(DeviceList[i].name); } } }
static BOOL CALLBACK DSoundEnumDevices(LPGUID guid, LPCSTR desc, LPCSTR drvname, LPVOID data) { (void)data; (void)drvname; if(guid) { char str[128]; void *temp; temp = realloc(DeviceList, sizeof(DevMap) * (NumDevices+1)); if(temp) { DeviceList = temp; snprintf(str, sizeof(str), "DirectSound Software on %s", desc); AppendAllDeviceList(str); DeviceList[NumDevices].name = strdup(str); DeviceList[NumDevices].guid = *guid; NumDevices++; } } return TRUE; }
void alc_alsa_probe(enum DevProbe type) { ALuint i; switch(type) { case ALL_DEVICE_PROBE: for(i = 0;i < numDevNames;++i) { free(allDevNameMap[i].name); free(allDevNameMap[i].device); } free(allDevNameMap); allDevNameMap = probe_devices(SND_PCM_STREAM_PLAYBACK, &numDevNames); for(i = 0;i < numDevNames;++i) AppendAllDeviceList(allDevNameMap[i].name); break; case CAPTURE_DEVICE_PROBE: for(i = 0;i < numCaptureDevNames;++i) { free(allCaptureDevNameMap[i].name); free(allCaptureDevNameMap[i].device); } free(allCaptureDevNameMap); allCaptureDevNameMap = probe_devices(SND_PCM_STREAM_CAPTURE, &numCaptureDevNames); for(i = 0;i < numCaptureDevNames;++i) AppendCaptureDeviceList(allCaptureDevNameMap[i].name); break; } }
void alc_solaris_init(BackendFuncs *func_list) { *func_list = solaris_funcs; solaris_device = AppendDeviceList("Solaris Software"); AppendAllDeviceList(solaris_device); }
void alc_oss_probe(enum DevProbe type) { switch(type) { case ALL_DEVICE_PROBE: { #ifdef HAVE_STAT struct stat buf; if(stat(oss_device, &buf) == 0) #endif AppendAllDeviceList(oss_device); } break; case CAPTURE_DEVICE_PROBE: { #ifdef HAVE_STAT struct stat buf; if(stat(oss_capture, &buf) == 0) #endif AppendCaptureDeviceList(oss_device); } break; } }
void alc_oss_probe( int type ) { if ( type == DEVICE_PROBE ) { #ifdef HAVE_STAT struct stat buf; if ( stat( GetConfigValue( "oss", "device", "/dev/dsp" ), &buf ) == 0 ) #endif AppendDeviceList( oss_device ); } else if ( type == ALL_DEVICE_PROBE ) { #ifdef HAVE_STAT struct stat buf; if ( stat( GetConfigValue( "oss", "device", "/dev/dsp" ), &buf ) == 0 ) #endif AppendAllDeviceList( oss_device ); } else if ( type == CAPTURE_DEVICE_PROBE ) { #ifdef HAVE_STAT struct stat buf; if ( stat( GetConfigValue( "oss", "capture", "/dev/dsp" ), &buf ) == 0 ) #endif AppendCaptureDeviceList( oss_device ); } }
void alc_alsa_probe(int type) { ALuint i; if(!alsa_load()) return; if(type == DEVICE_PROBE) AppendDeviceList(alsaDevice); else if(type == ALL_DEVICE_PROBE) { for(i = 0;i < numDevNames;++i) free(allDevNameMap[i].name); free(allDevNameMap); allDevNameMap = probe_devices(SND_PCM_STREAM_PLAYBACK, &numDevNames); for(i = 0;i < numDevNames;++i) AppendAllDeviceList(allDevNameMap[i].name); } else if(type == CAPTURE_DEVICE_PROBE) { for(i = 0;i < numCaptureDevNames;++i) free(allCaptureDevNameMap[i].name); free(allCaptureDevNameMap); allCaptureDevNameMap = probe_devices(SND_PCM_STREAM_CAPTURE, &numCaptureDevNames); for(i = 0;i < numCaptureDevNames;++i) AppendCaptureDeviceList(allCaptureDevNameMap[i].name); } }
void alc_oss_init(BackendFuncs *func_list) { *func_list = oss_funcs; oss_device = AppendDeviceList("OSS Software"); AppendAllDeviceList(oss_device); oss_device_capture = AppendCaptureDeviceList("OSS Capture"); }
void alc_wave_probe(int type) { if(!ConfigValueExists("wave", "file")) return; if(type == DEVICE_PROBE) AppendDeviceList(waveDevice); else if(type == ALL_DEVICE_PROBE) AppendAllDeviceList(waveDevice); }
void alc_android_probe(int type) { if (type == DEVICE_PROBE) { AppendDeviceList(android_device); } else if (type == ALL_DEVICE_PROBE) { AppendAllDeviceList(android_device); } }
void alc_pa_probe(int type) { if(!pa_load()) return; if(type == DEVICE_PROBE) AppendDeviceList(pa_device); else if(type == ALL_DEVICE_PROBE) AppendAllDeviceList(pa_device); else if(type == CAPTURE_DEVICE_PROBE) AppendCaptureDeviceList(pa_device); }
void alc_opensl_probe(enum DevProbe type) { switch(type) { case ALL_DEVICE_PROBE: AppendAllDeviceList(opensl_device); break; case CAPTURE_DEVICE_PROBE: break; } }
void alc_xaudio2_probe(enum DevProbe type) { if (type == DEVICE_PROBE) { AppendDeviceList(xaudio2_device); } else if (type == ALL_DEVICE_PROBE) { AppendAllDeviceList(xaudio2_device); } }
void alc_pa_probe(int type) { pa_load(); if(!pa_handle) return; if(type == DEVICE_PROBE) AppendDeviceList(pa_device); else if(type == ALL_DEVICE_PROBE) AppendAllDeviceList(pa_device); pa_unload(); }
void alc_pulse_probe(int type) //{{{ { if(!pa_handle) alc_pulse_init(NULL); if(!pa_handle) return; if(type == DEVICE_PROBE) AppendDeviceList(pulse_device); else if(type == ALL_DEVICE_PROBE) AppendAllDeviceList(pulse_device); else if(type == CAPTURE_DEVICE_PROBE) AppendCaptureDeviceList(pulse_capture_device); } //}}}
void alc_pa_probe(enum DevProbe type) { switch(type) { case ALL_DEVICE_PROBE: AppendAllDeviceList(pa_device); break; case CAPTURE_DEVICE_PROBE: AppendCaptureDeviceList(pa_device); break; } }
void alc_pulse_probe(int type) //{{{ { if(!pulse_load()) return; if(type == DEVICE_PROBE) AppendDeviceList(pulse_device); else if(type == ALL_DEVICE_PROBE) AppendAllDeviceList(pulse_device); else if(type == CAPTURE_DEVICE_PROBE) AppendCaptureDeviceList(pulse_capture_device); pulse_unload(); } //}}}
void alc_solaris_probe(int type) { #ifdef HAVE_STAT struct stat buf; if(stat(GetConfigValue("solaris", "device", "/dev/audio"), &buf) != 0) return; #endif if(type == DEVICE_PROBE) AppendDeviceList(solaris_device); else if(type == ALL_DEVICE_PROBE) AppendAllDeviceList(solaris_device); }
void alc_pulse_probe( int type ) //{{{ { if ( !pulse_load() ) { return; } if ( type == DEVICE_PROBE ) { AppendDeviceList( pulse_device ); } else if ( type == ALL_DEVICE_PROBE ) { ALuint i; for ( i = 0; i < numDevNames; ++i ) { free( allDevNameMap[i].name ); free( allDevNameMap[i].device_name ); } free( allDevNameMap ); allDevNameMap = NULL; numDevNames = 0; probe_devices( AL_FALSE ); for ( i = 0; i < numDevNames; i++ ) { AppendAllDeviceList( allDevNameMap[i].name ); } } else if ( type == CAPTURE_DEVICE_PROBE ) { ALuint i; for ( i = 0; i < numCaptureDevNames; ++i ) { free( allCaptureDevNameMap[i].name ); free( allCaptureDevNameMap[i].device_name ); } free( allCaptureDevNameMap ); allCaptureDevNameMap = NULL; numCaptureDevNames = 0; probe_devices( AL_TRUE ); for ( i = 0; i < numCaptureDevNames; i++ ) { AppendCaptureDeviceList( allCaptureDevNameMap[i].name ); } } } //}}}
void alc_wave_probe(enum DevProbe type) { if(!ConfigValueExists("wave", "file")) return; switch(type) { case ALL_DEVICE_PROBE: AppendAllDeviceList(waveDevice); break; case CAPTURE_DEVICE_PROBE: break; } }
void alc_opensles_probe(int type) { char *error; struct stat statinfo; if (stat("/system/lib/libOpenSLES.so", &statinfo) != 0) { LOGV("alc_opensles_probe OpenSLES support not found."); return; } dlerror(); // Clear dl errors void *dlHandle = dlopen("/system/lib/libOpenSLES.so", RTLD_NOW | RTLD_GLOBAL); if (!dlHandle || (error = (typeof(error))dlerror()) != NULL) { LOGV("OpenSLES could not be loaded."); return; } #define LOAD_SYM_POINTER(sym) \ do { \ p##sym = dlsym(dlHandle, #sym); \ if((error=(typeof(error))dlerror()) != NULL) { \ LOGV("alc_opensles_probe could not load %s, error: %s", #sym, error); \ dlclose(dlHandle); \ return; \ } \ } while(0) LOAD_SYM_POINTER(slCreateEngine); LOAD_SYM_POINTER(SL_IID_ENGINE); LOAD_SYM_POINTER(SL_IID_ANDROIDSIMPLEBUFFERQUEUE); LOAD_SYM_POINTER(SL_IID_PLAY); LOAD_SYM_POINTER(SL_IID_BUFFERQUEUE); apportableOpenALFuncs.alc_android_suspend = alc_opensles_suspend; apportableOpenALFuncs.alc_android_resume = alc_opensles_resume; switch (type) { case DEVICE_PROBE: LOGV("alc_opensles_probe DEVICE_PROBE"); AppendDeviceList(opensles_device); break; case ALL_DEVICE_PROBE: LOGV("alc_opensles_probe ALL_DEVICE_PROBE"); AppendAllDeviceList(opensles_device); break; default: LOGV("alc_opensles_probe type=%d", type); break; } }
void alcDSoundProbe(enum DevProbe type) { HRESULT hr, hrcom; ALuint i; switch(type) { case ALL_DEVICE_PROBE: for(i = 0;i < NumPlaybackDevices;++i) free(PlaybackDeviceList[i].name); free(PlaybackDeviceList); PlaybackDeviceList = NULL; NumPlaybackDevices = 0; hr = DirectSoundEnumerateA(DSoundEnumPlaybackDevices, NULL); if(FAILED(hr)) ERR("Error enumerating DirectSound playback devices (%#x)!\n", (unsigned int)hr); else { for(i = 0;i < NumPlaybackDevices;i++) AppendAllDeviceList(PlaybackDeviceList[i].name); } break; case CAPTURE_DEVICE_PROBE: for(i = 0;i < NumCaptureDevices;++i) free(CaptureDeviceList[i].name); free(CaptureDeviceList); CaptureDeviceList = NULL; NumCaptureDevices = 0; /* Initialize COM to prevent name truncation */ hrcom = CoInitialize(NULL); hr = DirectSoundCaptureEnumerateA(DSoundEnumCaptureDevices, NULL); if(FAILED(hr)) ERR("Error enumerating DirectSound capture devices (%#x)!\n", (unsigned int)hr); else { for(i = 0;i < NumCaptureDevices;i++) AppendCaptureDeviceList(CaptureDeviceList[i].name); } if(SUCCEEDED(hrcom)) CoUninitialize(); break; } }
void alc_solaris_probe(enum DevProbe type) { switch(type) { case ALL_DEVICE_PROBE: { #ifdef HAVE_STAT struct stat buf; if(stat(solaris_driver, &buf) == 0) #endif AppendAllDeviceList(solaris_device); } break; case CAPTURE_DEVICE_PROBE: break; } }
static BOOL CALLBACK DSoundEnumDevices(LPGUID guid, LPCSTR desc, LPCSTR drvname, LPVOID data) { size_t *iter = data; (void)drvname; if(guid) { char str[128]; snprintf(str, sizeof(str), "DirectSound Software on %s", desc); DeviceList[*iter].name = AppendAllDeviceList(str); DeviceList[*iter].guid = *guid; (*iter)++; } else DeviceList[0].name = AppendDeviceList("DirectSound Software"); return TRUE; }
void alc_pulse_probe(enum DevProbe type) { ALuint i; switch(type) { case ALL_DEVICE_PROBE: for(i = 0;i < numDevNames;++i) { free(allDevNameMap[i].name); free(allDevNameMap[i].device_name); } free(allDevNameMap); allDevNameMap = NULL; numDevNames = 0; probe_devices(AL_FALSE); for(i = 0;i < numDevNames;i++) AppendAllDeviceList(allDevNameMap[i].name); break; case CAPTURE_DEVICE_PROBE: for(i = 0;i < numCaptureDevNames;++i) { free(allCaptureDevNameMap[i].name); free(allCaptureDevNameMap[i].device_name); } free(allCaptureDevNameMap); allCaptureDevNameMap = NULL; numCaptureDevNames = 0; probe_devices(AL_TRUE); for(i = 0;i < numCaptureDevNames;i++) AppendCaptureDeviceList(allCaptureDevNameMap[i].name); break; } }
void alc_alsa_probe(int type) { snd_ctl_t *handle; int card, err, dev, idx; snd_ctl_card_info_t *info; snd_pcm_info_t *pcminfo; snd_pcm_stream_t stream; char name[128]; ALuint i; if(!alsa_handle) alc_alsa_init(NULL); if(!alsa_handle) return; psnd_ctl_card_info_malloc(&info); psnd_pcm_info_malloc(&pcminfo); if(type == DEVICE_PROBE) AppendDeviceList(alsaDevice); else if(type == ALL_DEVICE_PROBE) { stream = SND_PCM_STREAM_PLAYBACK; card = -1; if(psnd_card_next(&card) < 0 || card < 0) { AL_PRINT("no playback cards found...\n"); psnd_pcm_info_free(pcminfo); psnd_ctl_card_info_free(info); return; } for(i = 0;i < numDevNames;++i) free(allDevNameMap[i].name); allDevNameMap = realloc(allDevNameMap, sizeof(DevMap) * 1); allDevNameMap[0].name = strdup("ALSA Software on default"); AppendAllDeviceList(allDevNameMap[0].name); idx = 1; while(card >= 0) { sprintf(name, "hw:%d", card); if ((err = psnd_ctl_open(&handle, name, 0)) < 0) { AL_PRINT("control open (%i): %s\n", card, psnd_strerror(err)); goto next_card; } if ((err = psnd_ctl_card_info(handle, info)) < 0) { AL_PRINT("control hardware info (%i): %s\n", card, psnd_strerror(err)); psnd_ctl_close(handle); goto next_card; } dev = -1; while(1) { const char *cname, *dname; void *temp; if (psnd_ctl_pcm_next_device(handle, &dev)<0) AL_PRINT("snd_ctl_pcm_next_device failed\n"); if (dev < 0) break; psnd_pcm_info_set_device(pcminfo, dev); psnd_pcm_info_set_subdevice(pcminfo, 0); psnd_pcm_info_set_stream(pcminfo, stream); if ((err = psnd_ctl_pcm_info(handle, pcminfo)) < 0) { if (err != -ENOENT) AL_PRINT("control digital audio info (%i): %s\n", card, psnd_strerror(err)); continue; } temp = realloc(allDevNameMap, sizeof(DevMap) * (idx+1)); if(temp) { allDevNameMap = temp; cname = psnd_ctl_card_info_get_name(info); dname = psnd_pcm_info_get_name(pcminfo); snprintf(name, sizeof(name), "ALSA Software on %s [%s] (hw:%d,%d)", cname, dname, card, dev); AppendAllDeviceList(name); allDevNameMap[idx].name = strdup(name); allDevNameMap[idx].card = card; allDevNameMap[idx].dev = dev; idx++; } } psnd_ctl_close(handle); next_card: if(psnd_card_next(&card) < 0) { AL_PRINT("snd_card_next failed\n"); break; } } numDevNames = idx; } else if(type == CAPTURE_DEVICE_PROBE) { stream = SND_PCM_STREAM_CAPTURE; card = -1; if(psnd_card_next(&card) < 0 || card < 0) { AL_PRINT("no capture cards found...\n"); psnd_pcm_info_free(pcminfo); psnd_ctl_card_info_free(info); return; } for(i = 0;i < numCaptureDevNames;++i) free(allCaptureDevNameMap[i].name); allCaptureDevNameMap = realloc(allCaptureDevNameMap, sizeof(DevMap) * 1); allCaptureDevNameMap[0].name = strdup("ALSA Capture on default"); AppendCaptureDeviceList(allCaptureDevNameMap[0].name); idx = 1; while (card >= 0) { sprintf(name, "hw:%d", card); handle = NULL; if ((err = psnd_ctl_open(&handle, name, 0)) < 0) { AL_PRINT("control open (%i): %s\n", card, psnd_strerror(err)); } if (err >= 0 && (err = psnd_ctl_card_info(handle, info)) < 0) { AL_PRINT("control hardware info (%i): %s\n", card, psnd_strerror(err)); } else if (err >= 0) { dev = -1; while(1) { const char *cname, *dname; void *temp; if (psnd_ctl_pcm_next_device(handle, &dev)<0) AL_PRINT("snd_ctl_pcm_next_device failed\n"); if (dev < 0) break; psnd_pcm_info_set_device(pcminfo, dev); psnd_pcm_info_set_subdevice(pcminfo, 0); psnd_pcm_info_set_stream(pcminfo, stream); if ((err = psnd_ctl_pcm_info(handle, pcminfo)) < 0) { if (err != -ENOENT) AL_PRINT("control digital audio info (%i): %s\n", card, psnd_strerror(err)); continue; } temp = realloc(allCaptureDevNameMap, sizeof(DevMap) * (idx+1)); if(temp) { allCaptureDevNameMap = temp; cname = psnd_ctl_card_info_get_name(info); dname = psnd_pcm_info_get_name(pcminfo); snprintf(name, sizeof(name), "ALSA Capture on %s [%s] (hw:%d,%d)", cname, dname, card, dev); AppendCaptureDeviceList(name); allCaptureDevNameMap[idx].name = strdup(name); allCaptureDevNameMap[idx].card = card; allCaptureDevNameMap[idx].dev = dev; idx++; } } } if(handle) psnd_ctl_close(handle); if(psnd_card_next(&card) < 0) { AL_PRINT("snd_card_next failed\n"); break; } } numCaptureDevNames = idx; } psnd_pcm_info_free(pcminfo); psnd_ctl_card_info_free(info); }
void alc_pulse_probe(enum DevProbe type) //{{{ { pa_threaded_mainloop *loop; ALuint i; switch(type) { case DEVICE_PROBE: if((loop=pa_threaded_mainloop_new()) && pa_threaded_mainloop_start(loop) >= 0) { pa_context *context; pa_threaded_mainloop_lock(loop); context = connect_context(loop, AL_FALSE); if(context) { AppendDeviceList(pulse_device); pa_context_disconnect(context); pa_context_unref(context); } pa_threaded_mainloop_unlock(loop); pa_threaded_mainloop_stop(loop); } if(loop) pa_threaded_mainloop_free(loop); break; case ALL_DEVICE_PROBE: for(i = 0;i < numDevNames;++i) { free(allDevNameMap[i].name); free(allDevNameMap[i].device_name); } free(allDevNameMap); allDevNameMap = NULL; numDevNames = 0; probe_devices(AL_FALSE); for(i = 0;i < numDevNames;i++) AppendAllDeviceList(allDevNameMap[i].name); break; case CAPTURE_DEVICE_PROBE: for(i = 0;i < numCaptureDevNames;++i) { free(allCaptureDevNameMap[i].name); free(allCaptureDevNameMap[i].device_name); } free(allCaptureDevNameMap); allCaptureDevNameMap = NULL; numCaptureDevNames = 0; probe_devices(AL_TRUE); for(i = 0;i < numCaptureDevNames;i++) AppendCaptureDeviceList(allCaptureDevNameMap[i].name); break; } } //}}}