21 #include <QTreeWidgetItem> 22 #include <QMessageBox> 26 #include "ui_audiodialog.h" 30 ui(new
Ui::AudioDialog),
31 m_audioDeviceManager(audioDeviceManager)
34 QTreeWidgetItem* treeItem;
39 QAudioDeviceInfo defaultOutputDeviceInfo = QAudioDeviceInfo::defaultOutputDevice();
40 treeItem =
new QTreeWidgetItem(
ui->audioOutTree);
43 treeItem->setText(0, found ?
"__" :
"_D");
44 ui->audioOutTree->setCurrentItem(treeItem);
48 for(QList<QAudioDeviceInfo>::const_iterator it = outputDevices.begin(); it != outputDevices.end(); ++it)
50 treeItem =
new QTreeWidgetItem(
ui->audioOutTree);
51 treeItem->setText(1, it->deviceName());
52 bool systemDefault = it->deviceName() == defaultOutputDeviceInfo.deviceName();
54 treeItem->setText(0, QString(systemDefault ?
"S" :
"_") + QString(found ?
"_" :
"D"));
57 treeItem->setBackground(1, QBrush(qRgb(96,96,96)));
61 ui->audioOutTree->resizeColumnToContents(0);
62 ui->audioOutTree->resizeColumnToContents(1);
67 QAudioDeviceInfo defaultInputDeviceInfo = QAudioDeviceInfo::defaultInputDevice();
68 treeItem =
new QTreeWidgetItem(
ui->audioInTree);
71 treeItem->setText(0, found ?
"__" :
"_D");
72 ui->audioInTree->setCurrentItem(treeItem);
76 for(QList<QAudioDeviceInfo>::const_iterator it = inputDevices.begin(); it != inputDevices.end(); ++it)
78 treeItem =
new QTreeWidgetItem(
ui->audioInTree);
79 treeItem->setText(1, it->deviceName());
80 bool systemDefault = it->deviceName() == defaultInputDeviceInfo.deviceName();
82 treeItem->setText(0, QString(systemDefault ?
"S" :
"_") + QString(found ?
"_" :
"D"));
85 treeItem->setBackground(1, QBrush(qRgb(96,96,96)));
89 ui->audioInTree->resizeColumnToContents(0);
90 ui->audioInTree->resizeColumnToContents(1);
96 ui->tabWidget->setCurrentIndex(0);
106 m_inIndex =
ui->audioInTree->indexOfTopLevelItem(
ui->audioInTree->currentItem());
107 m_outIndex =
ui->audioOutTree->indexOfTopLevelItem(
ui->audioOutTree->currentItem());
109 if (
ui->tabWidget->currentIndex() == 0)
113 if (
ui->outputResetKey->isChecked()) {
119 else if (
ui->tabWidget->currentIndex() == 1)
123 if (
ui->inputResetKey->isChecked()) {
139 QTreeWidgetItem* currentItem,
140 QTreeWidgetItem* previousItem)
143 QString inDeviceName = currentItem->text(1);
144 int newIndex =
ui->audioInTree->indexOfTopLevelItem(currentItem);
145 int oldIndex =
ui->audioInTree->indexOfTopLevelItem(previousItem);
147 if (newIndex != oldIndex) {
148 ui->inputResetKey->setChecked(
false);
158 QTreeWidgetItem* currentItem,
159 QTreeWidgetItem* previousItem)
162 QString outDeviceName = currentItem->text(1);
163 int newIndex =
ui->audioOutTree->indexOfTopLevelItem(currentItem);
164 int oldIndex =
ui->audioOutTree->indexOfTopLevelItem(previousItem);
166 if (newIndex != oldIndex) {
167 ui->outputResetKey->setChecked(
false);
178 float volume = value / 100.0f;
179 ui->inputVolumeText->setText(QString(
"%1").
arg(volume, 0,
'f', 2));
211 quint16 udpPort =
ui->outputUDPPort->text().toInt(&ok);
213 if((!ok) || (udpPort < 1024)) {
264 ui->outputSampleRate->blockSignals(
true);
265 ui->outputUDPChannelMode->blockSignals(
true);
266 ui->outputUDPChannelCodec->blockSignals(
true);
267 ui->decimationFactor->blockSignals(
true);
280 ui->outputSampleRate->blockSignals(
false);
281 ui->outputUDPChannelMode->blockSignals(
false);
282 ui->outputUDPChannelCodec->blockSignals(
false);
283 ui->decimationFactor->blockSignals(
false);
314 effectiveSampleRate /= 2;
322 effectiveSampleRate = 48000;
330 ui->outputSDPText->setText(tr(
"%1/%2/%3").
arg(format).
arg(effectiveSampleRate).
arg(nChannels));
341 QMessageBox::information(
this, tr(
"Message"), tr(
"PCMA must be 8000 Hz single channel"));
347 QMessageBox::information(
this, tr(
"Message"), tr(
"PCMU must be 8000 Hz single channel"));
353 QMessageBox::information(
this, tr(
"Message"), tr(
"G722 must be 16000 Hz single channel"));
359 if ((effectiveSampleRate != 48000) && (effectiveSampleRate != 24000) && (effectiveSampleRate != 16000) && (effectiveSampleRate != 12000)) {
360 QMessageBox::information(
this, tr(
"Message"), tr(
"Opus takes only 48, 24, 16 or 12 kHz sample rates"));
void on_outputReset_clicked(bool checked)
static const QString m_defaultDeviceName
const QList< QAudioDeviceInfo > & getInputDevices() const
uint32_t udpDecimationFactor
void updateInputDeviceInfo()
void on_outputUDPChannelMode_currentIndexChanged(int index)
void outputInfosCleanup()
Remove output info from map for output devices not present.
AudioDialogX(AudioDeviceManager *audioDeviceManager, QWidget *parent=0)
AudioDeviceManager::OutputDeviceInfo m_outputDeviceInfo
void on_audioInTree_currentItemChanged(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem)
void on_audioOutTree_currentItemChanged(QTreeWidgetItem *currentItem, QTreeWidgetItem *previousItem)
void on_decimationFactor_currentIndexChanged(int index)
AudioOutput::UDPChannelCodec udpChannelCodec
void on_inputReset_clicked(bool checked)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
void on_inputVolume_valueChanged(int value)
void setOutputDeviceInfo(int outputDeviceIndex, const OutputDeviceInfo &deviceInfo)
void on_outputUDPPort_editingFinished()
bool getInputDeviceInfo(const QString &deviceName, InputDeviceInfo &deviceInfo) const
void inputInfosCleanup()
Remove input info from map for input devices not present.
bool getOutputDeviceInfo(const QString &deviceName, OutputDeviceInfo &deviceInfo) const
void updateOutputSDPString()
const QList< QAudioDeviceInfo > & getOutputDevices() const
void unsetInputDeviceInfo(int inputDeviceIndex)
void on_outputSampleRate_valueChanged(int value)
AudioDeviceManager * m_audioDeviceManager
AudioOutput::UDPChannelMode udpChannelMode
void on_inputCleanup_clicked(bool checked)
void updateInputDisplay()
void updateOutputDisplay()
void on_outputCleanup_clicked(bool checked)
void setInputDeviceInfo(int inputDeviceIndex, const InputDeviceInfo &deviceInfo)
void updateOutputDeviceInfo()
void unsetOutputDeviceInfo(int outputDeviceIndex)
AudioDeviceManager::InputDeviceInfo m_inputDeviceInfo
void on_outputUDPChannelCodec_currentIndexChanged(int index)