mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-26 17:58:43 -05:00
UDP source: move audio input setting to immediate group
This commit is contained in:
parent
08a3bc9097
commit
f69264ec24
@ -93,24 +93,24 @@ void UDPSrc::configure(MessageQueue* messageQueue,
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive)
|
||||
int audioPort)
|
||||
{
|
||||
Message* cmd = MsgUDPSrcConfigure::create(sampleFormat,
|
||||
outputSampleRate,
|
||||
rfBandwidth,
|
||||
udpAddress,
|
||||
udpPort,
|
||||
audioPort,
|
||||
audioActive);
|
||||
audioPort);
|
||||
messageQueue->push(cmd);
|
||||
}
|
||||
|
||||
void UDPSrc::configureImmediate(MessageQueue* messageQueue,
|
||||
bool audioActive,
|
||||
int boost,
|
||||
int volume)
|
||||
{
|
||||
Message* cmd = MsgUDPSrcConfigureImmediate::create(
|
||||
audioActive,
|
||||
boost,
|
||||
volume);
|
||||
messageQueue->push(cmd);
|
||||
@ -251,6 +251,21 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
|
||||
m_settingsMutex.lock();
|
||||
|
||||
if (cfg.getAudioActive() != m_audioActive)
|
||||
{
|
||||
m_audioActive = cfg.getAudioActive();
|
||||
|
||||
if (m_audioActive)
|
||||
{
|
||||
m_audioBufferFill = 0;
|
||||
DSPEngine::instance()->addAudioSink(&m_audioFifo);
|
||||
}
|
||||
else
|
||||
{
|
||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
}
|
||||
}
|
||||
|
||||
if (cfg.getBoost() != m_boost)
|
||||
{
|
||||
m_boost = cfg.getBoost();
|
||||
@ -264,6 +279,7 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
qDebug() << "UDPSrc::handleMessage: MsgUDPSrcConfigureImmediate: "
|
||||
<< " m_audioActive: " << m_audioActive
|
||||
<< " m_boost: " << m_boost
|
||||
<< " m_volume: " << m_volume;
|
||||
|
||||
@ -320,21 +336,6 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
UDPFilter->create_filter(0.0, m_rfBandwidth / 2.0 / m_outputSampleRate);
|
||||
}
|
||||
|
||||
if (cfg.getAudioActive() != m_audioActive)
|
||||
{
|
||||
m_audioActive = cfg.getAudioActive();
|
||||
|
||||
if (m_audioActive)
|
||||
{
|
||||
m_audioBufferFill = 0;
|
||||
DSPEngine::instance()->addAudioSink(&m_audioFifo);
|
||||
}
|
||||
else
|
||||
{
|
||||
DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
}
|
||||
}
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
qDebug() << "UDPSrc::handleMessage: MsgUDPSrcConfigure: m_sampleFormat: " << m_sampleFormat
|
||||
@ -343,8 +344,7 @@ bool UDPSrc::handleMessage(const Message& cmd)
|
||||
<< " m_boost: " << m_boost
|
||||
<< " m_udpAddress: " << cfg.getUDPAddress()
|
||||
<< " m_udpPort: " << m_udpPort
|
||||
<< " m_audioPort: " << m_audioPort
|
||||
<< " m_audioActive: " << m_audioActive;
|
||||
<< " m_audioPort: " << m_audioPort;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -43,9 +43,9 @@ public:
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive);
|
||||
int audioPort);
|
||||
void configureImmediate(MessageQueue* messageQueue,
|
||||
bool audioActive,
|
||||
int boost,
|
||||
int volume);
|
||||
void setSpectrum(MessageQueue* messageQueue, bool enabled);
|
||||
@ -70,7 +70,6 @@ protected:
|
||||
const QString& getUDPAddress() const { return m_udpAddress; }
|
||||
int getUDPPort() const { return m_udpPort; }
|
||||
int getAudioPort() const { return m_audioPort; }
|
||||
bool getAudioActive() const { return m_audioActive; }
|
||||
|
||||
static MsgUDPSrcConfigure* create(SampleFormat
|
||||
sampleFormat,
|
||||
@ -78,16 +77,14 @@ protected:
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive)
|
||||
int audioPort)
|
||||
{
|
||||
return new MsgUDPSrcConfigure(sampleFormat,
|
||||
sampleRate,
|
||||
rfBandwidth,
|
||||
udpAddress,
|
||||
udpPort,
|
||||
audioPort,
|
||||
audioActive);
|
||||
audioPort);
|
||||
}
|
||||
|
||||
private:
|
||||
@ -97,23 +94,20 @@ protected:
|
||||
QString m_udpAddress;
|
||||
int m_udpPort;
|
||||
int m_audioPort;
|
||||
bool m_audioActive;
|
||||
|
||||
MsgUDPSrcConfigure(SampleFormat sampleFormat,
|
||||
Real outputSampleRate,
|
||||
Real rfBandwidth,
|
||||
QString& udpAddress,
|
||||
int udpPort,
|
||||
int audioPort,
|
||||
bool audioActive) :
|
||||
int audioPort) :
|
||||
Message(),
|
||||
m_sampleFormat(sampleFormat),
|
||||
m_outputSampleRate(outputSampleRate),
|
||||
m_rfBandwidth(rfBandwidth),
|
||||
m_udpAddress(udpAddress),
|
||||
m_udpPort(udpPort),
|
||||
m_audioPort(audioPort),
|
||||
m_audioActive(audioActive)
|
||||
m_audioPort(audioPort)
|
||||
{ }
|
||||
};
|
||||
|
||||
@ -123,12 +117,15 @@ protected:
|
||||
public:
|
||||
int getBoost() const { return m_boost; }
|
||||
int getVolume() const { return m_volume; }
|
||||
bool getAudioActive() const { return m_audioActive; }
|
||||
|
||||
static MsgUDPSrcConfigureImmediate* create(
|
||||
bool audioActive,
|
||||
int boost,
|
||||
int volume)
|
||||
{
|
||||
return new MsgUDPSrcConfigureImmediate(
|
||||
audioActive,
|
||||
boost,
|
||||
volume);
|
||||
}
|
||||
@ -136,11 +133,14 @@ protected:
|
||||
private:
|
||||
int m_boost;
|
||||
int m_volume;
|
||||
bool m_audioActive;
|
||||
|
||||
MsgUDPSrcConfigureImmediate(
|
||||
bool audioActive,
|
||||
int boost,
|
||||
int volume) :
|
||||
Message(),
|
||||
m_audioActive(audioActive),
|
||||
m_boost(boost),
|
||||
m_volume(volume)
|
||||
{ }
|
||||
|
@ -246,10 +246,12 @@ void UDPSrcGUI::applySettingsImmediate()
|
||||
{
|
||||
if (m_doApplySettings)
|
||||
{
|
||||
m_audioActive = ui->audioActive->isChecked();
|
||||
m_boost = ui->boost->value();
|
||||
m_volume = ui->volume->value();
|
||||
|
||||
m_udpSrc->configureImmediate(m_udpSrc->getInputMessageQueue(),
|
||||
m_audioActive,
|
||||
m_boost,
|
||||
m_volume);
|
||||
}
|
||||
@ -293,7 +295,6 @@ void UDPSrcGUI::applySettings()
|
||||
}
|
||||
|
||||
int boost = ui->boost->value();
|
||||
bool audioActive = ui->audioActive->isChecked();
|
||||
|
||||
setTitleColor(m_channelMarker.getColor());
|
||||
ui->deltaFrequency->setValue(abs(m_channelMarker.getCenterFrequency()));
|
||||
@ -337,7 +338,6 @@ void UDPSrcGUI::applySettings()
|
||||
m_udpPort = udpPort;
|
||||
m_audioPort = audioPort;
|
||||
m_boost = boost;
|
||||
m_audioActive = audioActive;
|
||||
|
||||
m_udpSrc->configure(m_udpSrc->getInputMessageQueue(),
|
||||
sampleFormat,
|
||||
@ -345,8 +345,7 @@ void UDPSrcGUI::applySettings()
|
||||
rfBandwidth,
|
||||
m_udpAddress,
|
||||
udpPort,
|
||||
audioPort,
|
||||
audioActive);
|
||||
audioPort);
|
||||
|
||||
ui->applyBtn->setEnabled(false);
|
||||
}
|
||||
@ -404,7 +403,7 @@ void UDPSrcGUI::on_applyBtn_clicked()
|
||||
|
||||
void UDPSrcGUI::on_audioActive_toggled(bool active)
|
||||
{
|
||||
ui->applyBtn->setEnabled(true);
|
||||
applySettingsImmediate();
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_boost_valueChanged(int value)
|
||||
|
Loading…
Reference in New Issue
Block a user