audioutil.h
#ifndef AUDIOUTIL_H #define AUDIOUTIL_H class AudioUtil { public: AudioUtil(); public: void getDevices(); }; #endif // AUDIOUTIL_H
audioutil.cpp
#include "audioutil.h" #include#include #include AudioUtil::AudioUtil() { } void AudioUtil::getDevices() { //获取输入音频设备名称 QList deviceListIn; QList audioDeviceListIn = QAudioDeviceInfo::availableDevices(QAudio::AudioInput); for(QAudioDeviceInfo devInfo: audioDeviceListIn){ if(devInfo.isNull()){ qWarning()<<"device null"; continue; } QString strName = devInfo.deviceName(); if (strName[0] == 65533){ qWarning()<<"invalid device"; continue; } //避免回同名的音频设备 if(!deviceListIn.contains(strName)){ deviceListIn.append(strName); } } qInfo()<<"audio input device: size="< 欢迎分享,转载请注明来源:内存溢出
评论列表(0条)