void WaveOutPulseAudio::getAudioDevices(AudioDevices &pAList) { // This is where we'll store the input device list PulseAudioDeviceDescriptor tInputDevicesList[MAX_PULSEAUDIO_DEVICES_IN_LIST]; // This is where we'll store the output device list PulseAudioDeviceDescriptor tOutputDevicesList[MAX_PULSEAUDIO_DEVICES_IN_LIST]; if (MediaSourcePulseAudio::GetPulseAudioDevices(tInputDevicesList, tOutputDevicesList) < 0) LOG(LOG_ERROR, "Couldn't determine the available PulseAudio devices"); static bool tFirstCall = true; AudioDeviceDescriptor tDevice; #ifdef WOPUA_DEBUG_PACKETS tFirstCall = true; #endif if (tFirstCall) { LOG(LOG_VERBOSE, "Enumerating hardware.."); LOG(LOG_VERBOSE, "PulseAudio version \"%s\"(%d.%d.%d)", pa_get_library_version(), PA_MAJOR, PA_MINOR, PA_MICRO); } tDevice.Name = "auto"; tDevice.Card = ""; tDevice.Desc = "automatic device selection"; tDevice.IoType = "Output"; pAList.push_back(tDevice); for (int i = 0; i < MAX_PULSEAUDIO_DEVICES_IN_LIST; i++) { if (!tOutputDevicesList[i].Initialized) break; tDevice.Name = string(tOutputDevicesList[i].Description); tDevice.Card = string(tOutputDevicesList[i].Name); tDevice.Desc = "PulseAudio based audio device"; tDevice.IoType = "Output"; pAList.push_back(tDevice); if (tFirstCall) { LOG(LOG_VERBOSE, "Output device %d..", i); LOG(LOG_VERBOSE, "..name: \"%s\"", tDevice.Name.c_str()); LOG(LOG_VERBOSE, "..card: \"%s\"", tDevice.Card.c_str()); LOG(LOG_VERBOSE, "..description: \"%s\"", tDevice.Desc.c_str()); } } tFirstCall = false; }
void MediaSourceFile::getAudioDevices(AudioDevices &pAList) { AudioDeviceDescriptor tDevice; tDevice.Name = mDesiredDevice; tDevice.Card = mDesiredDevice; tDevice.Desc = "file source: \"" + mDesiredDevice + "\""; tDevice.IoType = "Input/Output"; pAList.push_back(tDevice); }
void MediaSourceOss::getAudioDevices(AudioDevices &pAList) { static bool tFirstCall = true; AudioDeviceDescriptor tDevice; string tDeviceFile; FILE *tFile; #ifdef MSO_DEBUG_PACKETS tFirstCall = true; #endif if (tFirstCall) LOG(LOG_VERBOSE, "Enumerating hardware.."); for (int tDeviceId = -1; tDeviceId < 10; tDeviceId++) { tDeviceFile = "/dev/dsp"; if (tDeviceId != -1) tDeviceFile += char(tDeviceId + 48); if (((tFile = fopen(tDeviceFile.c_str(), "r")) != NULL) && (fclose(tFile) != EOF)) { tDevice.Name = "OSS device "; if (tDeviceId != -1) tDevice.Name += char(tDeviceId + 48); tDevice.Card = tDeviceFile; tDevice.Desc = "oss based audio device"; tDevice.IoType = "Input/Output"; if (tFirstCall) LOG(LOG_VERBOSE, "Found OSS audio device: %s", tDevice.Name.c_str()); // add this device to the result list pAList.push_back(tDevice); } } tFirstCall = false; }
void MediaSourcePortAudio::getAudioDevices(AudioDevices &pAList) { static bool tFirstCall = true; AudioDeviceDescriptor tDevice; PaStreamParameters inputParameters, outputParameters; #ifdef MSCA_DEBUG_PACKETS tFirstCall = true; #endif int tDevCount = Pa_GetDeviceCount(); if (tFirstCall) { LOG(LOG_VERBOSE, "Enumerating hardware.."); LOG(LOG_VERBOSE, "PortAudio version \"%s\"(%d)", Pa_GetVersionText(), Pa_GetVersion()); LOG(LOG_VERBOSE, "Detected %d audio devices", tDevCount); } for (int i = 0; i < tDevCount; i++) { const PaDeviceInfo *tDeviceInfo = Pa_GetDeviceInfo(i); tDevice.Name = string(tDeviceInfo->name); tDevice.Card = char(i + 48); if(tDeviceInfo->maxInputChannels) tDevice.IoType = "Input"; if(tDeviceInfo->maxOutputChannels) tDevice.IoType = "Output"; if((tDeviceInfo->maxInputChannels) && (tDeviceInfo->maxOutputChannels)) tDevice.IoType = "Input/Outputs"; tDevice.Desc = string(Pa_GetHostApiInfo( tDeviceInfo->hostApi)->name) + " based audio device"; // if device is able to capture samples with 44.1 kHz add this device to the result list if ((tDevice.IoType.find("Input") != string::npos) && (tDeviceInfo->defaultSampleRate == 44100.0)) { tDevice.Type = Microphone; pAList.push_back(tDevice); } if (tFirstCall) { LOG(LOG_VERBOSE, "Device %d.. %s", i, (tDeviceInfo->defaultSampleRate == 44100.0) ? " " : "[unsupported, sample rate must be 44.1 kHz]"); // mark global and API specific default devices if (i == Pa_GetDefaultInputDevice()) { LOG(LOG_VERBOSE, "..is DEFAULT INPUT device"); } else { if (i == Pa_GetHostApiInfo(tDeviceInfo->hostApi)->defaultInputDevice) { const PaHostApiInfo *tHostApiInfo = Pa_GetHostApiInfo(tDeviceInfo->hostApi); LOG(LOG_VERBOSE, "..default %s input", tHostApiInfo->name ); } } if (i == Pa_GetDefaultOutputDevice()) { LOG(LOG_VERBOSE, "..is DEFAULT OUTPUT device"); } else { if (i == Pa_GetHostApiInfo(tDeviceInfo->hostApi)->defaultOutputDevice) { const PaHostApiInfo *tHostApiInfo = Pa_GetHostApiInfo(tDeviceInfo->hostApi); LOG(LOG_VERBOSE, "..default %s output", tHostApiInfo->name ); } } // print device info fields LOG(LOG_VERBOSE, "..name: \"%s\"", tDeviceInfo->name); LOG(LOG_VERBOSE, "..host API: \"%s\"", Pa_GetHostApiInfo( tDeviceInfo->hostApi)->name); LOG(LOG_VERBOSE, "..max. inputs channels: %d", tDeviceInfo->maxInputChannels); LOG(LOG_VERBOSE, "..max. outputs channels: %d", tDeviceInfo->maxOutputChannels); LOG(LOG_VERBOSE, "..default low input latency : %8.4f seconds", tDeviceInfo->defaultLowInputLatency); LOG(LOG_VERBOSE, "..default low output latency : %8.4f seconds", tDeviceInfo->defaultLowOutputLatency); LOG(LOG_VERBOSE, "..default high input latency : %8.4f seconds", tDeviceInfo->defaultHighInputLatency); LOG(LOG_VERBOSE, "..default high output latency: %8.4f seconds", tDeviceInfo->defaultHighOutputLatency); LOG(LOG_VERBOSE, "..default sample rate: %8.0f Hz", tDeviceInfo->defaultSampleRate); } } tFirstCall = false; }
void MediaSourceMMSys::getAudioDevices(AudioDevices &pAList) { static bool tFirstCall = true; AudioDeviceDescriptor tDevice; WAVEINCAPS tCaps; UINT tCapsSize = sizeof(tCaps); #ifdef MMSYS_DEBUG_PACKETS tFirstCall = true; #endif if (tFirstCall) LOG(LOG_VERBOSE, "Enumerating hardware.."); MMRESULT tRes; for (UINT i = 0; i < 20; i++) { if (waveInGetDevCaps(i, (LPWAVEINCAPS)&tCaps, tCapsSize) == MMSYSERR_NOERROR) { tDevice.Name = string(tCaps.szPname); tDevice.Card = (char)i + 48; tDevice.Desc = "Windows multimedia system (MMSYS) audio device " + tDevice.Card + " \"" + string(tCaps.szPname) + "\""; if (tFirstCall) { LOG(LOG_INFO, "Found active MMSystem device %d", i); LOG(LOG_INFO, " ..manufacturer identifier: %d", (int)tCaps.wMid); LOG(LOG_INFO, " ..product identifier: %d", (int)tCaps.wPid); LOG(LOG_INFO, " ..driver version: 0x%04X", (int)tCaps.vDriverVersion); LOG(LOG_INFO, " ..product name: %s", (int)tCaps.szPname); LOG(LOG_INFO, " ..channels: %d", (int)tCaps.wChannels); if (tCaps.dwFormats & WAVE_FORMAT_1M08) LOG(LOG_INFO, " ..supporting 11.025 kHz, mono, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_1M16) LOG(LOG_INFO, " ..supporting 11.025 kHz, mono, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_1S08) LOG(LOG_INFO, " ..supporting 11.025 kHz, stereo, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_1S16) LOG(LOG_INFO, " ..supporting 11.025 kHz, stereo, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_2M08) LOG(LOG_INFO, " ..supporting 22.05 kHz, mono, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_2M16) LOG(LOG_INFO, " ..supporting 22.05 kHz, mono, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_2S08) LOG(LOG_INFO, " ..supporting 22.05 kHz, stereo, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_2S16) LOG(LOG_INFO, " ..supporting 22.05 kHz, stereo, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_4M08) LOG(LOG_INFO, " ..supporting 44.1 kHz, mono, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_4M16) LOG(LOG_INFO, " ..supporting 44.1 kHz, mono, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_4S08) LOG(LOG_INFO, " ..supporting 44.1 kHz, stereo, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_4S16) LOG(LOG_INFO, " ..supporting 44.1 kHz, stereo, 16-bit"); /* if (tCaps.dwFormats & WAVE_FORMAT_48M08) LOG(LOG_INFO, " ..supporting 48 kHz, mono, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_48M16) LOG(LOG_INFO, " ..supporting 48 kHz, mono, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_48S08) LOG(LOG_INFO, " ..supporting 48 kHz, stereo, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_48S16) LOG(LOG_INFO, " ..supporting 48 kHz, stereo, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_96M08) LOG(LOG_INFO, " ..supporting 96 kHz, mono, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_96M16) LOG(LOG_INFO, " ..supporting 96 kHz, mono, 16-bit"); if (tCaps.dwFormats & WAVE_FORMAT_96S08) LOG(LOG_INFO, " ..supporting 96 kHz, stereo, 8-bit"); if (tCaps.dwFormats & WAVE_FORMAT_96S16) LOG(LOG_INFO, " ..supporting 96 kHz, stereo, 16-bit"); */ LOG(LOG_VERBOSE, "Found audio capture device: %s (card: %s)", tDevice.Name.c_str(), tDevice.Card.c_str()); } pAList.push_back(tDevice); }else break; } tFirstCall = false; }