提交 9354a00e 编写于 作者: D dev@win10Host.com

解决 soundcard 输入只能采用系统默认设备的问题。

上级 83fb4320
......@@ -106,18 +106,6 @@ void DialogSoundCard::InitMonitor()
mFormatSound.setSampleFormat(QAudioFormat::Int16); //set sample sze to 16 bit
mFormatSound.setSampleRate(ui->spinbox_sprate->value());
mFormatSound.setChannelCount(ui->spinbox_channels->value());
QAudioDevice infoIn;
if (ui->comboBox_audioDevices->currentIndex()>=0 &&
ui->comboBox_audioDevices->currentIndex()<m_devInputModule->rowCount())
infoIn = m_devInputlist[ui->comboBox_audioDevices->currentIndex()];
else
infoIn = QMediaDevices::defaultAudioInput();
if (!infoIn.isFormatSupported(mFormatSound))
{
//Default format not supported - trying to use nearest
mFormatSound = infoIn.preferredFormat();
}
CreateAudioInput();
mpInputDevSound = mpAudioInputSound->start();
......@@ -133,8 +121,19 @@ void DialogSoundCard::CreateAudioInput()
disconnect(mpInputDevSound, 0, this, 0);
mpInputDevSound = 0;
}
QAudioDevice infoIn;
if (ui->comboBox_audioDevices->currentIndex()>=0 &&
ui->comboBox_audioDevices->currentIndex()<m_devInputModule->rowCount())
infoIn = m_devInputlist[ui->comboBox_audioDevices->currentIndex()];
else
infoIn = QMediaDevices::defaultAudioInput();
if (!infoIn.isFormatSupported(mFormatSound))
{
//Default format not supported - trying to use nearest
mFormatSound = infoIn.preferredFormat();
}
QAudioDevice inputDevice(QMediaDevices::defaultAudioInput());
QAudioDevice inputDevice(infoIn);
mpAudioInputSound = new QAudioSource(inputDevice, mFormatSound, this);
//Broadcast sample rates
TASKBUS::push_subject(0xffffffff,0,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册