提交 dce34bc3 编写于 作者: D dev@dev.com

1.发现Qt5的声卡模块可以设置任意采样率。

2.纠正声卡输出只能使用默认设备的BUG。
上级 c63047f5
......@@ -110,25 +110,19 @@ void DialogSoundCard::InitMonitor()
mFormatSound.setCodec("audio/pcm"); //set codec as simple audio/pcm
mFormatSound.setSampleRate(ui->spinbox_sprate->value());
mFormatSound.setChannelCount(ui->spinbox_channels->value());
QAudioDeviceInfo infoIn;
//QAudioDeviceInfo infoOut(QAudioDeviceInfo::defaultOutputDevice());
QAudioDeviceInfo infoOut;
if (ui->comboBox_audioDevices->currentIndex()>=0 &&
ui->comboBox_audioDevices->currentIndex()<m_devOutputModule->rowCount())
infoIn = m_devOutputlist[ui->comboBox_audioDevices->currentIndex()];
infoOut = m_devOutputlist[ui->comboBox_audioDevices->currentIndex()];
else
infoIn = QAudioDeviceInfo::defaultInputDevice();
if (!infoIn.isFormatSupported(mFormatSound))
{
//Default format not supported - trying to use nearest
mFormatSound = infoIn.nearestFormat(mFormatSound);
}
QAudioDeviceInfo infoOut(QAudioDeviceInfo::defaultOutputDevice());
infoOut = QAudioDeviceInfo::defaultOutputDevice();
if (!infoOut.isFormatSupported(mFormatSound))
{
//Default format not supported - trying to use nearest
mFormatSound = infoOut.nearestFormat(mFormatSound);
//mFormatSound = infoOut.nearestFormat(mFormatSound);
}
CreateAudioOutput();
mpOutDevSound = mpAudioOutputSound->start();
connect(ui->horizontalSlider, SIGNAL(valueChanged(int)),
......
......@@ -118,14 +118,7 @@ void DialogSoundCard::InitMonitor()
if (!infoIn.isFormatSupported(mFormatSound))
{
//Default format not supported - trying to use nearest
mFormatSound = infoIn.nearestFormat(mFormatSound);
}
QAudioDeviceInfo infoOut(QAudioDeviceInfo::defaultOutputDevice());
if (!infoOut.isFormatSupported(mFormatSound))
{
//Default format not supported - trying to use nearest
mFormatSound = infoOut.nearestFormat(mFormatSound);
//mFormatSound = infoIn.nearestFormat(mFormatSound);
}
CreateAudioInput();
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册