mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-24 10:50:29 -05:00
UDP source: implemented mono/stereo audio input toggle
This commit is contained in:
parent
f69264ec24
commit
f8c36546b0
@ -106,11 +106,13 @@ void UDPSrc::configure(MessageQueue* messageQueue,
|
||||
|
||||
void UDPSrc::configureImmediate(MessageQueue* messageQueue,
|
||||
bool audioActive,
|
||||
bool audioStereo,
|
||||
int boost,
|
||||
int volume)
|
||||
{
|
||||
Message* cmd = MsgUDPSrcConfigureImmediate::create(
|
||||
audioActive,
|
||||
audioStereo,
|
||||
boost,
|
||||
volume);
|
||||
messageQueue->push(cmd);
|
||||
@ -266,6 +268,11 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.getAudioStereo() != m_audioStereo)
|
||||
{
|
||||
m_audioStereo = cfg.getAudioStereo();
|
||||
}
|
||||
|
||||
if (cfg.getBoost() != m_boost)
|
||||
{
|
||||
m_boost = cfg.getBoost();
|
||||
@ -280,6 +287,7 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
|
||||
qDebug() << "UDPSrc::handleMessage: MsgUDPSrcConfigureImmediate: "
|
||||
<< " m_audioActive: " << m_audioActive
|
||||
<< " m_audioStereo: " << m_audioStereo
|
||||
<< " m_boost: " << m_boost
|
||||
<< " m_volume: " << m_volume;
|
||||
|
||||
|
@ -46,6 +46,7 @@ public:
|
||||
int audioPort);
|
||||
void configureImmediate(MessageQueue* messageQueue,
|
||||
bool audioActive,
|
||||
bool audioStereo,
|
||||
int boost,
|
||||
int volume);
|
||||
void setSpectrum(MessageQueue* messageQueue, bool enabled);
|
||||
@ -118,14 +119,17 @@ protected:
|
||||
int getBoost() const { return m_boost; }
|
||||
int getVolume() const { return m_volume; }
|
||||
bool getAudioActive() const { return m_audioActive; }
|
||||
bool getAudioStereo() const { return m_audioStereo; }
|
||||
|
||||
static MsgUDPSrcConfigureImmediate* create(
|
||||
bool audioActive,
|
||||
bool audioStereo,
|
||||
int boost,
|
||||
int volume)
|
||||
{
|
||||
return new MsgUDPSrcConfigureImmediate(
|
||||
audioActive,
|
||||
audioStereo,
|
||||
boost,
|
||||
volume);
|
||||
}
|
||||
@ -134,13 +138,16 @@ protected:
|
||||
int m_boost;
|
||||
int m_volume;
|
||||
bool m_audioActive;
|
||||
bool m_audioStereo;
|
||||
|
||||
MsgUDPSrcConfigureImmediate(
|
||||
bool audioActive,
|
||||
bool audioStereo,
|
||||
int boost,
|
||||
int volume) :
|
||||
Message(),
|
||||
m_audioActive(audioActive),
|
||||
m_audioStereo(audioStereo),
|
||||
m_boost(boost),
|
||||
m_volume(volume)
|
||||
{ }
|
||||
|
@ -58,6 +58,7 @@ void UDPSrcGUI::resetToDefaults()
|
||||
ui->boost->setValue(1);
|
||||
ui->volume->setValue(20);
|
||||
ui->audioActive->setChecked(false);
|
||||
ui->audioStereo->setChecked(false);
|
||||
|
||||
blockApplySettings(false);
|
||||
applySettingsImmediate();
|
||||
@ -80,6 +81,7 @@ QByteArray UDPSrcGUI::serialize() const
|
||||
s.writeBool(11, m_audioActive);
|
||||
s.writeS32(12, (qint32)m_volume);
|
||||
s.writeS32(13, m_audioPort);
|
||||
s.writeBool(14, m_audioStereo);
|
||||
return s.final();
|
||||
}
|
||||
|
||||
@ -143,6 +145,8 @@ bool UDPSrcGUI::deserialize(const QByteArray& data)
|
||||
ui->volume->setValue(s32tmp);
|
||||
d.readS32(13, &s32tmp, 9998);
|
||||
ui->audioPort->setText(QString("%1").arg(s32tmp));
|
||||
d.readBool(14, &booltmp, false);
|
||||
ui->audioStereo->setChecked(booltmp);
|
||||
|
||||
blockApplySettings(false);
|
||||
m_channelMarker.blockSignals(false);
|
||||
@ -247,11 +251,13 @@ void UDPSrcGUI::applySettingsImmediate()
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
m_audioActive = ui->audioActive->isChecked();
|
||||
m_audioStereo = ui->audioStereo->isChecked();
|
||||
m_boost = ui->boost->value();
|
||||
m_volume = ui->volume->value();
|
||||
|
||||
m_udpSrc->configureImmediate(m_udpSrc->getInputMessageQueue(),
|
||||
m_audioActive,
|
||||
m_audioStereo,
|
||||
m_boost,
|
||||
m_volume);
|
||||
}
|
||||
@ -406,6 +412,11 @@ void UDPSrcGUI::on_audioActive_toggled(bool active)
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_audioStereo_toggled(bool stereo)
|
||||
{
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_boost_valueChanged(int value)
|
||||
{
|
||||
ui->boost->setValue(value);
|
||||
|
@ -48,6 +48,7 @@ private slots:
|
||||
void on_udpPort_textEdited(const QString& arg1);
|
||||
void on_audioPort_textEdited(const QString& arg1);
|
||||
void on_audioActive_toggled(bool active);
|
||||
void on_audioStereo_toggled(bool stereo);
|
||||
void on_applyBtn_clicked();
|
||||
void onWidgetRolled(QWidget* widget, bool rollDown);
|
||||
void onMenuDoubleClicked();
|
||||
@ -68,6 +69,7 @@ private:
|
||||
Real m_rfBandwidth;
|
||||
int m_boost;
|
||||
bool m_audioActive;
|
||||
bool m_audioStereo;
|
||||
int m_volume;
|
||||
QString m_udpAddress;
|
||||
int m_udpPort;
|
||||
|
@ -354,6 +354,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="audioStereo">
|
||||
<property name="toolTip">
|
||||
<string>Toggle mono/stereo audio input</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../../../sdrbase/resources/res.qrc">
|
||||
<normaloff>:/mono.png</normaloff>
|
||||
<normalon>:/stereo.png</normalon>:/mono.png</iconset>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
@ -371,6 +389,9 @@
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Apply text input and/or samples format</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Apply</string>
|
||||
</property>
|
||||
|
Loading…
Reference in New Issue
Block a user