mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-23 00:18:37 -05:00
UDP Sink: use settings in GUI (1)
This commit is contained in:
parent
ad981241d0
commit
83228c9bca
@ -433,7 +433,7 @@ bool UDPSink::handleMessage(const Message& cmd)
|
|||||||
|
|
||||||
void UDPSink::configure(MessageQueue* messageQueue,
|
void UDPSink::configure(MessageQueue* messageQueue,
|
||||||
UDPSinkSettings::SampleFormat sampleFormat,
|
UDPSinkSettings::SampleFormat sampleFormat,
|
||||||
Real outputSampleRate,
|
Real inputSampleRate,
|
||||||
Real rfBandwidth,
|
Real rfBandwidth,
|
||||||
int fmDeviation,
|
int fmDeviation,
|
||||||
Real amModFactor,
|
Real amModFactor,
|
||||||
@ -450,7 +450,7 @@ void UDPSink::configure(MessageQueue* messageQueue,
|
|||||||
bool force)
|
bool force)
|
||||||
{
|
{
|
||||||
Message* cmd = MsgUDPSinkConfigure::create(sampleFormat,
|
Message* cmd = MsgUDPSinkConfigure::create(sampleFormat,
|
||||||
outputSampleRate,
|
inputSampleRate,
|
||||||
rfBandwidth,
|
rfBandwidth,
|
||||||
fmDeviation,
|
fmDeviation,
|
||||||
amModFactor,
|
amModFactor,
|
||||||
|
@ -101,8 +101,7 @@ private:
|
|||||||
bool getStereoInput() const { return m_stereoInput; }
|
bool getStereoInput() const { return m_stereoInput; }
|
||||||
|
|
||||||
static MsgUDPSinkConfigure* create(
|
static MsgUDPSinkConfigure* create(
|
||||||
UDPSinkSettings::SampleFormat
|
UDPSinkSettings::SampleFormat sampleFormat,
|
||||||
sampleFormat,
|
|
||||||
Real inputSampleRate,
|
Real inputSampleRate,
|
||||||
Real rfBandwidth,
|
Real rfBandwidth,
|
||||||
int fmDeviation,
|
int fmDeviation,
|
||||||
|
@ -81,8 +81,8 @@ QByteArray UDPSinkGUI::serialize() const
|
|||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
s.writeS32(2, m_channelMarker.getCenterFrequency());
|
s.writeS32(2, m_channelMarker.getCenterFrequency());
|
||||||
s.writeS32(3, m_sampleFormat);
|
s.writeS32(3, m_sampleFormat);
|
||||||
s.writeReal(4, m_inputSampleRate);
|
s.writeReal(4, m_settings.m_inputSampleRate);
|
||||||
s.writeReal(5, m_rfBandwidth);
|
s.writeReal(5, m_settings.m_rfBandwidth);
|
||||||
s.writeBlob(6, m_channelMarker.serialize());
|
s.writeBlob(6, m_channelMarker.serialize());
|
||||||
s.writeBlob(7, ui->spectrumGUI->serialize());
|
s.writeBlob(7, ui->spectrumGUI->serialize());
|
||||||
s.writeS32(10, ui->gainOut->value());
|
s.writeS32(10, ui->gainOut->value());
|
||||||
@ -129,9 +129,9 @@ bool UDPSinkGUI::deserialize(const QByteArray& data)
|
|||||||
ui->sampleFormat->setCurrentIndex(((int) UDPSinkSettings::FormatNone) - 1);
|
ui->sampleFormat->setCurrentIndex(((int) UDPSinkSettings::FormatNone) - 1);
|
||||||
}
|
}
|
||||||
d.readReal(4, &realtmp, 48000);
|
d.readReal(4, &realtmp, 48000);
|
||||||
ui->sampleRate->setText(QString("%1").arg(realtmp, 0));
|
m_settings.m_inputSampleRate = realtmp;
|
||||||
d.readReal(5, &realtmp, 32000);
|
d.readReal(5, &realtmp, 32000);
|
||||||
ui->rfBandwidth->setText(QString("%1").arg(realtmp, 0));
|
m_settings.m_rfBandwidth = realtmp;
|
||||||
d.readBlob(7, &bytetmp);
|
d.readBlob(7, &bytetmp);
|
||||||
ui->spectrumGUI->deserialize(bytetmp);
|
ui->spectrumGUI->deserialize(bytetmp);
|
||||||
d.readS32(10, &s32tmp, 10);
|
d.readS32(10, &s32tmp, 10);
|
||||||
@ -268,19 +268,19 @@ void UDPSinkGUI::applySettings(bool force)
|
|||||||
{
|
{
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
Real inputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
// Real inputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
||||||
|
//
|
||||||
if((!ok) || (inputSampleRate < 1000))
|
// if((!ok) || (inputSampleRate < 1000))
|
||||||
{
|
// {
|
||||||
inputSampleRate = 48000;
|
// inputSampleRate = 48000;
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
// Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
||||||
|
//
|
||||||
if((!ok) || (rfBandwidth > inputSampleRate))
|
// if((!ok) || (rfBandwidth > inputSampleRate))
|
||||||
{
|
// {
|
||||||
rfBandwidth = inputSampleRate;
|
// rfBandwidth = inputSampleRate;
|
||||||
}
|
// }
|
||||||
|
|
||||||
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
|
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
|
||||||
|
|
||||||
@ -298,17 +298,17 @@ void UDPSinkGUI::applySettings(bool force)
|
|||||||
|
|
||||||
setTitleColor(m_channelMarker.getColor());
|
setTitleColor(m_channelMarker.getColor());
|
||||||
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
|
||||||
ui->sampleRate->setText(QString("%1").arg(inputSampleRate, 0));
|
// ui->sampleRate->setText(QString("%1").arg(inputSampleRate, 0));
|
||||||
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
|
// ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
|
||||||
ui->fmDeviation->setText(QString("%1").arg(fmDeviation));
|
ui->fmDeviation->setText(QString("%1").arg(fmDeviation));
|
||||||
ui->amModPercent->setText(QString("%1").arg(amModPercent));
|
ui->amModPercent->setText(QString("%1").arg(amModPercent));
|
||||||
m_channelMarker.disconnect(this, SLOT(channelMarkerChanged()));
|
m_channelMarker.disconnect(this, SLOT(channelMarkerChanged()));
|
||||||
m_channelMarker.setBandwidth((int)rfBandwidth);
|
m_channelMarker.setBandwidth((int)m_settings.m_rfBandwidth);
|
||||||
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
|
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
|
||||||
ui->glSpectrum->setSampleRate(inputSampleRate);
|
ui->glSpectrum->setSampleRate(m_settings.m_inputSampleRate);
|
||||||
|
|
||||||
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
||||||
inputSampleRate,
|
m_settings.m_inputSampleRate,
|
||||||
m_channelMarker.getCenterFrequency());
|
m_channelMarker.getCenterFrequency());
|
||||||
|
|
||||||
UDPSinkSettings::SampleFormat sampleFormat;
|
UDPSinkSettings::SampleFormat sampleFormat;
|
||||||
@ -350,14 +350,14 @@ void UDPSinkGUI::applySettings(bool force)
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_sampleFormat = sampleFormat;
|
m_sampleFormat = sampleFormat;
|
||||||
m_inputSampleRate = inputSampleRate;
|
// m_inputSampleRate = inputSampleRate;
|
||||||
m_rfBandwidth = rfBandwidth;
|
// m_rfBandwidth = rfBandwidth;
|
||||||
m_fmDeviation = fmDeviation;
|
m_fmDeviation = fmDeviation;
|
||||||
|
|
||||||
m_udpSink->configure(m_udpSink->getInputMessageQueue(),
|
m_udpSink->configure(m_udpSink->getInputMessageQueue(),
|
||||||
sampleFormat,
|
sampleFormat,
|
||||||
inputSampleRate,
|
m_settings.m_inputSampleRate,
|
||||||
rfBandwidth,
|
m_settings.m_rfBandwidth,
|
||||||
fmDeviation,
|
fmDeviation,
|
||||||
amModPercent / 100.0f,
|
amModPercent / 100.0f,
|
||||||
m_channelMarker.getUDPAddress(),
|
m_channelMarker.getUDPAddress(),
|
||||||
@ -379,6 +379,8 @@ void UDPSinkGUI::applySettings(bool force)
|
|||||||
|
|
||||||
void UDPSinkGUI::displaySettings()
|
void UDPSinkGUI::displaySettings()
|
||||||
{
|
{
|
||||||
|
ui->sampleRate->setText(QString("%1").arg(m_settings.m_inputSampleRate, 0));
|
||||||
|
ui->rfBandwidth->setText(QString("%1").arg(m_settings.m_rfBandwidth, 0));
|
||||||
ui->gainInText->setText(tr("%1").arg(ui->gainIn->value()/10.0, 0, 'f', 1));
|
ui->gainInText->setText(tr("%1").arg(ui->gainIn->value()/10.0, 0, 'f', 1));
|
||||||
ui->gainOutText->setText(tr("%1").arg(ui->gainOut->value()/10.0, 0, 'f', 1));
|
ui->gainOutText->setText(tr("%1").arg(ui->gainOut->value()/10.0, 0, 'f', 1));
|
||||||
ui->squelchText->setText(tr("%1").arg(ui->squelch->value()*1.0, 0, 'f', 0));
|
ui->squelchText->setText(tr("%1").arg(ui->squelch->value()*1.0, 0, 'f', 0));
|
||||||
@ -418,12 +420,32 @@ void UDPSinkGUI::on_sampleFormat_currentIndexChanged(int index)
|
|||||||
|
|
||||||
void UDPSinkGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
void UDPSinkGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
bool ok;
|
||||||
|
Real inputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
||||||
|
|
||||||
|
if ((!ok) || (inputSampleRate < 1000)) {
|
||||||
|
m_settings.m_inputSampleRate = 48000;
|
||||||
|
ui->sampleRate->setText(QString("%1").arg(m_settings.m_inputSampleRate, 0));
|
||||||
|
} else {
|
||||||
|
m_settings.m_inputSampleRate = inputSampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
ui->applyBtn->setEnabled(true);
|
ui->applyBtn->setEnabled(true);
|
||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UDPSinkGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
void UDPSinkGUI::on_rfBandwidth_textEdited(const QString& arg1 __attribute__((unused)))
|
||||||
{
|
{
|
||||||
|
bool ok;
|
||||||
|
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
||||||
|
|
||||||
|
if ((!ok) || (rfBandwidth > m_settings.m_inputSampleRate)) {
|
||||||
|
m_settings.m_rfBandwidth = m_settings.m_inputSampleRate;
|
||||||
|
ui->rfBandwidth->setText(QString("%1").arg(m_settings.m_rfBandwidth, 0));
|
||||||
|
} else {
|
||||||
|
m_settings.m_rfBandwidth = rfBandwidth;
|
||||||
|
}
|
||||||
|
|
||||||
ui->applyBtn->setEnabled(true);
|
ui->applyBtn->setEnabled(true);
|
||||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||||
}
|
}
|
||||||
|
@ -95,8 +95,8 @@ private:
|
|||||||
// settings
|
// settings
|
||||||
UDPSinkSettings m_settings;
|
UDPSinkSettings m_settings;
|
||||||
UDPSinkSettings::SampleFormat m_sampleFormat;
|
UDPSinkSettings::SampleFormat m_sampleFormat;
|
||||||
Real m_inputSampleRate;
|
// Real m_inputSampleRate;
|
||||||
Real m_rfBandwidth;
|
// Real m_rfBandwidth;
|
||||||
int m_fmDeviation;
|
int m_fmDeviation;
|
||||||
bool m_doApplySettings;
|
bool m_doApplySettings;
|
||||||
MessageQueue m_inputMessageQueue;
|
MessageQueue m_inputMessageQueue;
|
||||||
|
Loading…
Reference in New Issue
Block a user