mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Audio output device recording: GUI and settings
This commit is contained in:
parent
e319267b0f
commit
e89331f58f
@ -62,7 +62,9 @@ public:
|
||||
udpUseRTP(false),
|
||||
udpChannelMode(AudioOutputDevice::UDPChannelLeft),
|
||||
udpChannelCodec(AudioOutputDevice::UDPCodecL16),
|
||||
udpDecimationFactor(1)
|
||||
udpDecimationFactor(1),
|
||||
recordToFile(false),
|
||||
recordSilenceTime(0)
|
||||
{}
|
||||
void resetToDefaults() {
|
||||
sampleRate = m_defaultAudioSampleRate;
|
||||
@ -73,6 +75,9 @@ public:
|
||||
udpChannelMode = AudioOutputDevice::UDPChannelLeft;
|
||||
udpChannelCodec = AudioOutputDevice::UDPCodecL16;
|
||||
udpDecimationFactor = 1;
|
||||
fileRecordName.clear();
|
||||
recordToFile = false;
|
||||
recordSilenceTime = 0;
|
||||
}
|
||||
int sampleRate;
|
||||
QString udpAddress;
|
||||
@ -82,6 +87,9 @@ public:
|
||||
AudioOutputDevice::UDPChannelMode udpChannelMode;
|
||||
AudioOutputDevice::UDPChannelCodec udpChannelCodec;
|
||||
uint32_t udpDecimationFactor;
|
||||
QString fileRecordName;
|
||||
bool recordToFile;
|
||||
int recordSilenceTime; //!< 100's ms
|
||||
friend QDataStream& operator<<(QDataStream& ds, const OutputDeviceInfo& info);
|
||||
friend QDataStream& operator>>(QDataStream& ds, OutputDeviceInfo& info);
|
||||
};
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QMessageBox>
|
||||
#include <QFileDialog>
|
||||
|
||||
#include "audio/audiodevicemanager.h"
|
||||
#include "audiodialog.h"
|
||||
@ -259,6 +260,44 @@ void AudioDialogX::on_outputUDPChannelMode_currentIndexChanged(int index)
|
||||
check();
|
||||
}
|
||||
|
||||
void AudioDialogX::on_record_toggled(bool checked)
|
||||
{
|
||||
ui->showFileDialog->setEnabled(!checked);
|
||||
m_outputDeviceInfo.recordToFile = checked;
|
||||
}
|
||||
|
||||
void AudioDialogX::on_showFileDialog_clicked(bool checked)
|
||||
{
|
||||
(void) checked;
|
||||
QFileDialog fileDialog(
|
||||
this,
|
||||
tr("Save record file"),
|
||||
m_outputDeviceInfo.fileRecordName,
|
||||
tr("WAV Files (*.wav)")
|
||||
);
|
||||
|
||||
fileDialog.setOptions(QFileDialog::DontUseNativeDialog);
|
||||
fileDialog.setFileMode(QFileDialog::AnyFile);
|
||||
QStringList fileNames;
|
||||
|
||||
if (fileDialog.exec())
|
||||
{
|
||||
fileNames = fileDialog.selectedFiles();
|
||||
|
||||
if (fileNames.size() > 0)
|
||||
{
|
||||
m_outputDeviceInfo.fileRecordName = fileNames.at(0);
|
||||
ui->fileNameText->setText(m_outputDeviceInfo.fileRecordName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AudioDialogX::on_recordSilenceTime_valueChanged(int value)
|
||||
{
|
||||
m_outputDeviceInfo.recordSilenceTime = value;
|
||||
ui->recordSilenceText->setText(tr("%1").arg(value / 10.0, 0, 'f', 1));
|
||||
}
|
||||
|
||||
void AudioDialogX::updateOutputDisplay()
|
||||
{
|
||||
ui->outputSampleRate->blockSignals(true);
|
||||
@ -274,6 +313,11 @@ void AudioDialogX::updateOutputDisplay()
|
||||
ui->outputUDPChannelMode->setCurrentIndex((int) m_outputDeviceInfo.udpChannelMode);
|
||||
ui->outputUDPChannelCodec->setCurrentIndex((int) m_outputDeviceInfo.udpChannelCodec);
|
||||
ui->decimationFactor->setCurrentIndex(m_outputDeviceInfo.udpDecimationFactor == 0 ? 0 : m_outputDeviceInfo.udpDecimationFactor - 1);
|
||||
ui->record->setChecked(m_outputDeviceInfo.recordToFile);
|
||||
ui->fileNameText->setText(m_outputDeviceInfo.fileRecordName);
|
||||
ui->showFileDialog->setEnabled(!m_outputDeviceInfo.recordToFile);
|
||||
ui->recordSilenceTime->setValue(m_outputDeviceInfo.recordSilenceTime);
|
||||
ui->recordSilenceText->setText(tr("%1").arg(m_outputDeviceInfo.recordSilenceTime / 10.0, 0, 'f', 1));
|
||||
|
||||
updateOutputSDPString();
|
||||
|
||||
@ -293,6 +337,9 @@ void AudioDialogX::updateOutputDeviceInfo()
|
||||
m_outputDeviceInfo.udpChannelMode = (AudioOutputDevice::UDPChannelMode) ui->outputUDPChannelMode->currentIndex();
|
||||
m_outputDeviceInfo.udpChannelCodec = (AudioOutputDevice::UDPChannelCodec) ui->outputUDPChannelCodec->currentIndex();
|
||||
m_outputDeviceInfo.udpDecimationFactor = ui->decimationFactor->currentIndex() + 1;
|
||||
m_outputDeviceInfo.recordToFile = ui->record->isChecked();
|
||||
m_outputDeviceInfo.fileRecordName = ui->fileNameText->text();
|
||||
m_outputDeviceInfo.recordSilenceTime = ui->recordSilenceTime->value();
|
||||
}
|
||||
|
||||
void AudioDialogX::updateOutputSDPString()
|
||||
|
@ -52,6 +52,9 @@ private slots:
|
||||
void on_decimationFactor_currentIndexChanged(int index);
|
||||
void on_outputUDPChannelCodec_currentIndexChanged(int index);
|
||||
void on_outputUDPChannelMode_currentIndexChanged(int index);
|
||||
void on_record_toggled(bool checked);
|
||||
void on_showFileDialog_clicked(bool checked);
|
||||
void on_recordSilenceTime_valueChanged(int value);
|
||||
};
|
||||
|
||||
#endif // INCLUDE_AUDIODIALOG_H
|
||||
|
@ -390,6 +390,119 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="fileNameLayout">
|
||||
<item>
|
||||
<widget class="ButtonSwitch" name="record">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start/stop recording</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/record_off.png</normaloff>:/record_off.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="showFileDialog">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources/res.qrc">
|
||||
<normaloff>:/preset-load.png</normaloff>:/preset-load.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="fileNameText">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Current recording file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDial" name="recordSilenceTime">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>24</width>
|
||||
<height>24</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Silence time (s) before recording is stopoed. 0 for continuous recording.</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="pageStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="recordSilenceText">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Silence time (s) before recording is stopoed</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>10.0</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="outputGeneralLayout">
|
||||
<item>
|
||||
|
Loading…
Reference in New Issue
Block a user