2015-12-06 13:47:55 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2015 F4EXB //
|
|
|
|
// written by Edouard Griffiths //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
#include "udpsrcgui.h"
|
|
|
|
|
|
|
|
#include "plugin/pluginapi.h"
|
|
|
|
#include "dsp/threadedsamplesink.h"
|
|
|
|
#include "dsp/channelizer.h"
|
|
|
|
#include "dsp/spectrumvis.h"
|
|
|
|
#include "dsp/dspengine.h"
|
|
|
|
#include "util/simpleserializer.h"
|
|
|
|
#include "util/db.h"
|
|
|
|
#include "gui/basicchannelsettingswidget.h"
|
|
|
|
#include "ui_udpsrcgui.h"
|
|
|
|
#include "mainwindow.h"
|
|
|
|
#include "udpsrc.h"
|
|
|
|
|
|
|
|
UDPSrcGUI* UDPSrcGUI::create(PluginAPI* pluginAPI)
|
|
|
|
{
|
|
|
|
UDPSrcGUI* gui = new UDPSrcGUI(pluginAPI);
|
|
|
|
return gui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::destroy()
|
|
|
|
{
|
|
|
|
delete this;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::setName(const QString& name)
|
|
|
|
{
|
|
|
|
setObjectName(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
qint64 UDPSrcGUI::getCenterFrequency() const
|
|
|
|
{
|
|
|
|
return m_channelMarker.getCenterFrequency();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::setCenterFrequency(qint64 centerFrequency)
|
|
|
|
{
|
|
|
|
m_channelMarker.setCenterFrequency(centerFrequency);
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
QString UDPSrcGUI::getName() const
|
|
|
|
{
|
|
|
|
return objectName();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::resetToDefaults()
|
|
|
|
{
|
|
|
|
blockApplySettings(true);
|
|
|
|
|
|
|
|
ui->sampleFormat->setCurrentIndex(0);
|
|
|
|
ui->sampleRate->setText("48000");
|
|
|
|
ui->rfBandwidth->setText("32000");
|
2016-04-03 21:44:06 -04:00
|
|
|
ui->fmDeviation->setText("2500");
|
2015-12-01 20:28:31 -05:00
|
|
|
ui->udpAddress->setText("127.0.0.1");
|
2015-11-18 21:27:37 -05:00
|
|
|
ui->udpPort->setText("9999");
|
2015-12-04 22:03:30 -05:00
|
|
|
ui->audioPort->setText("9999");
|
2015-11-18 21:27:37 -05:00
|
|
|
ui->spectrumGUI->resetToDefaults();
|
|
|
|
ui->boost->setValue(1);
|
2015-12-03 21:46:51 -05:00
|
|
|
ui->volume->setValue(20);
|
|
|
|
ui->audioActive->setChecked(false);
|
2015-12-05 06:23:55 -05:00
|
|
|
ui->audioStereo->setChecked(false);
|
2015-11-18 21:27:37 -05:00
|
|
|
|
|
|
|
blockApplySettings(false);
|
2015-12-03 21:46:51 -05:00
|
|
|
applySettingsImmediate();
|
2015-11-18 21:27:37 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArray UDPSrcGUI::serialize() const
|
|
|
|
{
|
|
|
|
SimpleSerializer s(1);
|
|
|
|
s.writeBlob(1, saveState());
|
|
|
|
s.writeS32(2, m_channelMarker.getCenterFrequency());
|
|
|
|
s.writeS32(3, m_sampleFormat);
|
|
|
|
s.writeReal(4, m_outputSampleRate);
|
|
|
|
s.writeReal(5, m_rfBandwidth);
|
2015-11-19 02:55:58 -05:00
|
|
|
s.writeS32(6, m_udpPort);
|
2015-11-18 21:27:37 -05:00
|
|
|
s.writeBlob(7, ui->spectrumGUI->serialize());
|
|
|
|
s.writeS32(8, (qint32)m_boost);
|
|
|
|
s.writeS32(9, m_channelMarker.getCenterFrequency());
|
2015-12-01 20:28:31 -05:00
|
|
|
s.writeString(10, m_udpAddress);
|
2015-12-03 21:46:51 -05:00
|
|
|
s.writeBool(11, m_audioActive);
|
|
|
|
s.writeS32(12, (qint32)m_volume);
|
2015-12-04 22:03:30 -05:00
|
|
|
s.writeS32(13, m_audioPort);
|
2015-12-05 06:23:55 -05:00
|
|
|
s.writeBool(14, m_audioStereo);
|
2016-04-03 21:44:06 -04:00
|
|
|
s.writeS32(15, m_fmDeviation);
|
2015-11-18 21:27:37 -05:00
|
|
|
return s.final();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UDPSrcGUI::deserialize(const QByteArray& data)
|
|
|
|
{
|
|
|
|
SimpleDeserializer d(data);
|
|
|
|
|
|
|
|
if (!d.isValid())
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (d.getVersion() == 1)
|
|
|
|
{
|
|
|
|
QByteArray bytetmp;
|
2015-12-01 20:28:31 -05:00
|
|
|
QString strtmp;
|
2015-11-18 21:27:37 -05:00
|
|
|
qint32 s32tmp;
|
|
|
|
Real realtmp;
|
2015-12-03 21:46:51 -05:00
|
|
|
bool booltmp;
|
2015-11-18 21:27:37 -05:00
|
|
|
|
|
|
|
blockApplySettings(true);
|
|
|
|
m_channelMarker.blockSignals(true);
|
|
|
|
|
|
|
|
d.readBlob(1, &bytetmp);
|
|
|
|
restoreState(bytetmp);
|
|
|
|
d.readS32(2, &s32tmp, 0);
|
|
|
|
m_channelMarker.setCenterFrequency(s32tmp);
|
2016-04-05 11:02:24 -04:00
|
|
|
d.readS32(3, &s32tmp, UDPSrc::FormatS16LE);
|
2015-11-18 21:27:37 -05:00
|
|
|
switch(s32tmp) {
|
2016-04-05 11:02:24 -04:00
|
|
|
case UDPSrc::FormatS16LE:
|
2015-11-18 21:27:37 -05:00
|
|
|
ui->sampleFormat->setCurrentIndex(0);
|
|
|
|
break;
|
|
|
|
case UDPSrc::FormatNFM:
|
|
|
|
ui->sampleFormat->setCurrentIndex(1);
|
|
|
|
break;
|
2016-04-05 11:02:24 -04:00
|
|
|
case UDPSrc::FormatNFMMono:
|
2015-11-18 21:27:37 -05:00
|
|
|
ui->sampleFormat->setCurrentIndex(2);
|
|
|
|
break;
|
2016-04-05 11:02:24 -04:00
|
|
|
case UDPSrc::FormatLSB:
|
|
|
|
ui->sampleFormat->setCurrentIndex(3);
|
|
|
|
break;
|
|
|
|
case UDPSrc::FormatUSB:
|
|
|
|
ui->sampleFormat->setCurrentIndex(4);
|
|
|
|
break;
|
|
|
|
case UDPSrc::FormatLSBMono:
|
|
|
|
ui->sampleFormat->setCurrentIndex(5);
|
|
|
|
break;
|
|
|
|
case UDPSrc::FormatUSBMono:
|
|
|
|
ui->sampleFormat->setCurrentIndex(6);
|
|
|
|
break;
|
|
|
|
case UDPSrc::FormatAMMono:
|
|
|
|
ui->sampleFormat->setCurrentIndex(7);
|
|
|
|
break;
|
2015-11-18 21:27:37 -05:00
|
|
|
default:
|
|
|
|
ui->sampleFormat->setCurrentIndex(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
d.readReal(4, &realtmp, 48000);
|
|
|
|
ui->sampleRate->setText(QString("%1").arg(realtmp, 0));
|
|
|
|
d.readReal(5, &realtmp, 32000);
|
|
|
|
ui->rfBandwidth->setText(QString("%1").arg(realtmp, 0));
|
|
|
|
d.readS32(6, &s32tmp, 9999);
|
|
|
|
ui->udpPort->setText(QString("%1").arg(s32tmp));
|
|
|
|
d.readBlob(7, &bytetmp);
|
|
|
|
ui->spectrumGUI->deserialize(bytetmp);
|
|
|
|
d.readS32(8, &s32tmp, 1);
|
|
|
|
ui->boost->setValue(s32tmp);
|
|
|
|
d.readS32(9, &s32tmp, 0);
|
|
|
|
m_channelMarker.setCenterFrequency(s32tmp);
|
2015-12-01 20:28:31 -05:00
|
|
|
d.readString(10, &strtmp, "127.0.0.1");
|
|
|
|
ui->udpAddress->setText(strtmp);
|
2015-12-03 21:46:51 -05:00
|
|
|
d.readBool(11, &booltmp, false);
|
|
|
|
ui->audioActive->setChecked(booltmp);
|
|
|
|
d.readS32(12, &s32tmp, 20);
|
|
|
|
ui->volume->setValue(s32tmp);
|
2015-12-04 22:03:30 -05:00
|
|
|
d.readS32(13, &s32tmp, 9998);
|
|
|
|
ui->audioPort->setText(QString("%1").arg(s32tmp));
|
2015-12-05 06:23:55 -05:00
|
|
|
d.readBool(14, &booltmp, false);
|
|
|
|
ui->audioStereo->setChecked(booltmp);
|
2016-04-03 21:44:06 -04:00
|
|
|
d.readS32(15, &s32tmp, 2500);
|
|
|
|
ui->fmDeviation->setText(QString("%1").arg(s32tmp));
|
2015-11-18 21:27:37 -05:00
|
|
|
|
|
|
|
blockApplySettings(false);
|
|
|
|
m_channelMarker.blockSignals(false);
|
|
|
|
|
2015-12-03 21:46:51 -05:00
|
|
|
applySettingsImmediate();
|
2015-11-18 21:27:37 -05:00
|
|
|
applySettings();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
resetToDefaults();
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UDPSrcGUI::handleMessage(const Message& message)
|
|
|
|
{
|
2015-11-19 02:55:58 -05:00
|
|
|
qDebug() << "UDPSrcGUI::handleMessage";
|
2015-12-01 20:28:31 -05:00
|
|
|
return false;
|
2015-11-18 21:27:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::channelMarkerChanged()
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::tick()
|
|
|
|
{
|
2015-11-19 02:55:58 -05:00
|
|
|
Real powDb = CalcDb::dbPower(m_udpSrc->getMagSq());
|
2015-11-18 21:27:37 -05:00
|
|
|
m_channelPowerDbAvg.feed(powDb);
|
|
|
|
ui->channelPower->setText(QString::number(m_channelPowerDbAvg.average(), 'f', 1));
|
|
|
|
}
|
|
|
|
|
|
|
|
UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, QWidget* parent) :
|
|
|
|
RollupWidget(parent),
|
|
|
|
ui(new Ui::UDPSrcGUI),
|
|
|
|
m_pluginAPI(pluginAPI),
|
2015-11-19 02:55:58 -05:00
|
|
|
m_udpSrc(0),
|
2015-11-18 21:27:37 -05:00
|
|
|
m_channelMarker(this),
|
|
|
|
m_channelPowerDbAvg(40,0),
|
|
|
|
m_basicSettingsShown(false),
|
2015-12-03 21:46:51 -05:00
|
|
|
m_doApplySettings(true),
|
|
|
|
m_boost(1),
|
|
|
|
m_volume(20)
|
2015-11-18 21:27:37 -05:00
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
|
|
|
connect(this, SIGNAL(menuDoubleClickEvent()), this, SLOT(onMenuDoubleClicked()));
|
|
|
|
setAttribute(Qt::WA_DeleteOnClose, true);
|
|
|
|
|
|
|
|
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
2015-11-19 02:55:58 -05:00
|
|
|
m_udpSrc = new UDPSrc(m_pluginAPI->getMainWindowMessageQueue(), this, m_spectrumVis);
|
|
|
|
m_channelizer = new Channelizer(m_udpSrc);
|
2015-11-18 21:27:37 -05:00
|
|
|
m_threadedChannelizer = new ThreadedSampleSink(m_channelizer, this);
|
|
|
|
DSPEngine::instance()->addThreadedSink(m_threadedChannelizer);
|
|
|
|
|
2016-04-04 10:44:50 -04:00
|
|
|
ui->fmDeviation->setEnabled(false);
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::ReverseGold));
|
|
|
|
ui->deltaFrequency->setValueRange(7, 0U, 9999999U);
|
|
|
|
|
|
|
|
ui->glSpectrum->setCenterFrequency(0);
|
|
|
|
ui->glSpectrum->setSampleRate(ui->sampleRate->text().toInt());
|
|
|
|
ui->glSpectrum->setDisplayWaterfall(true);
|
|
|
|
ui->glSpectrum->setDisplayMaxHold(true);
|
|
|
|
m_spectrumVis->configure(m_spectrumVis->getInputMessageQueue(), 64, 10, FFTWindow::BlackmanHarris);
|
|
|
|
|
|
|
|
ui->glSpectrum->connectTimer(m_pluginAPI->getMainWindow()->getMasterTimer());
|
|
|
|
connect(&m_pluginAPI->getMainWindow()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
|
|
|
|
|
|
|
|
//m_channelMarker = new ChannelMarker(this);
|
|
|
|
m_channelMarker.setBandwidth(16000);
|
|
|
|
m_channelMarker.setCenterFrequency(0);
|
|
|
|
m_channelMarker.setColor(Qt::green);
|
|
|
|
m_channelMarker.setVisible(true);
|
|
|
|
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
|
|
|
|
m_pluginAPI->addChannelMarker(&m_channelMarker);
|
|
|
|
|
|
|
|
ui->spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, ui->glSpectrum);
|
|
|
|
|
2015-12-03 21:46:51 -05:00
|
|
|
applySettingsImmediate();
|
2015-11-18 21:27:37 -05:00
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
UDPSrcGUI::~UDPSrcGUI()
|
|
|
|
{
|
|
|
|
m_pluginAPI->removeChannelInstance(this);
|
|
|
|
DSPEngine::instance()->removeThreadedSink(m_threadedChannelizer);
|
|
|
|
delete m_threadedChannelizer;
|
|
|
|
delete m_channelizer;
|
2015-11-19 02:55:58 -05:00
|
|
|
delete m_udpSrc;
|
2015-11-18 21:27:37 -05:00
|
|
|
delete m_spectrumVis;
|
|
|
|
//delete m_channelMarker;
|
|
|
|
delete ui;
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::blockApplySettings(bool block)
|
|
|
|
{
|
|
|
|
m_doApplySettings = !block;
|
|
|
|
}
|
|
|
|
|
2015-12-03 21:46:51 -05:00
|
|
|
void UDPSrcGUI::applySettingsImmediate()
|
|
|
|
{
|
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
2015-12-05 06:03:26 -05:00
|
|
|
m_audioActive = ui->audioActive->isChecked();
|
2015-12-05 06:23:55 -05:00
|
|
|
m_audioStereo = ui->audioStereo->isChecked();
|
2015-12-03 21:46:51 -05:00
|
|
|
m_boost = ui->boost->value();
|
|
|
|
m_volume = ui->volume->value();
|
|
|
|
|
|
|
|
m_udpSrc->configureImmediate(m_udpSrc->getInputMessageQueue(),
|
2015-12-05 06:03:26 -05:00
|
|
|
m_audioActive,
|
2015-12-05 06:23:55 -05:00
|
|
|
m_audioStereo,
|
2015-12-03 21:46:51 -05:00
|
|
|
m_boost,
|
|
|
|
m_volume);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
void UDPSrcGUI::applySettings()
|
|
|
|
{
|
|
|
|
if (m_doApplySettings)
|
|
|
|
{
|
|
|
|
bool ok;
|
|
|
|
|
|
|
|
Real outputSampleRate = ui->sampleRate->text().toDouble(&ok);
|
|
|
|
|
|
|
|
if((!ok) || (outputSampleRate < 1000))
|
|
|
|
{
|
|
|
|
outputSampleRate = 48000;
|
|
|
|
}
|
|
|
|
|
|
|
|
Real rfBandwidth = ui->rfBandwidth->text().toDouble(&ok);
|
|
|
|
|
|
|
|
if((!ok) || (rfBandwidth > outputSampleRate))
|
|
|
|
{
|
|
|
|
rfBandwidth = outputSampleRate;
|
|
|
|
}
|
|
|
|
|
2015-12-01 20:28:31 -05:00
|
|
|
m_udpAddress = ui->udpAddress->text();
|
2015-12-04 22:03:30 -05:00
|
|
|
|
2015-11-19 02:55:58 -05:00
|
|
|
int udpPort = ui->udpPort->text().toInt(&ok);
|
2015-11-18 21:27:37 -05:00
|
|
|
|
2016-02-01 02:24:14 -05:00
|
|
|
if((!ok) || (udpPort < 1024) || (udpPort > 65535))
|
2015-11-18 21:27:37 -05:00
|
|
|
{
|
2015-11-19 02:55:58 -05:00
|
|
|
udpPort = 9999;
|
2015-11-18 21:27:37 -05:00
|
|
|
}
|
|
|
|
|
2015-12-04 22:03:30 -05:00
|
|
|
int audioPort = ui->audioPort->text().toInt(&ok);
|
|
|
|
|
|
|
|
if((!ok) || (audioPort < 1) || (audioPort > 65535) || (audioPort == udpPort))
|
|
|
|
{
|
|
|
|
audioPort = udpPort - 1;
|
|
|
|
}
|
|
|
|
|
2016-04-03 21:44:06 -04:00
|
|
|
int fmDeviation = ui->fmDeviation->text().toInt(&ok);
|
|
|
|
|
|
|
|
if ((!ok) || (fmDeviation < 1))
|
|
|
|
{
|
|
|
|
fmDeviation = 2500;
|
|
|
|
}
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
int boost = ui->boost->value();
|
|
|
|
|
|
|
|
setTitleColor(m_channelMarker.getColor());
|
|
|
|
ui->deltaFrequency->setValue(abs(m_channelMarker.getCenterFrequency()));
|
|
|
|
ui->deltaMinus->setChecked(m_channelMarker.getCenterFrequency() < 0);
|
|
|
|
ui->sampleRate->setText(QString("%1").arg(outputSampleRate, 0));
|
|
|
|
ui->rfBandwidth->setText(QString("%1").arg(rfBandwidth, 0));
|
2015-12-01 20:28:31 -05:00
|
|
|
//ui->udpAddress->setText(m_udpAddress);
|
2015-11-19 02:55:58 -05:00
|
|
|
ui->udpPort->setText(QString("%1").arg(udpPort));
|
2015-12-04 22:03:30 -05:00
|
|
|
ui->audioPort->setText(QString("%1").arg(audioPort));
|
2016-04-03 21:44:06 -04:00
|
|
|
ui->fmDeviation->setText(QString("%1").arg(fmDeviation));
|
2015-11-18 21:27:37 -05:00
|
|
|
ui->boost->setValue(boost);
|
|
|
|
m_channelMarker.disconnect(this, SLOT(channelMarkerChanged()));
|
|
|
|
m_channelMarker.setBandwidth((int)rfBandwidth);
|
|
|
|
connect(&m_channelMarker, SIGNAL(changed()), this, SLOT(channelMarkerChanged()));
|
|
|
|
ui->glSpectrum->setSampleRate(outputSampleRate);
|
|
|
|
|
|
|
|
m_channelizer->configure(m_channelizer->getInputMessageQueue(),
|
|
|
|
outputSampleRate,
|
|
|
|
m_channelMarker.getCenterFrequency());
|
|
|
|
|
|
|
|
UDPSrc::SampleFormat sampleFormat;
|
|
|
|
|
|
|
|
switch(ui->sampleFormat->currentIndex())
|
|
|
|
{
|
|
|
|
case 0:
|
2016-04-05 11:02:24 -04:00
|
|
|
sampleFormat = UDPSrc::FormatS16LE;
|
2016-04-04 10:44:50 -04:00
|
|
|
ui->fmDeviation->setEnabled(false);
|
2015-11-18 21:27:37 -05:00
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
sampleFormat = UDPSrc::FormatNFM;
|
2016-04-04 10:44:50 -04:00
|
|
|
ui->fmDeviation->setEnabled(true);
|
2015-11-18 21:27:37 -05:00
|
|
|
break;
|
|
|
|
case 2:
|
2016-04-05 11:02:24 -04:00
|
|
|
sampleFormat = UDPSrc::FormatNFMMono;
|
|
|
|
ui->fmDeviation->setEnabled(true);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
sampleFormat = UDPSrc::FormatLSB;
|
|
|
|
ui->fmDeviation->setEnabled(false);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
sampleFormat = UDPSrc::FormatUSB;
|
|
|
|
ui->fmDeviation->setEnabled(false);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
sampleFormat = UDPSrc::FormatLSBMono;
|
|
|
|
ui->fmDeviation->setEnabled(false);
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
sampleFormat = UDPSrc::FormatUSBMono;
|
|
|
|
ui->fmDeviation->setEnabled(false);
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
sampleFormat = UDPSrc::FormatAMMono;
|
2016-04-04 10:44:50 -04:00
|
|
|
ui->fmDeviation->setEnabled(false);
|
2015-11-18 21:27:37 -05:00
|
|
|
break;
|
|
|
|
default:
|
2016-04-05 11:02:24 -04:00
|
|
|
sampleFormat = UDPSrc::FormatS16LE;
|
2016-04-04 10:44:50 -04:00
|
|
|
ui->fmDeviation->setEnabled(false);
|
2015-11-18 21:27:37 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_sampleFormat = sampleFormat;
|
|
|
|
m_outputSampleRate = outputSampleRate;
|
|
|
|
m_rfBandwidth = rfBandwidth;
|
2016-04-03 21:44:06 -04:00
|
|
|
m_fmDeviation = fmDeviation;
|
2015-11-19 02:55:58 -05:00
|
|
|
m_udpPort = udpPort;
|
2015-12-04 22:03:30 -05:00
|
|
|
m_audioPort = audioPort;
|
2015-11-18 21:27:37 -05:00
|
|
|
m_boost = boost;
|
|
|
|
|
2015-11-19 02:55:58 -05:00
|
|
|
m_udpSrc->configure(m_udpSrc->getInputMessageQueue(),
|
2015-11-18 21:27:37 -05:00
|
|
|
sampleFormat,
|
|
|
|
outputSampleRate,
|
|
|
|
rfBandwidth,
|
2016-04-03 21:44:06 -04:00
|
|
|
fmDeviation,
|
2015-12-01 20:28:31 -05:00
|
|
|
m_udpAddress,
|
2015-11-19 02:55:58 -05:00
|
|
|
udpPort,
|
2015-12-05 06:03:26 -05:00
|
|
|
audioPort);
|
2015-11-18 21:27:37 -05:00
|
|
|
|
|
|
|
ui->applyBtn->setEnabled(false);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::on_deltaMinus_toggled(bool minus)
|
|
|
|
{
|
|
|
|
int deltaFrequency = m_channelMarker.getCenterFrequency();
|
|
|
|
bool minusDelta = (deltaFrequency < 0);
|
|
|
|
|
|
|
|
if (minus ^ minusDelta) // sign change
|
|
|
|
{
|
|
|
|
m_channelMarker.setCenterFrequency(-deltaFrequency);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::on_deltaFrequency_changed(quint64 value)
|
|
|
|
{
|
|
|
|
if (ui->deltaMinus->isChecked()) {
|
|
|
|
m_channelMarker.setCenterFrequency(-value);
|
|
|
|
} else {
|
|
|
|
m_channelMarker.setCenterFrequency(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::on_sampleFormat_currentIndexChanged(int index)
|
|
|
|
{
|
2016-04-05 11:02:24 -04:00
|
|
|
if ((index == 1) || (index == 2)) {
|
2016-04-04 10:44:50 -04:00
|
|
|
ui->fmDeviation->setEnabled(true);
|
|
|
|
} else {
|
|
|
|
ui->fmDeviation->setEnabled(false);
|
|
|
|
}
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::on_sampleRate_textEdited(const QString& arg1)
|
|
|
|
{
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::on_rfBandwidth_textEdited(const QString& arg1)
|
|
|
|
{
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2016-04-03 21:44:06 -04:00
|
|
|
void UDPSrcGUI::on_fmDeviation_textEdited(const QString& arg1)
|
|
|
|
{
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2016-02-24 18:55:05 -05:00
|
|
|
void UDPSrcGUI::on_udpAddress_textEdited(const QString& arg1)
|
|
|
|
{
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
void UDPSrcGUI::on_udpPort_textEdited(const QString& arg1)
|
|
|
|
{
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2015-12-04 22:03:30 -05:00
|
|
|
void UDPSrcGUI::on_audioPort_textEdited(const QString& arg1)
|
|
|
|
{
|
|
|
|
ui->applyBtn->setEnabled(true);
|
|
|
|
}
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
void UDPSrcGUI::on_applyBtn_clicked()
|
|
|
|
{
|
|
|
|
applySettings();
|
|
|
|
}
|
|
|
|
|
2015-12-05 05:49:24 -05:00
|
|
|
void UDPSrcGUI::on_audioActive_toggled(bool active)
|
2015-12-03 21:46:51 -05:00
|
|
|
{
|
2015-12-05 06:03:26 -05:00
|
|
|
applySettingsImmediate();
|
2015-12-03 21:46:51 -05:00
|
|
|
}
|
|
|
|
|
2015-12-05 06:23:55 -05:00
|
|
|
void UDPSrcGUI::on_audioStereo_toggled(bool stereo)
|
|
|
|
{
|
|
|
|
applySettingsImmediate();
|
|
|
|
}
|
|
|
|
|
2015-11-18 21:27:37 -05:00
|
|
|
void UDPSrcGUI::on_boost_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->boost->setValue(value);
|
|
|
|
ui->boostText->setText(QString("%1").arg(value));
|
2015-12-03 21:46:51 -05:00
|
|
|
applySettingsImmediate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::on_volume_valueChanged(int value)
|
|
|
|
{
|
|
|
|
ui->volume->setValue(value);
|
|
|
|
ui->volumeText->setText(QString("%1").arg(value));
|
|
|
|
applySettingsImmediate();
|
2015-11-18 21:27:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::onWidgetRolled(QWidget* widget, bool rollDown)
|
|
|
|
{
|
2015-11-19 02:55:58 -05:00
|
|
|
if ((widget == ui->spectrumBox) && (m_udpSrc != 0))
|
2015-11-18 21:27:37 -05:00
|
|
|
{
|
2015-11-19 02:55:58 -05:00
|
|
|
m_udpSrc->setSpectrum(m_udpSrc->getInputMessageQueue(), rollDown);
|
2015-11-18 21:27:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::onMenuDoubleClicked()
|
|
|
|
{
|
|
|
|
if (!m_basicSettingsShown)
|
|
|
|
{
|
|
|
|
m_basicSettingsShown = true;
|
|
|
|
BasicChannelSettingsWidget* bcsw = new BasicChannelSettingsWidget(&m_channelMarker, this);
|
|
|
|
bcsw->show();
|
|
|
|
}
|
|
|
|
}
|
2016-04-03 12:14:04 -04:00
|
|
|
|
|
|
|
void UDPSrcGUI::leaveEvent(QEvent*)
|
|
|
|
{
|
|
|
|
blockApplySettings(true);
|
|
|
|
m_channelMarker.setHighlighted(false);
|
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UDPSrcGUI::enterEvent(QEvent*)
|
|
|
|
{
|
|
|
|
blockApplySettings(true);
|
|
|
|
m_channelMarker.setHighlighted(true);
|
|
|
|
blockApplySettings(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
|