kopia lustrzana https://gitlab.com/eliggett/wfview
QT6.2 auto update audio comboboxes
rodzic
1b3edbfec1
commit
cffb2bf93a
|
@ -240,7 +240,6 @@ format.setSampleSize(16);
|
|||
#else
|
||||
audioInput = new QAudioSource(setup.port, format, this);
|
||||
#endif
|
||||
connect(audioInput, SIGNAL(notify()), SLOT(notified()));
|
||||
connect(audioInput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
|
||||
isInitialized = true;
|
||||
}
|
||||
|
@ -256,7 +255,6 @@ format.setSampleSize(16);
|
|||
audioOutput->setBufferSize(chunkSize*4);
|
||||
#endif
|
||||
|
||||
connect(audioOutput, SIGNAL(notify()), SLOT(notified()));
|
||||
connect(audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State)));
|
||||
isInitialized = true;
|
||||
}
|
||||
|
|
19
wfmain.cpp
19
wfmain.cpp
|
@ -56,6 +56,11 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s
|
|||
|
||||
setSerialDevicesUI();
|
||||
|
||||
#if QT_VERSION >= 0x060000
|
||||
connect(&mediaDevices, &QMediaDevices::audioInputsChanged, this, &wfmain::setAudioDevicesUI);
|
||||
connect(&mediaDevices, &QMediaDevices::audioOutputsChanged, this, &wfmain::setAudioDevicesUI);
|
||||
#endif
|
||||
|
||||
setAudioDevicesUI();
|
||||
|
||||
setDefaultColors();
|
||||
|
@ -1045,19 +1050,13 @@ void wfmain::setAudioDevicesUI()
|
|||
#else
|
||||
// If no external library is configured, use QTMultimedia
|
||||
// Enumerate audio devices, need to do before settings are loaded.
|
||||
QMediaDevices devices;
|
||||
connect(&devices, &QMediaDevices::audioInputsChanged,
|
||||
[]() { qDebug() << "available audio inputs have changed"; });
|
||||
|
||||
connect(&devices, &QMediaDevices::audioOutputsChanged,
|
||||
[]() { qDebug() << "available audio ourputs have changed"; });
|
||||
|
||||
const auto audioOutputs = QMediaDevices::audioOutputs();
|
||||
ui->audioOutputCombo->clear();
|
||||
const auto audioOutputs = mediaDevices.audioOutputs();
|
||||
for (const QAudioDevice& deviceInfo : audioOutputs) {
|
||||
ui->audioOutputCombo->addItem(deviceInfo.description(), QVariant::fromValue(deviceInfo));
|
||||
}
|
||||
|
||||
const auto audioInputs = QMediaDevices::audioInputs();
|
||||
ui->audioInputCombo->clear();
|
||||
const auto audioInputs = mediaDevices.audioInputs();
|
||||
for (const QAudioDevice& deviceInfo : audioInputs) {
|
||||
ui->audioInputCombo->addItem(deviceInfo.description(), QVariant::fromValue(deviceInfo));
|
||||
}
|
||||
|
|
4
wfmain.h
4
wfmain.h
|
@ -477,6 +477,8 @@ private slots:
|
|||
|
||||
void on_rigctldPortTxt_editingFinished();
|
||||
|
||||
void setAudioDevicesUI();
|
||||
|
||||
private:
|
||||
Ui::wfmain *ui;
|
||||
void closeEvent(QCloseEvent *event);
|
||||
|
@ -562,7 +564,6 @@ private:
|
|||
void setupMainUI();
|
||||
void setUIToPrefs();
|
||||
void setSerialDevicesUI();
|
||||
void setAudioDevicesUI();
|
||||
void setServerToPrefs();
|
||||
void setInitialTiming();
|
||||
void getSettingsFilePath(QString settingsFile);
|
||||
|
@ -812,6 +813,7 @@ private:
|
|||
unsigned int tsWfScrollHz;
|
||||
unsigned int tsKnobHz;
|
||||
|
||||
QMediaDevices mediaDevices;
|
||||
|
||||
SERVERCONFIG serverConfig;
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue