1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

Compare commits

...

16 Commits

Author SHA1 Message Date
f4exb
5d0fa7fa67 Removed destroy method leftovers and Sonar lint 2024-08-27 09:54:09 +02:00
f4exb
704eb403d1 Removed the destroy method from ChannelGUI interface 2024-08-27 09:54:09 +02:00
f4exb
b85419c56a Sonar fixes 2024-08-27 09:54:09 +02:00
f4exb
585d806ef8 All device plugins: make sure start and stop are effective once only. PArt of #2159 2024-08-27 09:54:09 +02:00
f4exb
1b37a4f504 BladeRF2Output: removed applySettings from stop method 2024-08-27 09:54:09 +02:00
f4exb
7b4e751ba1 DeviceSet and DeviceUISet: use delete channel API instead of destroy method so that the virtual destructor of the channel is called appropriately 2024-08-27 09:54:09 +02:00
f4exb
aca4a53513 Fixed threading model for DSPDeviceSinkEngine plus other fixes. Part of #2159 2024-08-27 09:54:09 +02:00
f4exb
75d40c8b68 SSBMod: revised thread processing 2024-08-27 09:54:09 +02:00
f4exb
d553834adf Removed SyncMessenger from DSPDeviceSinkEngine. Part of #2159 2024-08-27 09:54:09 +02:00
f4exb
2b26f15463 AMMod: revised thread processing 2024-08-27 09:54:09 +02:00
f4exb
2219fcd809 NFMMod: revised thread processing 2024-08-27 09:54:09 +02:00
f4exb
290023183c Fixed threading model for DSPDeviceMIMOEngine plus other fixes. Part of #2159 2024-08-27 09:54:09 +02:00
f4exb
beaf2932ba RTLSDR: make sure start and stop are effective once only. PArt of #2159 2024-08-27 09:54:09 +02:00
f4exb
f6b3b22e4f Removed SyncMessenger from DSPDeviceMIMOEngine. Part of #2159 2024-08-27 09:54:09 +02:00
f4exb
d2066495a9 Fixed threading model for DSPDeviceSourceEngine. Part of #2159 2024-08-27 09:54:09 +02:00
f4exb
9fa1974ba3 Removed SyncMessenger from DSPDeviceSourceEngine. Part of #2159 2024-08-27 09:54:09 +02:00
210 changed files with 3706 additions and 3718 deletions

View File

@ -46,7 +46,6 @@ BeamSteeringCWMod::BeamSteeringCWMod(DeviceAPI *deviceAPI) :
m_thread(nullptr), m_thread(nullptr),
m_basebandSource(nullptr), m_basebandSource(nullptr),
m_running(false), m_running(false),
m_guiMessageQueue(nullptr),
m_frequencyOffset(0), m_frequencyOffset(0),
m_basebandSampleRate(48000) m_basebandSampleRate(48000)
{ {
@ -62,7 +61,7 @@ BeamSteeringCWMod::BeamSteeringCWMod(DeviceAPI *deviceAPI) :
this, this,
&BeamSteeringCWMod::networkManagerFinished &BeamSteeringCWMod::networkManagerFinished
); );
startSources(); BeamSteeringCWMod::startSources();
} }
BeamSteeringCWMod::~BeamSteeringCWMod() BeamSteeringCWMod::~BeamSteeringCWMod()
@ -77,7 +76,7 @@ BeamSteeringCWMod::~BeamSteeringCWMod()
m_deviceAPI->removeChannelSinkAPI(this); m_deviceAPI->removeChannelSinkAPI(this);
m_deviceAPI->removeMIMOChannel(this); m_deviceAPI->removeMIMOChannel(this);
stopSources(); BeamSteeringCWMod::stopSources();
} }
void BeamSteeringCWMod::setDeviceAPI(DeviceAPI *deviceAPI) void BeamSteeringCWMod::setDeviceAPI(DeviceAPI *deviceAPI)
@ -194,7 +193,7 @@ void BeamSteeringCWMod::applySettings(const BeamSteeringCWModSettings& settings,
QList<ObjectPipe*> pipes; QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes); MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
if (pipes.size() > 0) { if (!pipes.empty()) {
sendChannelSettings(pipes, reverseAPIKeys, settings, force); sendChannelSettings(pipes, reverseAPIKeys, settings, force);
} }
@ -205,7 +204,7 @@ void BeamSteeringCWMod::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -218,14 +217,14 @@ bool BeamSteeringCWMod::handleMessage(const Message& cmd)
{ {
if (MsgConfigureBeamSteeringCWMod::match(cmd)) if (MsgConfigureBeamSteeringCWMod::match(cmd))
{ {
MsgConfigureBeamSteeringCWMod& cfg = (MsgConfigureBeamSteeringCWMod&) cmd; auto& cfg = (const MsgConfigureBeamSteeringCWMod&) cmd;
qDebug() << "BeamSteeringCWMod::handleMessage: MsgConfigureBeamSteeringCWMod"; qDebug() << "BeamSteeringCWMod::handleMessage: MsgConfigureBeamSteeringCWMod";
applySettings(cfg.getSettings(), cfg.getForce()); applySettings(cfg.getSettings(), cfg.getForce());
return true; return true;
} }
else if (DSPMIMOSignalNotification::match(cmd)) else if (DSPMIMOSignalNotification::match(cmd))
{ {
DSPMIMOSignalNotification& notif = (DSPMIMOSignalNotification&) cmd; auto& notif = (const DSPMIMOSignalNotification&) cmd;
qDebug() << "BeamSteeringCWMod::handleMessage: DSPMIMOSignalNotification:" qDebug() << "BeamSteeringCWMod::handleMessage: DSPMIMOSignalNotification:"
<< " basebandSampleRate: " << notif.getSampleRate() << " basebandSampleRate: " << notif.getSampleRate()
@ -301,7 +300,7 @@ void BeamSteeringCWMod::validateFilterChainHash(BeamSteeringCWModSettings& setti
void BeamSteeringCWMod::calculateFrequencyOffset() void BeamSteeringCWMod::calculateFrequencyOffset()
{ {
double shiftFactor = HBFilterChainConverter::getShiftFactor(m_settings.m_log2Interp, m_settings.m_filterChainHash); double shiftFactor = HBFilterChainConverter::getShiftFactor(m_settings.m_log2Interp, m_settings.m_filterChainHash);
m_frequencyOffset = m_basebandSampleRate * shiftFactor; m_frequencyOffset = (int64_t) (m_basebandSampleRate * shiftFactor);
} }
int BeamSteeringCWMod::webapiSettingsGet( int BeamSteeringCWMod::webapiSettingsGet(
@ -380,13 +379,13 @@ void BeamSteeringCWMod::webapiUpdateChannelSettings(
settings.m_reverseAPIAddress = *response.getBeamSteeringCwModSettings()->getReverseApiAddress(); settings.m_reverseAPIAddress = *response.getBeamSteeringCwModSettings()->getReverseApiAddress();
} }
if (channelSettingsKeys.contains("reverseAPIPort")) { if (channelSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getBeamSteeringCwModSettings()->getReverseApiPort(); settings.m_reverseAPIPort = (uint16_t) response.getBeamSteeringCwModSettings()->getReverseApiPort();
} }
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) { if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getBeamSteeringCwModSettings()->getReverseApiDeviceIndex(); settings.m_reverseAPIDeviceIndex = (uint16_t) response.getBeamSteeringCwModSettings()->getReverseApiDeviceIndex();
} }
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
settings.m_reverseAPIChannelIndex = response.getBeamSteeringCwModSettings()->getReverseApiChannelIndex(); settings.m_reverseAPIChannelIndex = (uint16_t) response.getBeamSteeringCwModSettings()->getReverseApiChannelIndex();
} }
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) { if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getBeamSteeringCwModSettings()->getChannelMarker()); settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getBeamSteeringCwModSettings()->getChannelMarker());
@ -429,7 +428,7 @@ void BeamSteeringCWMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSetti
} }
else else
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
response.getBeamSteeringCwModSettings()->setChannelMarker(swgChannelMarker); response.getBeamSteeringCwModSettings()->setChannelMarker(swgChannelMarker);
} }
@ -443,16 +442,16 @@ void BeamSteeringCWMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSetti
} }
else else
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
response.getBeamSteeringCwModSettings()->setRollupState(swgRollupState); response.getBeamSteeringCwModSettings()->setRollupState(swgRollupState);
} }
} }
} }
void BeamSteeringCWMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const BeamSteeringCWModSettings& settings, bool force) void BeamSteeringCWMod::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const BeamSteeringCWModSettings& settings, bool force)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -463,8 +462,8 @@ void BeamSteeringCWMod::webapiReverseSendSettings(QList<QString>& channelSetting
m_networkRequest.setUrl(QUrl(channelSettingsURL)); m_networkRequest.setUrl(QUrl(channelSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QBuffer *buffer = new QBuffer(); auto *buffer = new QBuffer();
buffer->open((QBuffer::ReadWrite)); buffer->open(QBuffer::ReadWrite);
buffer->write(swgChannelSettings->asJson().toUtf8()); buffer->write(swgChannelSettings->asJson().toUtf8());
buffer->seek(0); buffer->seek(0);
@ -477,9 +476,9 @@ void BeamSteeringCWMod::webapiReverseSendSettings(QList<QString>& channelSetting
void BeamSteeringCWMod::sendChannelSettings( void BeamSteeringCWMod::sendChannelSettings(
const QList<ObjectPipe*>& pipes, const QList<ObjectPipe*>& pipes,
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const BeamSteeringCWModSettings& settings, const BeamSteeringCWModSettings& settings,
bool force) bool force) const
{ {
for (const auto& pipe : pipes) for (const auto& pipe : pipes)
{ {
@ -487,7 +486,7 @@ void BeamSteeringCWMod::sendChannelSettings(
if (messageQueue) if (messageQueue)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create( MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
this, this,
@ -501,11 +500,11 @@ void BeamSteeringCWMod::sendChannelSettings(
} }
void BeamSteeringCWMod::webapiFormatChannelSettings( void BeamSteeringCWMod::webapiFormatChannelSettings(
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const BeamSteeringCWModSettings& settings, const BeamSteeringCWModSettings& settings,
bool force bool force
) ) const
{ {
swgChannelSettings->setDirection(2); // MIMO sink swgChannelSettings->setDirection(2); // MIMO sink
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet()); swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
@ -534,20 +533,20 @@ void BeamSteeringCWMod::webapiFormatChannelSettings(
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force)) if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
swgBeamSteeringCWSettings->setChannelMarker(swgChannelMarker); swgBeamSteeringCWSettings->setChannelMarker(swgChannelMarker);
} }
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force)) if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
swgBeamSteeringCWSettings->setRollupState(swgRollupState); swgBeamSteeringCWSettings->setRollupState(swgRollupState);
} }
} }
void BeamSteeringCWMod::networkManagerFinished(QNetworkReply *reply) void BeamSteeringCWMod::networkManagerFinished(QNetworkReply *reply) const
{ {
QNetworkReply::NetworkError replyError = reply->error(); QNetworkReply::NetworkError replyError = reply->error();

View File

@ -86,58 +86,55 @@ public:
qint64 m_centerFrequency; qint64 m_centerFrequency;
}; };
BeamSteeringCWMod(DeviceAPI *deviceAPI); explicit BeamSteeringCWMod(DeviceAPI *deviceAPI);
virtual ~BeamSteeringCWMod(); ~BeamSteeringCWMod() final;
virtual void destroy() { delete this; } void destroy() final { delete this; }
virtual void setDeviceAPI(DeviceAPI *deviceAPI); void setDeviceAPI(DeviceAPI *deviceAPI) final;
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; } DeviceAPI *getDeviceAPI() final { return m_deviceAPI; }
virtual void startSinks() {} void startSinks() final { /* Not used for MIMO */ }
virtual void stopSinks() {} void stopSinks() final { /* Not used for MIMO */ }
virtual void startSources(); //!< thread start() void startSources( /* Not used for MIMO */ ) final; //!< thread start()
virtual void stopSources(); //!< thread exit() and wait() void stopSources( /* Not used for MIMO */ ) final; //!< thread exit() and wait()
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex); void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex) final;
virtual void pull(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex); void pull(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) final;
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); } void pushMessage(Message *msg) final { m_inputMessageQueue.push(msg); }
virtual QString getMIMOName() { return objectName(); } QString getMIMOName() final { return objectName(); }
virtual void getIdentifier(QString& id) { id = objectName(); } void getIdentifier(QString& id) final { id = objectName(); }
virtual QString getIdentifier() const { return objectName(); } QString getIdentifier() const final { return objectName(); }
virtual void getTitle(QString& title) { title = "BeamSteeringCWMod"; } void getTitle(QString& title) final { title = "BeamSteeringCWMod"; }
virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } qint64 getCenterFrequency() const final { return m_frequencyOffset; }
virtual void setCenterFrequency(qint64) {} void setCenterFrequency(qint64) final { /* Not used for MIMO */ }
uint32_t getBasebandSampleRate() const { return m_basebandSampleRate; } uint32_t getBasebandSampleRate() const { return m_basebandSampleRate; }
virtual QByteArray serialize() const; QByteArray serialize() const final;
virtual bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data) final;
virtual int getNbSinkStreams() const { return 0; } int getNbSinkStreams() const final { return 0; }
virtual int getNbSourceStreams() const { return 2; } int getNbSourceStreams() const final { return 2; }
virtual int getStreamIndex() const { return -1; } int getStreamIndex() const final { return -1; }
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const final
{ {
(void) streamIndex; (void) streamIndex;
(void) sinkElseSource; (void) sinkElseSource;
return m_frequencyOffset; return m_frequencyOffset;
} }
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; } int webapiSettingsGet(
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
virtual int webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage); QString& errorMessage) final;
virtual int webapiSettingsPutPatch( int webapiSettingsPutPatch(
bool force, bool force,
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage); QString& errorMessage) final;
virtual int webapiWorkspaceGet( int webapiWorkspaceGet(
SWGSDRangel::SWGWorkspaceInfo& query, SWGSDRangel::SWGWorkspaceInfo& query,
QString& errorMessage); QString& errorMessage) final;
static void webapiFormatChannelSettings( static void webapiFormatChannelSettings(
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
@ -161,36 +158,36 @@ private:
BasebandSampleSink* m_spectrumSink; BasebandSampleSink* m_spectrumSink;
BasebandSampleSink* m_scopeSink; BasebandSampleSink* m_scopeSink;
BeamSteeringCWModSettings m_settings; BeamSteeringCWModSettings m_settings;
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
QNetworkAccessManager *m_networkManager; QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest; QNetworkRequest m_networkRequest;
int64_t m_frequencyOffset; int64_t m_frequencyOffset;
uint32_t m_basebandSampleRate; uint32_t m_basebandSampleRate;
int m_count0, m_count1; int m_count0;
int m_count1;
virtual bool handleMessage(const Message& cmd); //!< Processing of a message. Returns true if message has actually been processed bool handleMessage(const Message& cmd) final; //!< Processing of a message. Returns true if message has actually been processed
void applySettings(const BeamSteeringCWModSettings& settings, bool force = false); void applySettings(const BeamSteeringCWModSettings& settings, bool force = false);
static void validateFilterChainHash(BeamSteeringCWModSettings& settings); static void validateFilterChainHash(BeamSteeringCWModSettings& settings);
void calculateFrequencyOffset(); void calculateFrequencyOffset();
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const BeamSteeringCWModSettings& settings, bool force); void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const BeamSteeringCWModSettings& settings, bool force);
void sendChannelSettings( void sendChannelSettings(
const QList<ObjectPipe*>& pipes, const QList<ObjectPipe*>& pipes,
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const BeamSteeringCWModSettings& settings, const BeamSteeringCWModSettings& settings,
bool force bool force
); ) const;
void webapiFormatChannelSettings( void webapiFormatChannelSettings(
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const BeamSteeringCWModSettings& settings, const BeamSteeringCWModSettings& settings,
bool force bool force
); ) const;
private slots: private slots:
void handleInputMessages(); void handleInputMessages();
void networkManagerFinished(QNetworkReply *reply); void networkManagerFinished(QNetworkReply *reply) const;
}; };
#endif // INCLUDE_BEAMSTEERINGCWSOURCE_H #endif // INCLUDE_BEAMSTEERINGCWSOURCE_H

View File

@ -30,15 +30,10 @@
BeamSteeringCWModGUI* BeamSteeringCWModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel) BeamSteeringCWModGUI* BeamSteeringCWModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel)
{ {
BeamSteeringCWModGUI* gui = new BeamSteeringCWModGUI(pluginAPI, deviceUISet, mimoChannel); auto* gui = new BeamSteeringCWModGUI(pluginAPI, deviceUISet, mimoChannel);
return gui; return gui;
} }
void BeamSteeringCWModGUI::destroy()
{
delete this;
}
void BeamSteeringCWModGUI::resetToDefaults() void BeamSteeringCWModGUI::resetToDefaults()
{ {
m_settings.resetToDefaults(); m_settings.resetToDefaults();
@ -67,7 +62,7 @@ bool BeamSteeringCWModGUI::handleMessage(const Message& message)
{ {
if (BeamSteeringCWMod::MsgBasebandNotification::match(message)) if (BeamSteeringCWMod::MsgBasebandNotification::match(message))
{ {
BeamSteeringCWMod::MsgBasebandNotification& notif = (BeamSteeringCWMod::MsgBasebandNotification&) message; auto& notif = (const BeamSteeringCWMod::MsgBasebandNotification&) message;
m_basebandSampleRate = notif.getSampleRate(); m_basebandSampleRate = notif.getSampleRate();
m_centerFrequency = notif.getCenterFrequency(); m_centerFrequency = notif.getCenterFrequency();
displayRateAndShift(); displayRateAndShift();
@ -76,7 +71,7 @@ bool BeamSteeringCWModGUI::handleMessage(const Message& message)
} }
else if (BeamSteeringCWMod::MsgConfigureBeamSteeringCWMod::match(message)) else if (BeamSteeringCWMod::MsgConfigureBeamSteeringCWMod::match(message))
{ {
const BeamSteeringCWMod::MsgConfigureBeamSteeringCWMod& cfg = (BeamSteeringCWMod::MsgConfigureBeamSteeringCWMod&) message; auto& cfg = (const BeamSteeringCWMod::MsgConfigureBeamSteeringCWMod&) message;
m_settings = cfg.getSettings(); m_settings = cfg.getSettings();
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker)); m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
@ -109,7 +104,7 @@ BeamSteeringCWModGUI::BeamSteeringCWModGUI(PluginAPI* pluginAPI, DeviceUISet *de
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
m_bsCWSource = (BeamSteeringCWMod*) mimoChannel; m_bsCWSource = (BeamSteeringCWMod*) mimoChannel;
m_bsCWSource->setMessageQueueToGUI(getInputMessageQueue()); m_bsCWSource->setMessageQueueToGUI(BeamSteeringCWModGUI::getInputMessageQueue());
m_basebandSampleRate = m_bsCWSource->getBasebandSampleRate(); m_basebandSampleRate = m_bsCWSource->getBasebandSampleRate();
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
@ -128,7 +123,7 @@ BeamSteeringCWModGUI::BeamSteeringCWModGUI(PluginAPI* pluginAPI, DeviceUISet *de
m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addChannelMarker(&m_channelMarker);
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(BeamSteeringCWModGUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
displaySettings(); displaySettings();
makeUIConnections(); makeUIConnections();
@ -183,13 +178,13 @@ void BeamSteeringCWModGUI::displaySettings()
void BeamSteeringCWModGUI::displayRateAndShift() void BeamSteeringCWModGUI::displayRateAndShift()
{ {
int shift = m_shiftFrequencyFactor * m_basebandSampleRate; auto shift = (int) (m_shiftFrequencyFactor * m_basebandSampleRate);
double channelSampleRate = ((double) m_basebandSampleRate) / (1<<m_settings.m_log2Interp); double channelSampleRate = ((double) m_basebandSampleRate) / (1<<m_settings.m_log2Interp);
QLocale loc; QLocale loc;
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift))); ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5))); ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
m_channelMarker.setCenterFrequency(shift); m_channelMarker.setCenterFrequency(shift);
m_channelMarker.setBandwidth(channelSampleRate); m_channelMarker.setBandwidth((int) channelSampleRate);
} }
void BeamSteeringCWModGUI::leaveEvent(QEvent*) void BeamSteeringCWModGUI::leaveEvent(QEvent*)
@ -206,7 +201,7 @@ void BeamSteeringCWModGUI::handleSourceMessages()
{ {
Message* message; Message* message;
while ((message = getInputMessageQueue()->pop()) != 0) while ((message = getInputMessageQueue()->pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -215,7 +210,7 @@ void BeamSteeringCWModGUI::handleSourceMessages()
} }
} }
void BeamSteeringCWModGUI::onWidgetRolled(QWidget* widget, bool rollDown) void BeamSteeringCWModGUI::onWidgetRolled(const QWidget* widget, bool rollDown)
{ {
(void) widget; (void) widget;
(void) rollDown; (void) rollDown;
@ -226,7 +221,7 @@ void BeamSteeringCWModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void BeamSteeringCWModGUI::onMenuDialogCalled(const QPoint &p) void BeamSteeringCWModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
@ -316,7 +311,7 @@ void BeamSteeringCWModGUI::tick()
} }
} }
void BeamSteeringCWModGUI::makeUIConnections() void BeamSteeringCWModGUI::makeUIConnections() const
{ {
QObject::connect(ui->channelOutput, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BeamSteeringCWModGUI::on_channelOutput_currentIndexChanged); QObject::connect(ui->channelOutput, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BeamSteeringCWModGUI::on_channelOutput_currentIndexChanged);
QObject::connect(ui->interpolationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BeamSteeringCWModGUI::on_interpolationFactor_currentIndexChanged); QObject::connect(ui->interpolationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &BeamSteeringCWModGUI::on_interpolationFactor_currentIndexChanged);
@ -326,5 +321,5 @@ void BeamSteeringCWModGUI::makeUIConnections()
void BeamSteeringCWModGUI::updateAbsoluteCenterFrequency() void BeamSteeringCWModGUI::updateAbsoluteCenterFrequency()
{ {
setStatusFrequency(m_centerFrequency + m_shiftFrequencyFactor * m_basebandSampleRate); setStatusFrequency(m_centerFrequency + (qint64) (m_shiftFrequencyFactor * m_basebandSampleRate));
} }

View File

@ -47,22 +47,21 @@ class BeamSteeringCWModGUI : public ChannelGUI {
public: public:
static BeamSteeringCWModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel); static BeamSteeringCWModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel);
virtual void destroy(); void resetToDefaults() final;
virtual void resetToDefaults(); QByteArray serialize() const final;
QByteArray serialize() const; bool deserialize(const QByteArray& data) final;
bool deserialize(const QByteArray& data); MessageQueue *getInputMessageQueue() final { return &m_inputMessageQueue; }
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } void setWorkspaceIndex(int index) final { m_settings.m_workspaceIndex = index; };
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; }; int getWorkspaceIndex() const final { return m_settings.m_workspaceIndex; };
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }; void setGeometryBytes(const QByteArray& blob) final { m_settings.m_geometryBytes = blob; };
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }; QByteArray getGeometryBytes() const final { return m_settings.m_geometryBytes; };
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }; QString getTitle() const final { return m_settings.m_title; };
virtual QString getTitle() const { return m_settings.m_title; }; QColor getTitleColor() const final { return m_settings.m_rgbColor; };
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; }; void zetHidden(bool hidden) final { m_settings.m_hidden = hidden; }
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; } bool getHidden() const final { return m_settings.m_hidden; }
virtual bool getHidden() const { return m_settings.m_hidden; } ChannelMarker& getChannelMarker() final { return m_channelMarker; }
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; } int getStreamIndex() const final { return -1; }
virtual int getStreamIndex() const { return -1; } void setStreamIndex(int streamIndex) final { (void) streamIndex; }
virtual void setStreamIndex(int streamIndex) { (void) streamIndex; }
private: private:
Ui::BeamSteeringCWModGUI* ui; Ui::BeamSteeringCWModGUI* ui;
@ -82,18 +81,18 @@ private:
uint32_t m_tickCount; uint32_t m_tickCount;
explicit BeamSteeringCWModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel, QWidget* parent = nullptr); explicit BeamSteeringCWModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel, QWidget* parent = nullptr);
virtual ~BeamSteeringCWModGUI(); ~BeamSteeringCWModGUI() final;
void blockApplySettings(bool block); void blockApplySettings(bool block);
void applySettings(bool force = false); void applySettings(bool force = false);
void displaySettings(); void displaySettings();
void displayRateAndShift(); void displayRateAndShift();
bool handleMessage(const Message& message); bool handleMessage(const Message& message);
void makeUIConnections(); void makeUIConnections() const;
void updateAbsoluteCenterFrequency(); void updateAbsoluteCenterFrequency();
void leaveEvent(QEvent*); void leaveEvent(QEvent*) final;
void enterEvent(EnterEventType*); void enterEvent(EnterEventType*) final;
void applyInterpolation(); void applyInterpolation();
void applyPosition(); void applyPosition();
@ -104,7 +103,7 @@ private slots:
void on_interpolationFactor_currentIndexChanged(int index); void on_interpolationFactor_currentIndexChanged(int index);
void on_position_valueChanged(int value); void on_position_valueChanged(int value);
void on_steeringDegrees_valueChanged(int value); void on_steeringDegrees_valueChanged(int value);
void onWidgetRolled(QWidget* widget, bool rollDown); void onWidgetRolled(const QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void tick(); void tick();
}; };

View File

@ -48,7 +48,6 @@ DOA2::DOA2(DeviceAPI *deviceAPI) :
m_thread(nullptr), m_thread(nullptr),
m_basebandSink(nullptr), m_basebandSink(nullptr),
m_running(false), m_running(false),
m_guiMessageQueue(nullptr),
m_frequencyOffset(0), m_frequencyOffset(0),
m_deviceSampleRate(48000), m_deviceSampleRate(48000),
m_deviceCenterFrequency(435000000) m_deviceCenterFrequency(435000000)
@ -65,7 +64,7 @@ DOA2::DOA2(DeviceAPI *deviceAPI) :
this, this,
&DOA2::networkManagerFinished &DOA2::networkManagerFinished
); );
startSinks(); DOA2::startSinks();
} }
DOA2::~DOA2() DOA2::~DOA2()
@ -80,7 +79,7 @@ DOA2::~DOA2()
m_deviceAPI->removeChannelSinkAPI(this); m_deviceAPI->removeChannelSinkAPI(this);
m_deviceAPI->removeMIMOChannel(this); m_deviceAPI->removeMIMOChannel(this);
stopSinks(); DOA2::stopSinks();
} }
void DOA2::setDeviceAPI(DeviceAPI *deviceAPI) void DOA2::setDeviceAPI(DeviceAPI *deviceAPI)
@ -203,7 +202,7 @@ void DOA2::applySettings(const DOA2Settings& settings, bool force)
reverseAPIKeys.append("squelchdB"); reverseAPIKeys.append("squelchdB");
if (m_running) { if (m_running) {
m_basebandSink->setMagThreshold(CalcDb::powerFromdB(settings.m_squelchdB)); m_basebandSink->setMagThreshold((float) CalcDb::powerFromdB(settings.m_squelchdB));
} }
} }
@ -238,7 +237,7 @@ void DOA2::applySettings(const DOA2Settings& settings, bool force)
QList<ObjectPipe*> pipes; QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes); MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
if (pipes.size() > 0) { if (!pipes.empty()) {
sendChannelSettings(pipes, reverseAPIKeys, settings, force); sendChannelSettings(pipes, reverseAPIKeys, settings, force);
} }
@ -249,7 +248,7 @@ void DOA2::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -262,14 +261,14 @@ bool DOA2::handleMessage(const Message& cmd)
{ {
if (MsgConfigureDOA2::match(cmd)) if (MsgConfigureDOA2::match(cmd))
{ {
MsgConfigureDOA2& cfg = (MsgConfigureDOA2&) cmd; auto& cfg = (const MsgConfigureDOA2&) cmd;
qDebug() << "DOA2::handleMessage: MsgConfigureDOA2"; qDebug() << "DOA2::handleMessage: MsgConfigureDOA2";
applySettings(cfg.getSettings(), cfg.getForce()); applySettings(cfg.getSettings(), cfg.getForce());
return true; return true;
} }
else if (DSPMIMOSignalNotification::match(cmd)) else if (DSPMIMOSignalNotification::match(cmd))
{ {
DSPMIMOSignalNotification& notif = (DSPMIMOSignalNotification&) cmd; auto& notif = (const DSPMIMOSignalNotification&) cmd;
qDebug() << "DOA2::handleMessage: DSPMIMOSignalNotification:" qDebug() << "DOA2::handleMessage: DSPMIMOSignalNotification:"
<< " inputSampleRate: " << notif.getSampleRate() << " inputSampleRate: " << notif.getSampleRate()
@ -347,7 +346,7 @@ void DOA2::validateFilterChainHash(DOA2Settings& settings)
void DOA2::calculateFrequencyOffset() void DOA2::calculateFrequencyOffset()
{ {
double shiftFactor = HBFilterChainConverter::getShiftFactor(m_settings.m_log2Decim, m_settings.m_filterChainHash); double shiftFactor = HBFilterChainConverter::getShiftFactor(m_settings.m_log2Decim, m_settings.m_filterChainHash);
m_frequencyOffset = m_deviceSampleRate * shiftFactor; m_frequencyOffset = (int64_t) (m_deviceSampleRate * shiftFactor);
} }
void DOA2::applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash) void DOA2::applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash)
@ -360,12 +359,12 @@ void DOA2::applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash)
m_basebandSink->getInputMessageQueue()->push(msg); m_basebandSink->getInputMessageQueue()->push(msg);
} }
float DOA2::getPhi() const double DOA2::getPhi() const
{ {
return m_basebandSink ? m_basebandSink->getPhi() : 0.0f; return m_basebandSink ? m_basebandSink->getPhi() : 0.0;
} }
float DOA2::getPositiveDOA() const double DOA2::getPositiveDOA() const
{ {
return std::acos(getPhi()/M_PI)*(180/M_PI); return std::acos(getPhi()/M_PI)*(180/M_PI);
} }
@ -469,13 +468,13 @@ void DOA2::webapiUpdateChannelSettings(
settings.m_reverseAPIAddress = *response.getDoa2Settings()->getReverseApiAddress(); settings.m_reverseAPIAddress = *response.getDoa2Settings()->getReverseApiAddress();
} }
if (channelSettingsKeys.contains("reverseAPIPort")) { if (channelSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getDoa2Settings()->getReverseApiPort(); settings.m_reverseAPIPort = (uint16_t) response.getDoa2Settings()->getReverseApiPort();
} }
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) { if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getDoa2Settings()->getReverseApiDeviceIndex(); settings.m_reverseAPIDeviceIndex = (uint16_t) response.getDoa2Settings()->getReverseApiDeviceIndex();
} }
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
settings.m_reverseAPIChannelIndex = response.getDoa2Settings()->getReverseApiChannelIndex(); settings.m_reverseAPIChannelIndex = (uint16_t) response.getDoa2Settings()->getReverseApiChannelIndex();
} }
if (settings.m_scopeGUI && channelSettingsKeys.contains("scopeConfig")) { if (settings.m_scopeGUI && channelSettingsKeys.contains("scopeConfig")) {
settings.m_scopeGUI->updateFrom(channelSettingsKeys, response.getDoa2Settings()->getScopeConfig()); settings.m_scopeGUI->updateFrom(channelSettingsKeys, response.getDoa2Settings()->getScopeConfig());
@ -525,7 +524,7 @@ void DOA2::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response
} }
else else
{ {
SWGSDRangel::SWGGLScope *swgGLScope = new SWGSDRangel::SWGGLScope(); auto *swgGLScope = new SWGSDRangel::SWGGLScope();
settings.m_scopeGUI->formatTo(swgGLScope); settings.m_scopeGUI->formatTo(swgGLScope);
response.getDoa2Settings()->setScopeConfig(swgGLScope); response.getDoa2Settings()->setScopeConfig(swgGLScope);
} }
@ -539,7 +538,7 @@ void DOA2::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response
} }
else else
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
response.getDoa2Settings()->setChannelMarker(swgChannelMarker); response.getDoa2Settings()->setChannelMarker(swgChannelMarker);
} }
@ -553,39 +552,39 @@ void DOA2::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response
} }
else else
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
response.getDoa2Settings()->setRollupState(swgRollupState); response.getDoa2Settings()->setRollupState(swgRollupState);
} }
} }
} }
void DOA2::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) void DOA2::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const
{ {
float phi = normalizeAngle(getPhi() * (180/M_PI), 180.0f); double phi = normalizeAngle(getPhi() * (180.0/M_PI), 180.0);
response.getDoa2Report()->setPhi(phi); response.getDoa2Report()->setPhi((qint32) phi);
float hwl = 1.5e8 / (m_deviceCenterFrequency + m_frequencyOffset); double hwl = 1.5e8 / (double) (m_deviceCenterFrequency + m_frequencyOffset);
float cosTheta = (getPhi()/M_PI) * ((hwl * 1000.0) / m_settings.m_basebandDistance); double cosTheta = (getPhi()/M_PI) * ((hwl * 1000.0) / m_settings.m_basebandDistance);
float blindAngle = (m_settings.m_basebandDistance > hwl * 1000.0) ? double blindAngle = (m_settings.m_basebandDistance > hwl * 1000.0) ?
std::acos((hwl * 1000.0) / m_settings.m_basebandDistance) * (180/M_PI) : std::acos((hwl * 1000.0) / m_settings.m_basebandDistance) * (180/M_PI) :
0; 0;
response.getDoa2Report()->setBlindAngle((int) blindAngle); response.getDoa2Report()->setBlindAngle((int) blindAngle);
float doaAngle = std::acos(cosTheta < -1.0 ? -1.0 : cosTheta > 1.0 ? 1.0 : cosTheta) * (180/M_PI); double doaAngle = std::acos(cosTheta < -1.0 ? -1.0 : cosTheta > 1.0 ? 1.0 : cosTheta) * (180.0/M_PI);
qDebug("DOA2::webapiFormatChannelReport: phi: %f cosT: %f DOAngle: %f", getPhi(), cosTheta, doaAngle); qDebug("DOA2::webapiFormatChannelReport: phi: %f cosT: %f DOAngle: %f", getPhi(), cosTheta, doaAngle);
float posAngle = normalizeAngle(m_settings.m_antennaAz - doaAngle, 360.0f); // DOA angles are trigonometric but displayed angles are clockwise double posAngle = normalizeAngle(m_settings.m_antennaAz - doaAngle, 360.0); // DOA angles are trigonometric but displayed angles are clockwise
float negAngle = normalizeAngle(m_settings.m_antennaAz + doaAngle, 360.0f); double negAngle = normalizeAngle(m_settings.m_antennaAz + doaAngle, 360.0);
response.getDoa2Report()->setPosAz(posAngle); response.getDoa2Report()->setPosAz((qint32) posAngle);
response.getDoa2Report()->setNegAz(negAngle); response.getDoa2Report()->setNegAz((qint32) negAngle);
response.getDoa2Report()->setFftSize(m_fftSize); response.getDoa2Report()->setFftSize(m_fftSize);
int channelSampleRate = m_deviceSampleRate / (1<<m_settings.m_log2Decim); int channelSampleRate = m_deviceSampleRate / (1<<m_settings.m_log2Decim);
response.getDoa2Report()->setChannelSampleRate(channelSampleRate); response.getDoa2Report()->setChannelSampleRate(channelSampleRate);
} }
void DOA2::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const DOA2Settings& settings, bool force) void DOA2::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const DOA2Settings& settings, bool force)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -596,8 +595,8 @@ void DOA2::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const
m_networkRequest.setUrl(QUrl(channelSettingsURL)); m_networkRequest.setUrl(QUrl(channelSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QBuffer *buffer = new QBuffer(); auto *buffer = new QBuffer();
buffer->open((QBuffer::ReadWrite)); buffer->open(QBuffer::ReadWrite);
buffer->write(swgChannelSettings->asJson().toUtf8()); buffer->write(swgChannelSettings->asJson().toUtf8());
buffer->seek(0); buffer->seek(0);
@ -610,9 +609,9 @@ void DOA2::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const
void DOA2::sendChannelSettings( void DOA2::sendChannelSettings(
const QList<ObjectPipe*>& pipes, const QList<ObjectPipe*>& pipes,
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const DOA2Settings& settings, const DOA2Settings& settings,
bool force) bool force) const
{ {
for (const auto& pipe : pipes) for (const auto& pipe : pipes)
{ {
@ -620,7 +619,7 @@ void DOA2::sendChannelSettings(
if (messageQueue) if (messageQueue)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create( MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
this, this,
@ -634,11 +633,11 @@ void DOA2::sendChannelSettings(
} }
void DOA2::webapiFormatChannelSettings( void DOA2::webapiFormatChannelSettings(
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const DOA2Settings& settings, const DOA2Settings& settings,
bool force bool force
) ) const
{ {
swgChannelSettings->setDirection(2); // MIMO sink swgChannelSettings->setDirection(2); // MIMO sink
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet()); swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
@ -677,29 +676,26 @@ void DOA2::webapiFormatChannelSettings(
swgDOA2Settings->setFftAveragingValue(DOA2Settings::getAveragingValue(settings.m_fftAveragingIndex)); swgDOA2Settings->setFftAveragingValue(DOA2Settings::getAveragingValue(settings.m_fftAveragingIndex));
} }
if (settings.m_scopeGUI) if ((settings.m_scopeGUI) && (channelSettingsKeys.contains("scopeConfig") || force)) {
{
if (channelSettingsKeys.contains("scopeConfig") || force) {
settings.m_scopeGUI->formatTo(swgDOA2Settings->getScopeConfig()); settings.m_scopeGUI->formatTo(swgDOA2Settings->getScopeConfig());
} }
}
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force)) if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
swgDOA2Settings->setChannelMarker(swgChannelMarker); swgDOA2Settings->setChannelMarker(swgChannelMarker);
} }
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force)) if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
swgDOA2Settings->setRollupState(swgRollupState); swgDOA2Settings->setRollupState(swgRollupState);
} }
} }
void DOA2::networkManagerFinished(QNetworkReply *reply) void DOA2::networkManagerFinished(QNetworkReply *reply) const
{ {
QNetworkReply::NetworkError replyError = reply->error(); QNetworkReply::NetworkError replyError = reply->error();
@ -720,7 +716,7 @@ void DOA2::networkManagerFinished(QNetworkReply *reply)
reply->deleteLater(); reply->deleteLater();
} }
float DOA2::normalizeAngle(float angle, float max) double DOA2::normalizeAngle(double angle, double max)
{ {
if (angle < 0) { return max + angle; } if (angle < 0) { return max + angle; }
if (angle > max) { return angle - max; } if (angle > max) { return angle - max; }

View File

@ -86,67 +86,64 @@ public:
qint64 m_centerFrequency; qint64 m_centerFrequency;
}; };
DOA2(DeviceAPI *deviceAPI); explicit DOA2(DeviceAPI *deviceAPI);
virtual ~DOA2(); ~DOA2() final;
virtual void destroy() { delete this; } void destroy() final { delete this; }
virtual void setDeviceAPI(DeviceAPI *deviceAPI); void setDeviceAPI(DeviceAPI *deviceAPI) final;
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; } DeviceAPI *getDeviceAPI() final { return m_deviceAPI; }
virtual void startSinks(); //!< thread start() void startSinks() final; //!< thread start()
virtual void stopSinks(); //!< thread exit() and wait() void stopSinks() final; //!< thread exit() and wait()
virtual void startSources() {} void startSources() final { /* Not for MIMO */ }
virtual void stopSources() {} void stopSources() final { /* Not for MIMO */ }
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex); void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex) final;
virtual void pull(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex); void pull(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) final;
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); } void pushMessage(Message *msg) final { m_inputMessageQueue.push(msg); }
virtual QString getMIMOName() { return objectName(); } QString getMIMOName() final { return objectName(); }
virtual void getIdentifier(QString& id) { id = objectName(); } void getIdentifier(QString& id) final { id = objectName(); }
virtual QString getIdentifier() const { return objectName(); } QString getIdentifier() const final { return objectName(); }
virtual void getTitle(QString& title) { title = "DOA 2 sources"; } void getTitle(QString& title) final { title = "DOA 2 sources"; }
virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } qint64 getCenterFrequency() const final { return m_frequencyOffset; }
virtual void setCenterFrequency(qint64) {} void setCenterFrequency(qint64) final { /* Not for MIMO */ }
uint32_t getDeviceSampleRate() const { return m_deviceSampleRate; } uint32_t getDeviceSampleRate() const { return m_deviceSampleRate; }
virtual QByteArray serialize() const; QByteArray serialize() const final;
virtual bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data) final;
virtual int getNbSinkStreams() const { return 2; } int getNbSinkStreams() const final { return 2; }
virtual int getNbSourceStreams() const { return 0; } int getNbSourceStreams() const final { return 0; }
virtual int getStreamIndex() const { return -1; } int getStreamIndex() const final { return -1; }
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const final
{ {
(void) streamIndex; (void) streamIndex;
(void) sinkElseSource; (void) sinkElseSource;
return m_frequencyOffset; return m_frequencyOffset;
} }
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
ScopeVis *getScopeVis() { return &m_scopeSink; } ScopeVis *getScopeVis() { return &m_scopeSink; }
void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash); void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash);
float getPhi() const; double getPhi() const;
float getPositiveDOA() const; double getPositiveDOA() const;
virtual int webapiSettingsGet( int webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage); QString& errorMessage) final;
virtual int webapiSettingsPutPatch( int webapiSettingsPutPatch(
bool force, bool force,
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage); QString& errorMessage) final;
virtual int webapiReportGet( int webapiReportGet(
SWGSDRangel::SWGChannelReport& response, SWGSDRangel::SWGChannelReport& response,
QString& errorMessage); QString& errorMessage) final;
virtual int webapiWorkspaceGet( int webapiWorkspaceGet(
SWGSDRangel::SWGWorkspaceInfo& query, SWGSDRangel::SWGWorkspaceInfo& query,
QString& errorMessage); QString& errorMessage) final;
static void webapiFormatChannelSettings( static void webapiFormatChannelSettings(
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
@ -169,7 +166,6 @@ private:
QMutex m_mutex; QMutex m_mutex;
bool m_running; bool m_running;
DOA2Settings m_settings; DOA2Settings m_settings;
MessageQueue *m_guiMessageQueue; //!< Input message queue to the GUI
QNetworkAccessManager *m_networkManager; QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest; QNetworkRequest m_networkRequest;
@ -177,31 +173,32 @@ private:
int64_t m_frequencyOffset; int64_t m_frequencyOffset;
uint32_t m_deviceSampleRate; uint32_t m_deviceSampleRate;
qint64 m_deviceCenterFrequency; qint64 m_deviceCenterFrequency;
int m_count0, m_count1; int m_count0;
int m_count1;
virtual bool handleMessage(const Message& cmd); //!< Processing of a message. Returns true if message has actually been processed bool handleMessage(const Message& cmd) final; //!< Processing of a message. Returns true if message has actually been processed
void applySettings(const DOA2Settings& settings, bool force = false); void applySettings(const DOA2Settings& settings, bool force = false);
static void validateFilterChainHash(DOA2Settings& settings); static void validateFilterChainHash(DOA2Settings& settings);
void calculateFrequencyOffset(); void calculateFrequencyOffset();
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response); void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const;
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const DOA2Settings& settings, bool force); void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const DOA2Settings& settings, bool force);
void sendChannelSettings( void sendChannelSettings(
const QList<ObjectPipe*>& pipes, const QList<ObjectPipe*>& pipes,
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const DOA2Settings& settings, const DOA2Settings& settings,
bool force bool force
); ) const;
void webapiFormatChannelSettings( void webapiFormatChannelSettings(
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const DOA2Settings& settings, const DOA2Settings& settings,
bool force bool force
); ) const;
static float normalizeAngle(float angle, float max); static double normalizeAngle(double angle, double max);
private slots: private slots:
void handleInputMessages(); void handleInputMessages();
void networkManagerFinished(QNetworkReply *reply); void networkManagerFinished(QNetworkReply *reply) const;
}; };
#endif // INCLUDE_DOA2_H #endif // INCLUDE_DOA2_H

View File

@ -73,7 +73,7 @@ public:
private: private:
DOA2Settings::CorrelationType m_correlationType; DOA2Settings::CorrelationType m_correlationType;
MsgConfigureCorrelation(DOA2Settings::CorrelationType correlationType) : explicit MsgConfigureCorrelation(DOA2Settings::CorrelationType correlationType) :
Message(), Message(),
m_correlationType(correlationType) m_correlationType(correlationType)
{} {}
@ -103,8 +103,8 @@ public:
{ } { }
}; };
DOA2Baseband(int fftSize); explicit DOA2Baseband(int fftSize);
~DOA2Baseband(); ~DOA2Baseband() final;
void reset(); void reset();
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
@ -114,7 +114,7 @@ public:
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int streamIndex); void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int streamIndex);
void setBasebandSampleRate(unsigned int sampleRate); void setBasebandSampleRate(unsigned int sampleRate);
float getPhi() const { return m_phi; } double getPhi() const { return m_phi; }
void setMagThreshold(float threshold) { m_magThreshold = threshold * SDR_RX_SCALED * SDR_RX_SCALED; } void setMagThreshold(float threshold) { m_magThreshold = threshold * SDR_RX_SCALED * SDR_RX_SCALED; }
void setFFTAveraging(int nbFFT); void setFFTAveraging(int nbFFT);
@ -128,9 +128,9 @@ private:
DOA2Settings::CorrelationType m_correlationType; DOA2Settings::CorrelationType m_correlationType;
int m_fftSize; int m_fftSize;
int m_samplesCount; //!< Number of samples processed by DOA int m_samplesCount; //!< Number of samples processed by DOA
float m_magSum; //!< Squared magnitudes accumulator double m_magSum; //!< Squared magnitudes accumulator
float m_wphSum; //!< Phase difference accumulator (averaging weighted by squared magnitude) double m_wphSum; //!< Phase difference accumulator (averaging weighted by squared magnitude)
float m_phi; //!< Resulting calculated phase difference double m_phi; //!< Resulting calculated phase difference
double m_magThreshold; //!< Squared magnitude scaled threshold double m_magThreshold; //!< Squared magnitude scaled threshold
int m_fftAvg; //!< Average over a certain number of FFTs int m_fftAvg; //!< Average over a certain number of FFTs
int m_fftAvgCount; //!< FFT averaging counter int m_fftAvgCount; //!< FFT averaging counter

View File

@ -33,15 +33,10 @@
DOA2GUI* DOA2GUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *channelMIMO) DOA2GUI* DOA2GUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *channelMIMO)
{ {
DOA2GUI* gui = new DOA2GUI(pluginAPI, deviceUISet, channelMIMO); auto* gui = new DOA2GUI(pluginAPI, deviceUISet, channelMIMO);
return gui; return gui;
} }
void DOA2GUI::destroy()
{
delete this;
}
void DOA2GUI::resetToDefaults() void DOA2GUI::resetToDefaults()
{ {
m_settings.resetToDefaults(); m_settings.resetToDefaults();
@ -78,7 +73,7 @@ bool DOA2GUI::handleMessage(const Message& message)
{ {
if (DOA2::MsgBasebandNotification::match(message)) if (DOA2::MsgBasebandNotification::match(message))
{ {
DOA2::MsgBasebandNotification& notif = (DOA2::MsgBasebandNotification&) message; auto& notif = (const DOA2::MsgBasebandNotification&) message;
m_sampleRate = notif.getSampleRate(); m_sampleRate = notif.getSampleRate();
m_centerFrequency = notif.getCenterFrequency(); m_centerFrequency = notif.getCenterFrequency();
displayRateAndShift(); displayRateAndShift();
@ -88,7 +83,7 @@ bool DOA2GUI::handleMessage(const Message& message)
} }
else if (DOA2::MsgConfigureDOA2::match(message)) else if (DOA2::MsgConfigureDOA2::match(message))
{ {
const DOA2::MsgConfigureDOA2& notif = (const DOA2::MsgConfigureDOA2&) message; auto& notif = (const DOA2::MsgConfigureDOA2&) message;
m_settings = notif.getSettings(); m_settings = notif.getSettings();
ui->scopeGUI->updateSettings(); ui->scopeGUI->updateSettings();
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker)); m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
@ -122,7 +117,7 @@ DOA2GUI::DOA2GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *ch
m_doa2 = (DOA2*) channelMIMO; m_doa2 = (DOA2*) channelMIMO;
m_scopeVis = m_doa2->getScopeVis(); m_scopeVis = m_doa2->getScopeVis();
m_scopeVis->setGLScope(ui->glScope); m_scopeVis->setGLScope(ui->glScope);
m_doa2->setMessageQueueToGUI(getInputMessageQueue()); m_doa2->setMessageQueueToGUI(DOA2GUI::getInputMessageQueue());
m_sampleRate = m_doa2->getDeviceSampleRate(); m_sampleRate = m_doa2->getDeviceSampleRate();
ui->glScope->setTraceModulo(DOA2::m_fftSize); ui->glScope->setTraceModulo(DOA2::m_fftSize);
@ -150,7 +145,7 @@ DOA2GUI::DOA2GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *ch
ui->scopeGUI->traceLengthChange(); ui->scopeGUI->traceLengthChange();
ui->compass->setBlindAngleBorder(true); ui->compass->setBlindAngleBorder(true);
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(DOA2GUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
displaySettings(); displaySettings();
makeUIConnections(); makeUIConnections();
@ -221,20 +216,20 @@ void DOA2GUI::displaySettings()
void DOA2GUI::displayRateAndShift() void DOA2GUI::displayRateAndShift()
{ {
int shift = m_shiftFrequencyFactor * m_sampleRate; auto shift = (int) (m_shiftFrequencyFactor * m_sampleRate);
double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Decim); double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Decim);
QLocale loc; QLocale loc;
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift))); ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5))); ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
m_channelMarker.setCenterFrequency(shift); m_channelMarker.setCenterFrequency(shift);
m_channelMarker.setBandwidth(channelSampleRate); m_channelMarker.setBandwidth((int) channelSampleRate);
m_scopeVis->setLiveRate(channelSampleRate); m_scopeVis->setLiveRate((int) channelSampleRate);
} }
void DOA2GUI::setFFTAveragingTooltip() void DOA2GUI::setFFTAveragingTooltip()
{ {
float channelSampleRate = ((float) m_sampleRate) / (1<<m_settings.m_log2Decim); float channelSampleRate = ((float) m_sampleRate) / ((float) (1<<m_settings.m_log2Decim));
float averagingTime = (DOA2::m_fftSize * DOA2Settings::getAveragingValue(m_settings.m_fftAveragingIndex)) / float averagingTime = ((float) DOA2::m_fftSize * (float) DOA2Settings::getAveragingValue(m_settings.m_fftAveragingIndex)) /
channelSampleRate; channelSampleRate;
QString s; QString s;
setNumberStr(averagingTime, 2, s); setNumberStr(averagingTime, 2, s);
@ -274,7 +269,7 @@ void DOA2GUI::handleSourceMessages()
{ {
Message* message; Message* message;
while ((message = getInputMessageQueue()->pop()) != 0) while ((message = getInputMessageQueue()->pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -283,7 +278,7 @@ void DOA2GUI::handleSourceMessages()
} }
} }
void DOA2GUI::onWidgetRolled(QWidget* widget, bool rollDown) void DOA2GUI::onWidgetRolled(const QWidget* widget, bool rollDown)
{ {
(void) widget; (void) widget;
(void) rollDown; (void) rollDown;
@ -294,7 +289,7 @@ void DOA2GUI::onWidgetRolled(QWidget* widget, bool rollDown)
void DOA2GUI::onMenuDialogCalled(const QPoint &p) void DOA2GUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
@ -434,7 +429,7 @@ void DOA2GUI::tick()
} }
} }
void DOA2GUI::makeUIConnections() void DOA2GUI::makeUIConnections() const
{ {
QObject::connect(ui->decimationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DOA2GUI::on_decimationFactor_currentIndexChanged); QObject::connect(ui->decimationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &DOA2GUI::on_decimationFactor_currentIndexChanged);
QObject::connect(ui->position, &QSlider::valueChanged, this, &DOA2GUI::on_position_valueChanged); QObject::connect(ui->position, &QSlider::valueChanged, this, &DOA2GUI::on_position_valueChanged);
@ -449,9 +444,9 @@ void DOA2GUI::makeUIConnections()
void DOA2GUI::updateAbsoluteCenterFrequency() void DOA2GUI::updateAbsoluteCenterFrequency()
{ {
qint64 cf = m_centerFrequency + m_shiftFrequencyFactor * m_sampleRate; auto cf = (qint64) ((double) m_centerFrequency + m_shiftFrequencyFactor * m_sampleRate);
setStatusFrequency(cf); setStatusFrequency(cf);
m_hwl = 1.5e+8 / cf; m_hwl = 1.5e+8 / (double) cf;
ui->halfWLText->setText(tr("%1").arg(m_hwl*1000, 5, 'f', 0)); ui->halfWLText->setText(tr("%1").arg(m_hwl*1000, 5, 'f', 0));
updateScopeFScale(); updateScopeFScale();
} }
@ -470,14 +465,14 @@ void DOA2GUI::updateScopeFScale()
void DOA2GUI::updateDOA() void DOA2GUI::updateDOA()
{ {
float cosTheta = (m_doa2->getPhi()/M_PI) * ((m_hwl * 1000.0) / m_settings.m_basebandDistance); double cosTheta = (m_doa2->getPhi()/M_PI) * ((m_hwl * 1000.0) / m_settings.m_basebandDistance);
float blindAngle = (m_settings.m_basebandDistance > m_hwl * 1000.0) ? double blindAngle = (m_settings.m_basebandDistance > m_hwl * 1000.0) ?
std::acos((m_hwl * 1000.0) / m_settings.m_basebandDistance) * (180/M_PI) : std::acos((m_hwl * 1000.0) / m_settings.m_basebandDistance) * (180/M_PI) :
0; 0;
ui->compass->setBlindAngle(blindAngle); ui->compass->setBlindAngle(blindAngle);
float doaAngle = std::acos(cosTheta < -1.0 ? -1.0 : cosTheta > 1.0 ? 1.0 : cosTheta) * (180/M_PI); double doaAngle = std::acos(cosTheta < -1.0 ? -1.0 : cosTheta > 1.0 ? 1.0 : cosTheta) * (180/M_PI);
float posAngle = ui->antAz->value() - doaAngle; // DOA angles are trigonometric but displayed angles are clockwise double posAngle = ui->antAz->value() - doaAngle; // DOA angles are trigonometric but displayed angles are clockwise
float negAngle = ui->antAz->value() + doaAngle; double negAngle = ui->antAz->value() + doaAngle;
ui->compass->setAzPos(posAngle); ui->compass->setAzPos(posAngle);
ui->compass->setAzNeg(negAngle); ui->compass->setAzNeg(negAngle);
ui->posText->setText(tr("%1").arg(ui->compass->getAzPos(), 3, 'f', 0, QLatin1Char('0'))); ui->posText->setText(tr("%1").arg(ui->compass->getAzPos(), 3, 'f', 0, QLatin1Char('0')));

View File

@ -46,22 +46,21 @@ class DOA2GUI : public ChannelGUI {
public: public:
static DOA2GUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel); static DOA2GUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel);
virtual void destroy(); void resetToDefaults() final;
virtual void resetToDefaults(); QByteArray serialize() const final;
virtual QByteArray serialize() const; bool deserialize(const QByteArray& data) final;
virtual bool deserialize(const QByteArray& data); MessageQueue* getInputMessageQueue() final;
virtual MessageQueue* getInputMessageQueue(); void setWorkspaceIndex(int index) final { m_settings.m_workspaceIndex = index; };
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; }; int getWorkspaceIndex() const final { return m_settings.m_workspaceIndex; };
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }; void setGeometryBytes(const QByteArray& blob) final { m_settings.m_geometryBytes = blob; };
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }; QByteArray getGeometryBytes() const final { return m_settings.m_geometryBytes; };
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }; QString getTitle() const final { return m_settings.m_title; };
virtual QString getTitle() const { return m_settings.m_title; }; QColor getTitleColor() const final { return m_settings.m_rgbColor; };
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; }; void zetHidden(bool hidden) final { m_settings.m_hidden = hidden; }
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; } bool getHidden() const final { return m_settings.m_hidden; }
virtual bool getHidden() const { return m_settings.m_hidden; } ChannelMarker& getChannelMarker() final { return m_channelMarker; }
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; } int getStreamIndex() const final { return -1; }
virtual int getStreamIndex() const { return -1; } void setStreamIndex(int streamIndex) final { (void) streamIndex; }
virtual void setStreamIndex(int streamIndex) { (void) streamIndex; }
private: private:
Ui::DOA2GUI* ui; Ui::DOA2GUI* ui;
@ -82,7 +81,7 @@ private:
double m_hwl; //!< Half wavelength at center frequency double m_hwl; //!< Half wavelength at center frequency
explicit DOA2GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *rxChannel, QWidget* parent = nullptr); explicit DOA2GUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *rxChannel, QWidget* parent = nullptr);
virtual ~DOA2GUI(); ~DOA2GUI() final;
void blockApplySettings(bool block); void blockApplySettings(bool block);
void applySettings(bool force = false); void applySettings(bool force = false);
@ -93,13 +92,13 @@ private:
void setFFTAveragingTooltip(); void setFFTAveragingTooltip();
static void setNumberStr(float v, int decimalPlaces, QString& s); static void setNumberStr(float v, int decimalPlaces, QString& s);
bool handleMessage(const Message& message); bool handleMessage(const Message& message);
void makeUIConnections(); void makeUIConnections() const;
void updateAbsoluteCenterFrequency(); void updateAbsoluteCenterFrequency();
void updateScopeFScale(); void updateScopeFScale();
void updateDOA(); void updateDOA();
void leaveEvent(QEvent*); void leaveEvent(QEvent*) final;
void enterEvent(EnterEventType*); void enterEvent(EnterEventType*) final;
private slots: private slots:
void handleSourceMessages(); void handleSourceMessages();
@ -112,7 +111,7 @@ private slots:
void on_squelch_valueChanged(int value); void on_squelch_valueChanged(int value);
void on_fftAveraging_currentIndexChanged(int index); void on_fftAveraging_currentIndexChanged(int index);
void on_centerPosition_clicked(); void on_centerPosition_clicked();
void onWidgetRolled(QWidget* widget, bool rollDown); void onWidgetRolled(const QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void tick(); void tick();
}; };

View File

@ -83,7 +83,7 @@ Interferometer::Interferometer(DeviceAPI *deviceAPI) :
&Interferometer::updateDeviceSetList &Interferometer::updateDeviceSetList
); );
updateDeviceSetList(); updateDeviceSetList();
startSinks(); Interferometer::startSinks();
} }
Interferometer::~Interferometer() Interferometer::~Interferometer()
@ -98,7 +98,7 @@ Interferometer::~Interferometer()
m_deviceAPI->removeChannelSinkAPI(this); m_deviceAPI->removeChannelSinkAPI(this);
m_deviceAPI->removeMIMOChannel(this); m_deviceAPI->removeMIMOChannel(this);
stopSinks(); Interferometer::stopSinks();
} }
void Interferometer::setDeviceAPI(DeviceAPI *deviceAPI) void Interferometer::setDeviceAPI(DeviceAPI *deviceAPI)
@ -229,7 +229,7 @@ void Interferometer::applySettings(const InterferometerSettings& settings, const
QList<ObjectPipe*> pipes; QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes); MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
if (pipes.size() > 0) { if (!pipes.empty()) {
sendChannelSettings(pipes, settingsKeys, settings, force); sendChannelSettings(pipes, settingsKeys, settings, force);
} }
@ -254,7 +254,7 @@ void Interferometer::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -267,14 +267,14 @@ bool Interferometer::handleMessage(const Message& cmd)
{ {
if (MsgConfigureInterferometer::match(cmd)) if (MsgConfigureInterferometer::match(cmd))
{ {
MsgConfigureInterferometer& cfg = (MsgConfigureInterferometer&) cmd; auto& cfg = (const MsgConfigureInterferometer&) cmd;
qDebug() << "Interferometer::handleMessage: MsgConfigureInterferometer"; qDebug() << "Interferometer::handleMessage: MsgConfigureInterferometer";
applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce()); applySettings(cfg.getSettings(), cfg.getSettingsKeys(), cfg.getForce());
return true; return true;
} }
else if (DSPMIMOSignalNotification::match(cmd)) else if (DSPMIMOSignalNotification::match(cmd))
{ {
DSPMIMOSignalNotification& notif = (DSPMIMOSignalNotification&) cmd; auto& notif = (const DSPMIMOSignalNotification&) cmd;
qDebug() << "Interferometer::handleMessage: DSPMIMOSignalNotification:" qDebug() << "Interferometer::handleMessage: DSPMIMOSignalNotification:"
<< " inputSampleRate: " << notif.getSampleRate() << " inputSampleRate: " << notif.getSampleRate()
@ -355,7 +355,7 @@ void Interferometer::validateFilterChainHash(InterferometerSettings& settings)
void Interferometer::calculateFrequencyOffset(uint32_t log2Decim, uint32_t filterChainHash) void Interferometer::calculateFrequencyOffset(uint32_t log2Decim, uint32_t filterChainHash)
{ {
double shiftFactor = HBFilterChainConverter::getShiftFactor(log2Decim, filterChainHash); double shiftFactor = HBFilterChainConverter::getShiftFactor(log2Decim, filterChainHash);
m_frequencyOffset = m_deviceSampleRate * shiftFactor; m_frequencyOffset = (int64_t) (m_deviceSampleRate * shiftFactor);
} }
void Interferometer::applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash) void Interferometer::applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash)
@ -383,7 +383,7 @@ void Interferometer::updateDeviceSetList()
if (deviceSourceEngine) if (deviceSourceEngine)
{ {
DeviceSampleSource *deviceSource = deviceSourceEngine->getSource(); const DeviceSampleSource *deviceSource = deviceSourceEngine->getSource();
if (deviceSource->getDeviceDescription() == "LocalInput") { if (deviceSource->getDeviceDescription() == "LocalInput") {
m_localInputDeviceIndexes.append(deviceSetIndex); m_localInputDeviceIndexes.append(deviceSetIndex);
@ -401,7 +401,7 @@ void Interferometer::updateDeviceSetList()
InterferometerSettings settings = m_settings; InterferometerSettings settings = m_settings;
int newIndexInList; int newIndexInList;
if (m_localInputDeviceIndexes.size() != 0) // there are some local input devices if (!m_localInputDeviceIndexes.empty()) // there are some local input devices
{ {
if (m_settings.m_localDeviceIndex < 0) { // not set before if (m_settings.m_localDeviceIndex < 0) { // not set before
newIndexInList = 0; // set to first device in list newIndexInList = 0; // set to first device in list
@ -574,13 +574,13 @@ void Interferometer::webapiUpdateChannelSettings(
settings.m_reverseAPIAddress = *response.getInterferometerSettings()->getReverseApiAddress(); settings.m_reverseAPIAddress = *response.getInterferometerSettings()->getReverseApiAddress();
} }
if (channelSettingsKeys.contains("reverseAPIPort")) { if (channelSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getInterferometerSettings()->getReverseApiPort(); settings.m_reverseAPIPort = (uint16_t) response.getInterferometerSettings()->getReverseApiPort();
} }
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) { if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getInterferometerSettings()->getReverseApiDeviceIndex(); settings.m_reverseAPIDeviceIndex = (uint16_t) response.getInterferometerSettings()->getReverseApiDeviceIndex();
} }
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
settings.m_reverseAPIChannelIndex = response.getInterferometerSettings()->getReverseApiChannelIndex(); settings.m_reverseAPIChannelIndex = (uint16_t) response.getInterferometerSettings()->getReverseApiChannelIndex();
} }
if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) { if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) {
settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getInterferometerSettings()->getSpectrumConfig()); settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getInterferometerSettings()->getSpectrumConfig());
@ -632,7 +632,7 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings
} }
else else
{ {
SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); auto *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
settings.m_spectrumGUI->formatTo(swgGLSpectrum); settings.m_spectrumGUI->formatTo(swgGLSpectrum);
response.getInterferometerSettings()->setSpectrumConfig(swgGLSpectrum); response.getInterferometerSettings()->setSpectrumConfig(swgGLSpectrum);
} }
@ -646,7 +646,7 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings
} }
else else
{ {
SWGSDRangel::SWGGLScope *swgGLScope = new SWGSDRangel::SWGGLScope(); auto *swgGLScope = new SWGSDRangel::SWGGLScope();
settings.m_scopeGUI->formatTo(swgGLScope); settings.m_scopeGUI->formatTo(swgGLScope);
response.getInterferometerSettings()->setScopeConfig(swgGLScope); response.getInterferometerSettings()->setScopeConfig(swgGLScope);
} }
@ -660,7 +660,7 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings
} }
else else
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
response.getInterferometerSettings()->setChannelMarker(swgChannelMarker); response.getInterferometerSettings()->setChannelMarker(swgChannelMarker);
} }
@ -674,7 +674,7 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings
} }
else else
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
response.getInterferometerSettings()->setRollupState(swgRollupState); response.getInterferometerSettings()->setRollupState(swgRollupState);
} }
@ -683,7 +683,7 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings
void Interferometer::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const InterferometerSettings& settings, bool force) void Interferometer::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const InterferometerSettings& settings, bool force)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -694,8 +694,8 @@ void Interferometer::webapiReverseSendSettings(const QList<QString>& channelSett
m_networkRequest.setUrl(QUrl(channelSettingsURL)); m_networkRequest.setUrl(QUrl(channelSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QBuffer *buffer = new QBuffer(); auto *buffer = new QBuffer();
buffer->open((QBuffer::ReadWrite)); buffer->open(QBuffer::ReadWrite);
buffer->write(swgChannelSettings->asJson().toUtf8()); buffer->write(swgChannelSettings->asJson().toUtf8());
buffer->seek(0); buffer->seek(0);
@ -710,7 +710,7 @@ void Interferometer::sendChannelSettings(
const QList<ObjectPipe*>& pipes, const QList<ObjectPipe*>& pipes,
const QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const InterferometerSettings& settings, const InterferometerSettings& settings,
bool force) bool force) const
{ {
for (const auto& pipe : pipes) for (const auto& pipe : pipes)
{ {
@ -718,7 +718,7 @@ void Interferometer::sendChannelSettings(
if (messageQueue) if (messageQueue)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create( MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
this, this,
@ -736,7 +736,7 @@ void Interferometer::webapiFormatChannelSettings(
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const InterferometerSettings& settings, const InterferometerSettings& settings,
bool force bool force
) ) const
{ {
swgChannelSettings->setDirection(2); // MIMO sink swgChannelSettings->setDirection(2); // MIMO sink
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet()); swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
@ -774,34 +774,34 @@ void Interferometer::webapiFormatChannelSettings(
if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrumConfig") || force)) if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrumConfig") || force))
{ {
SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum(); auto *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
settings.m_spectrumGUI->formatTo(swgGLSpectrum); settings.m_spectrumGUI->formatTo(swgGLSpectrum);
swgInterferometerSettings->setSpectrumConfig(swgGLSpectrum); swgInterferometerSettings->setSpectrumConfig(swgGLSpectrum);
} }
if (settings.m_scopeGUI && (channelSettingsKeys.contains("scopeConfig") || force)) if (settings.m_scopeGUI && (channelSettingsKeys.contains("scopeConfig") || force))
{ {
SWGSDRangel::SWGGLScope *swgGLScope = new SWGSDRangel::SWGGLScope(); auto *swgGLScope = new SWGSDRangel::SWGGLScope();
settings.m_scopeGUI->formatTo(swgGLScope); settings.m_scopeGUI->formatTo(swgGLScope);
swgInterferometerSettings->setScopeConfig(swgGLScope); swgInterferometerSettings->setScopeConfig(swgGLScope);
} }
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force)) if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
swgInterferometerSettings->setChannelMarker(swgChannelMarker); swgInterferometerSettings->setChannelMarker(swgChannelMarker);
} }
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force)) if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
swgInterferometerSettings->setRollupState(swgRollupState); swgInterferometerSettings->setRollupState(swgRollupState);
} }
} }
void Interferometer::networkManagerFinished(QNetworkReply *reply) void Interferometer::networkManagerFinished(QNetworkReply *reply) const
{ {
QNetworkReply::NetworkError replyError = reply->error(); QNetworkReply::NetworkError replyError = reply->error();

View File

@ -108,63 +108,60 @@ public:
{ } { }
}; };
Interferometer(DeviceAPI *deviceAPI); explicit Interferometer(DeviceAPI *deviceAPI);
virtual ~Interferometer(); ~Interferometer() final;
virtual void destroy() { delete this; } void destroy() final { delete this; }
virtual void setDeviceAPI(DeviceAPI *deviceAPI); void setDeviceAPI(DeviceAPI *deviceAPI) final;
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; } DeviceAPI *getDeviceAPI() final { return m_deviceAPI; }
virtual void startSinks(); //!< thread start() void startSinks() final; //!< thread start()
virtual void stopSinks(); //!< thread exit() and wait() void stopSinks() final; //!< thread exit() and wait()
virtual void startSources() {} void startSources() final { /* not for MIMMO*/ }
virtual void stopSources() {} void stopSources() final { /* not for MIMMO*/ }
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex); void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex) final;
virtual void pull(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex); void pull(SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) final;
virtual void pushMessage(Message *msg) { m_inputMessageQueue.push(msg); } void pushMessage(Message *msg) final { m_inputMessageQueue.push(msg); }
virtual QString getMIMOName() { return objectName(); } QString getMIMOName() final { return objectName(); }
virtual void getIdentifier(QString& id) { id = objectName(); } void getIdentifier(QString& id) final { id = objectName(); }
virtual QString getIdentifier() const { return objectName(); } QString getIdentifier() const final { return objectName(); }
virtual void getTitle(QString& title) { title = "Interferometer"; } void getTitle(QString& title) final { title = "Interferometer"; }
virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } qint64 getCenterFrequency() const final { return m_frequencyOffset; }
virtual void setCenterFrequency(qint64) {} void setCenterFrequency(qint64) final { /* not for MIMMO*/ }
uint32_t getDeviceSampleRate() const { return m_deviceSampleRate; } uint32_t getDeviceSampleRate() const { return m_deviceSampleRate; }
virtual QByteArray serialize() const; QByteArray serialize() const final;
virtual bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data) final;
virtual int getNbSinkStreams() const { return 2; } int getNbSinkStreams() const final { return 2; }
virtual int getNbSourceStreams() const { return 0; } int getNbSourceStreams() const final { return 0; }
virtual int getStreamIndex() const { return -1; } int getStreamIndex() const final { return -1; }
virtual qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const qint64 getStreamCenterFrequency(int streamIndex, bool sinkElseSource) const final
{ {
(void) streamIndex; (void) streamIndex;
(void) sinkElseSource; (void) sinkElseSource;
return m_frequencyOffset; return m_frequencyOffset;
} }
virtual void setMessageQueueToGUI(MessageQueue *queue) { m_guiMessageQueue = queue; }
MessageQueue *getMessageQueueToGUI() { return m_guiMessageQueue; }
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
ScopeVis *getScopeVis() { return &m_scopeSink; } ScopeVis *getScopeVis() { return &m_scopeSink; }
void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash); void applyChannelSettings(uint32_t log2Decim, uint32_t filterChainHash);
const QList<int>& getDeviceSetList() { return m_localInputDeviceIndexes; } const QList<int>& getDeviceSetList() { return m_localInputDeviceIndexes; }
virtual int webapiSettingsGet( int webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage); QString& errorMessage) final;
virtual int webapiSettingsPutPatch( int webapiSettingsPutPatch(
bool force, bool force,
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage); QString& errorMessage) final;
virtual int webapiWorkspaceGet( int webapiWorkspaceGet(
SWGSDRangel::SWGWorkspaceInfo& query, SWGSDRangel::SWGWorkspaceInfo& query,
QString& errorMessage); QString& errorMessage) final;
static void webapiFormatChannelSettings( static void webapiFormatChannelSettings(
SWGSDRangel::SWGChannelSettings& response, SWGSDRangel::SWGChannelSettings& response,
@ -196,11 +193,12 @@ private:
uint64_t m_centerFrequency; uint64_t m_centerFrequency;
int64_t m_frequencyOffset; int64_t m_frequencyOffset;
uint32_t m_deviceSampleRate; uint32_t m_deviceSampleRate;
int m_count0, m_count1; int m_count0;
int m_count1;
QList<int> m_localInputDeviceIndexes; QList<int> m_localInputDeviceIndexes;
virtual bool handleMessage(const Message& cmd); //!< Processing of a message. Returns true if message has actually been processed bool handleMessage(const Message& cmd) final; //!< Processing of a message. Returns true if message has actually been processed
void applySettings(const InterferometerSettings& settings, const QList<QString>& settingsKeys, bool force = false); void applySettings(const InterferometerSettings& settings, const QList<QString>& settingsKeys, bool force = false);
static void validateFilterChainHash(InterferometerSettings& settings); static void validateFilterChainHash(InterferometerSettings& settings);
void calculateFrequencyOffset(uint32_t log2Decim, uint32_t filterChainHash); void calculateFrequencyOffset(uint32_t log2Decim, uint32_t filterChainHash);
@ -213,17 +211,17 @@ private:
const QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const InterferometerSettings& settings, const InterferometerSettings& settings,
bool force bool force
); ) const;
void webapiFormatChannelSettings( void webapiFormatChannelSettings(
const QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const InterferometerSettings& settings, const InterferometerSettings& settings,
bool force bool force
); ) const;
private slots: private slots:
void handleInputMessages(); void handleInputMessages();
void networkManagerFinished(QNetworkReply *reply); void networkManagerFinished(QNetworkReply *reply) const;
}; };
#endif // INCLUDE_INTERFEROMETER_H #endif // INCLUDE_INTERFEROMETER_H

View File

@ -32,15 +32,10 @@
InterferometerGUI* InterferometerGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *channelMIMO) InterferometerGUI* InterferometerGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *channelMIMO)
{ {
InterferometerGUI* gui = new InterferometerGUI(pluginAPI, deviceUISet, channelMIMO); auto* gui = new InterferometerGUI(pluginAPI, deviceUISet, channelMIMO);
return gui; return gui;
} }
void InterferometerGUI::destroy()
{
delete this;
}
void InterferometerGUI::resetToDefaults() void InterferometerGUI::resetToDefaults()
{ {
m_settings.resetToDefaults(); m_settings.resetToDefaults();
@ -77,7 +72,7 @@ bool InterferometerGUI::handleMessage(const Message& message)
{ {
if (Interferometer::MsgBasebandNotification::match(message)) if (Interferometer::MsgBasebandNotification::match(message))
{ {
Interferometer::MsgBasebandNotification& notif = (Interferometer::MsgBasebandNotification&) message; auto& notif = (const Interferometer::MsgBasebandNotification&) message;
m_sampleRate = notif.getSampleRate(); m_sampleRate = notif.getSampleRate();
m_centerFrequency = notif.getCenterFrequency(); m_centerFrequency = notif.getCenterFrequency();
displayRateAndShift(); displayRateAndShift();
@ -86,7 +81,7 @@ bool InterferometerGUI::handleMessage(const Message& message)
} }
else if (Interferometer::MsgConfigureInterferometer::match(message)) else if (Interferometer::MsgConfigureInterferometer::match(message))
{ {
const Interferometer::MsgConfigureInterferometer& cfg = (const Interferometer::MsgConfigureInterferometer&) message; auto& cfg = (const Interferometer::MsgConfigureInterferometer&) message;
if (cfg.getForce()) { if (cfg.getForce()) {
m_settings = cfg.getSettings(); m_settings = cfg.getSettings();
@ -102,7 +97,8 @@ bool InterferometerGUI::handleMessage(const Message& message)
} }
else if (Interferometer::MsgReportDevices::match(message)) else if (Interferometer::MsgReportDevices::match(message))
{ {
Interferometer::MsgReportDevices& report = (Interferometer::MsgReportDevices&) message; auto& msg = const_cast<Message&>(message);
auto& report = (Interferometer::MsgReportDevices&) msg;
updateDeviceSetList(report.getDeviceSetIndexes()); updateDeviceSetList(report.getDeviceSetIndexes());
return true; return true;
} }
@ -135,7 +131,7 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
m_spectrumVis->setGLSpectrum(ui->glSpectrum); m_spectrumVis->setGLSpectrum(ui->glSpectrum);
m_scopeVis = m_interferometer->getScopeVis(); m_scopeVis = m_interferometer->getScopeVis();
m_scopeVis->setGLScope(ui->glScope); m_scopeVis->setGLScope(ui->glScope);
m_interferometer->setMessageQueueToGUI(getInputMessageQueue()); m_interferometer->setMessageQueueToGUI(InterferometerGUI::getInputMessageQueue());
m_sampleRate = m_interferometer->getDeviceSampleRate(); m_sampleRate = m_interferometer->getDeviceSampleRate();
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum); ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
@ -175,7 +171,7 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI
m_scopeVis->setTraceChunkSize(Interferometer::m_fftSize); // Set scope trace length unit to FFT size m_scopeVis->setTraceChunkSize(Interferometer::m_fftSize); // Set scope trace length unit to FFT size
ui->scopeGUI->traceLengthChange(); ui->scopeGUI->traceLengthChange();
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(InterferometerGUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
updateDeviceSetList(m_interferometer->getDeviceSetList()); updateDeviceSetList(m_interferometer->getDeviceSetList());
displaySettings(); displaySettings();
@ -243,15 +239,15 @@ void InterferometerGUI::displaySettings()
void InterferometerGUI::displayRateAndShift() void InterferometerGUI::displayRateAndShift()
{ {
int shift = m_shiftFrequencyFactor * m_sampleRate; auto shift = (int) (m_shiftFrequencyFactor * m_sampleRate);
double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Decim); double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Decim);
QLocale loc; QLocale loc;
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift))); ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5))); ui->channelRateText->setText(tr("%1k").arg(QString::number(channelSampleRate / 1000.0, 'g', 5)));
m_channelMarker.setCenterFrequency(shift); m_channelMarker.setCenterFrequency(shift);
m_channelMarker.setBandwidth(channelSampleRate); m_channelMarker.setBandwidth((int) channelSampleRate);
ui->glSpectrum->setSampleRate(channelSampleRate); ui->glSpectrum->setSampleRate((int) channelSampleRate);
m_scopeVis->setLiveRate(channelSampleRate); m_scopeVis->setLiveRate((int) channelSampleRate);
} }
void InterferometerGUI::leaveEvent(QEvent*) void InterferometerGUI::leaveEvent(QEvent*)
@ -268,7 +264,7 @@ void InterferometerGUI::handleSourceMessages()
{ {
Message* message; Message* message;
while ((message = getInputMessageQueue()->pop()) != 0) while ((message = getInputMessageQueue()->pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -277,7 +273,7 @@ void InterferometerGUI::handleSourceMessages()
} }
} }
void InterferometerGUI::onWidgetRolled(QWidget* widget, bool rollDown) void InterferometerGUI::onWidgetRolled(const QWidget* widget, bool rollDown)
{ {
(void) widget; (void) widget;
(void) rollDown; (void) rollDown;
@ -288,7 +284,7 @@ void InterferometerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void InterferometerGUI::onMenuDialogCalled(const QPoint &p) void InterferometerGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
@ -330,7 +326,7 @@ void InterferometerGUI::onMenuDialogCalled(const QPoint &p)
void InterferometerGUI::updateDeviceSetList(const QList<int>& deviceSetIndexes) void InterferometerGUI::updateDeviceSetList(const QList<int>& deviceSetIndexes)
{ {
QList<int>::const_iterator it = deviceSetIndexes.begin(); auto it = deviceSetIndexes.begin();
ui->localDevice->blockSignals(true); ui->localDevice->blockSignals(true);
@ -343,7 +339,7 @@ void InterferometerGUI::updateDeviceSetList(const QList<int>& deviceSetIndexes)
ui->localDevice->blockSignals(false); ui->localDevice->blockSignals(false);
} }
int InterferometerGUI::getLocalDeviceIndexInCombo(int localDeviceIndex) int InterferometerGUI::getLocalDeviceIndexInCombo(int localDeviceIndex) const
{ {
int index = 0; int index = 0;
@ -457,7 +453,7 @@ void InterferometerGUI::tick()
} }
} }
void InterferometerGUI::makeUIConnections() void InterferometerGUI::makeUIConnections() const
{ {
QObject::connect(ui->decimationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &InterferometerGUI::on_decimationFactor_currentIndexChanged); QObject::connect(ui->decimationFactor, QOverload<int>::of(&QComboBox::currentIndexChanged), this, &InterferometerGUI::on_decimationFactor_currentIndexChanged);
QObject::connect(ui->position, &QSlider::valueChanged, this, &InterferometerGUI::on_position_valueChanged); QObject::connect(ui->position, &QSlider::valueChanged, this, &InterferometerGUI::on_position_valueChanged);
@ -472,5 +468,5 @@ void InterferometerGUI::makeUIConnections()
void InterferometerGUI::updateAbsoluteCenterFrequency() void InterferometerGUI::updateAbsoluteCenterFrequency()
{ {
setStatusFrequency(m_centerFrequency + m_shiftFrequencyFactor * m_sampleRate); setStatusFrequency((qint64) ((double) m_centerFrequency + m_shiftFrequencyFactor * m_sampleRate));
} }

View File

@ -46,22 +46,21 @@ class InterferometerGUI : public ChannelGUI {
public: public:
static InterferometerGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel); static InterferometerGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel);
virtual void destroy(); void resetToDefaults() final;
virtual void resetToDefaults(); QByteArray serialize() const final;
virtual QByteArray serialize() const; bool deserialize(const QByteArray& data) final;
virtual bool deserialize(const QByteArray& data); MessageQueue* getInputMessageQueue() final;
virtual MessageQueue* getInputMessageQueue(); void setWorkspaceIndex(int index) final { m_settings.m_workspaceIndex = index; };
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; }; int getWorkspaceIndex() const final { return m_settings.m_workspaceIndex; };
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }; void setGeometryBytes(const QByteArray& blob) final { m_settings.m_geometryBytes = blob; };
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }; QByteArray getGeometryBytes() const final { return m_settings.m_geometryBytes; };
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }; QString getTitle() const final { return m_settings.m_title; };
virtual QString getTitle() const { return m_settings.m_title; }; QColor getTitleColor() const final { return m_settings.m_rgbColor; };
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; }; void zetHidden(bool hidden) final { m_settings.m_hidden = hidden; }
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; } bool getHidden() const final { return m_settings.m_hidden; }
virtual bool getHidden() const { return m_settings.m_hidden; } ChannelMarker& getChannelMarker() final { return m_channelMarker; }
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; } int getStreamIndex() const final { return -1; }
virtual int getStreamIndex() const { return -1; } void setStreamIndex(int streamIndex) final { (void) streamIndex; }
virtual void setStreamIndex(int streamIndex) { (void) streamIndex; }
private: private:
Ui::InterferometerGUI* ui; Ui::InterferometerGUI* ui;
@ -83,7 +82,7 @@ private:
uint32_t m_tickCount; uint32_t m_tickCount;
explicit InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *rxChannel, QWidget* parent = nullptr); explicit InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *rxChannel, QWidget* parent = nullptr);
virtual ~InterferometerGUI(); ~InterferometerGUI() final;
void blockApplySettings(bool block); void blockApplySettings(bool block);
void applySettings(bool force = false); void applySettings(bool force = false);
@ -92,13 +91,13 @@ private:
void displaySettings(); void displaySettings();
void displayRateAndShift(); void displayRateAndShift();
bool handleMessage(const Message& message); bool handleMessage(const Message& message);
void makeUIConnections(); void makeUIConnections() const;
void updateAbsoluteCenterFrequency(); void updateAbsoluteCenterFrequency();
void updateDeviceSetList(const QList<int>& deviceSetIndexes); void updateDeviceSetList(const QList<int>& deviceSetIndexes);
int getLocalDeviceIndexInCombo(int localDeviceIndex); int getLocalDeviceIndexInCombo(int localDeviceIndex) const;
void leaveEvent(QEvent*); void leaveEvent(QEvent*) final;
void enterEvent(EnterEventType*); void enterEvent(EnterEventType*) final;
private slots: private slots:
void handleSourceMessages(); void handleSourceMessages();
@ -111,7 +110,7 @@ private slots:
void on_correlationType_currentIndexChanged(int index); void on_correlationType_currentIndexChanged(int index);
void on_localDevice_currentIndexChanged(int index); void on_localDevice_currentIndexChanged(int index);
void on_localDevicePlay_toggled(bool checked); void on_localDevicePlay_toggled(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown); void onWidgetRolled(const QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void tick(); void tick();
}; };

View File

@ -474,7 +474,7 @@ void ChannelAnalyzerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void ChannelAnalyzerGUI::onMenuDialogCalled(const QPoint& p) void ChannelAnalyzerGUI::onMenuDialogCalled(const QPoint& p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -138,11 +138,6 @@ public:
m_basebandSink->resetMagLevels(); m_basebandSink->resetMagLevels();
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
static const char * const m_channelIdURI; static const char * const m_channelIdURI;

View File

@ -200,7 +200,7 @@ void ChannelPowerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void ChannelPowerGUI::onMenuDialogCalled(const QPoint &p) void ChannelPowerGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -152,7 +152,7 @@ public:
SWGSDRangel::SWGChannelSettings& response); SWGSDRangel::SWGChannelSettings& response);
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { m_basebandSink->getMagSqLevels(avg, peak, nbSamples); } void getMagSqLevels(double& avg, double& peak, int& nbSamples) { m_basebandSink->getMagSqLevels(avg, peak, nbSamples); }
void setMessageQueueToGUI(MessageQueue* queue) override { void setMessageQueueToGUI(MessageQueue* queue) final {
ChannelAPI::setMessageQueueToGUI(queue); ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue); m_basebandSink->setMessageQueueToGUI(queue);
} }

View File

@ -3904,7 +3904,7 @@ void ADSBDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void ADSBDemodGUI::onMenuDialogCalled(const QPoint &p) void ADSBDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -163,10 +163,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -667,7 +667,7 @@ void AISDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void AISDemodGUI::onMenuDialogCalled(const QPoint &p) void AISDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -394,7 +394,7 @@ void AMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void AMDemodGUI::onMenuDialogCalled(const QPoint &p) void AMDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -556,7 +556,7 @@ void APTDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void APTDemodGUI::onMenuDialogCalled(const QPoint &p) void APTDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -207,7 +207,7 @@ void ATVDemodGUI::handleSourceMessages()
void ATVDemodGUI::onMenuDialogCalled(const QPoint &p) void ATVDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -332,7 +332,7 @@ void BFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void BFMDemodGUI::onMenuDialogCalled(const QPoint &p) void BFMDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -349,7 +349,7 @@ void ChirpChatDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void ChirpChatDemodGUI::onMenuDialogCalled(const QPoint &p) void ChirpChatDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -392,10 +392,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
int getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); } int getAudioSampleRate() const { return m_basebandSink->getAudioSampleRate(); }

View File

@ -451,7 +451,7 @@ void DABDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void DABDemodGUI::onMenuDialogCalled(const QPoint &p) void DABDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -169,7 +169,7 @@ void DATVDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void DATVDemodGUI::onMenuDialogCalled(const QPoint &p) void DATVDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -163,10 +163,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -493,7 +493,7 @@ void DSCDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void DSCDemodGUI::onMenuDialogCalled(const QPoint &p) void DSCDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -297,7 +297,7 @@ void DSDDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void DSDDemodGUI::onMenuDialogCalled(const QPoint &p) void DSDDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -137,10 +137,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -373,7 +373,7 @@ void EndOfTrainDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void EndOfTrainDemodGUI::onMenuDialogCalled(const QPoint &p) void EndOfTrainDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -201,7 +201,7 @@ void FreeDVDemodGUI::on_spanLog2_valueChanged(int value)
void FreeDVDemodGUI::onMenuDialogCalled(const QPoint &p) void FreeDVDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -102,7 +102,7 @@ public:
} }
void setDeviceCenterFrequency(qint64 centerFrequency, int index); void setDeviceCenterFrequency(qint64 centerFrequency, int index);
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; }
double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; }

View File

@ -542,7 +542,7 @@ void FT8DemodGUI::on_settings_clicked()
void FT8DemodGUI::onMenuDialogCalled(const QPoint &p) void FT8DemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -179,10 +179,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -946,7 +946,7 @@ void ILSDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void ILSDemodGUI::onMenuDialogCalled(const QPoint &p) void ILSDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -349,7 +349,7 @@ void M17DemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void M17DemodGUI::onMenuDialogCalled(const QPoint &p) void M17DemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -183,10 +183,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -450,7 +450,7 @@ void NavtexDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void NavtexDemodGUI::onMenuDialogCalled(const QPoint &p) void NavtexDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -135,7 +135,6 @@ public:
} }
} }
void setMessageQueueToGUI(MessageQueue* queue) override { ChannelAPI::setMessageQueueToGUI(queue); }
int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } int getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; }
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -318,7 +318,7 @@ void NFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void NFMDemodGUI::onMenuDialogCalled(const QPoint &p) void NFMDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -134,10 +134,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -372,7 +372,7 @@ void PacketDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void PacketDemodGUI::onMenuDialogCalled(const QPoint &p) void PacketDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -190,10 +190,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -424,7 +424,7 @@ void PagerDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void PagerDemodGUI::onMenuDialogCalled(const QPoint &p) void PagerDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -501,7 +501,7 @@ void RadiosondeDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void RadiosondeDemodGUI::onMenuDialogCalled(const QPoint &p) void RadiosondeDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -177,10 +177,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -358,7 +358,7 @@ void RttyDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void RttyDemodGUI::onMenuDialogCalled(const QPoint &p) void RttyDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -101,7 +101,7 @@ public:
return m_settings.m_inputFrequencyOffset; return m_settings.m_inputFrequencyOffset;
} }
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; }
uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; }
double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; }

View File

@ -299,7 +299,7 @@ void SSBDemodGUI::on_filterIndex_valueChanged(int value)
void SSBDemodGUI::onMenuDialogCalled(const QPoint &p) void SSBDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -238,7 +238,7 @@ void VORDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void VORDemodGUI::onMenuDialogCalled(const QPoint &p) void VORDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -125,7 +125,7 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
void setMessageQueueToGUI(MessageQueue* queue) override { void setMessageQueueToGUI(MessageQueue* queue) final {
ChannelAPI::setMessageQueueToGUI(queue); ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue); m_basebandSink->setMessageQueueToGUI(queue);
} }

View File

@ -1111,7 +1111,7 @@ void VORDemodMCGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void VORDemodMCGUI::onMenuDialogCalled(const QPoint &p) void VORDemodMCGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -180,7 +180,7 @@ void WFMDemodGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void WFMDemodGUI::onMenuDialogCalled(const QPoint &p) void WFMDemodGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -148,7 +148,7 @@ public:
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response); SWGSDRangel::SWGChannelSettings& response);
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
void getLocalDevices(std::vector<uint32_t>& indexes); void getLocalDevices(std::vector<uint32_t>& indexes);
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }

View File

@ -363,7 +363,7 @@ void FileSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void FileSinkGUI::onMenuDialogCalled(const QPoint &p) void FileSinkGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -355,7 +355,7 @@ public:
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response); SWGSDRangel::SWGChannelSettings& response);
void setMessageQueueToGUI(MessageQueue* queue) override { void setMessageQueueToGUI(MessageQueue* queue) final {
ChannelAPI::setMessageQueueToGUI(queue); ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue); m_basebandSink->setMessageQueueToGUI(queue);
} }

View File

@ -377,7 +377,7 @@ void FreqScannerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void FreqScannerGUI::onMenuDialogCalled(const QPoint &p) void FreqScannerGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -264,7 +264,7 @@ void FreqTrackerGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void FreqTrackerGUI::onMenuDialogCalled(const QPoint &p) void FreqTrackerGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -143,11 +143,6 @@ public:
m_basebandSink->resetMagLevels(); m_basebandSink->resetMagLevels();
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
static const char * const m_channelIdURI; static const char * const m_channelIdURI;

View File

@ -483,7 +483,7 @@ void HeatMapGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void HeatMapGUI::onMenuDialogCalled(const QPoint &p) void HeatMapGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -333,7 +333,7 @@ void LocalSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void LocalSinkGUI::onMenuDialogCalled(const QPoint &p) void LocalSinkGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -540,7 +540,7 @@ void NoiseFigureGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void NoiseFigureGUI::onMenuDialogCalled(const QPoint &p) void NoiseFigureGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -442,10 +442,6 @@ public:
void getMagSqLevels(double& avg, double& peak, int& nbSamples) { void getMagSqLevels(double& avg, double& peak, int& nbSamples) {
m_basebandSink->getMagSqLevels(avg, peak, nbSamples); m_basebandSink->getMagSqLevels(avg, peak, nbSamples);
} }
/* void setMessageQueueToGUI(MessageQueue* queue) override {
ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue);
}*/
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;

View File

@ -1940,7 +1940,7 @@ void RadioAstronomyGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void RadioAstronomyGUI::onMenuDialogCalled(const QPoint &p) void RadioAstronomyGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -282,7 +282,7 @@ void RadioClockGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void RadioClockGUI::onMenuDialogCalled(const QPoint &p) void RadioClockGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -233,7 +233,7 @@ void RemoteSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void RemoteSinkGUI::onMenuDialogCalled(const QPoint &p) void RemoteSinkGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -164,7 +164,7 @@ public:
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
int getBasebandSampleRate() const { return m_basebandSampleRate; } int getBasebandSampleRate() const { return m_basebandSampleRate; }
void setMessageQueueToGUI(MessageQueue* queue) override { void setMessageQueueToGUI(MessageQueue* queue) final {
ChannelAPI::setMessageQueueToGUI(queue); ChannelAPI::setMessageQueueToGUI(queue);
m_basebandSink->setMessageQueueToGUI(queue); m_basebandSink->setMessageQueueToGUI(queue);
} }

View File

@ -318,7 +318,7 @@ void RemoteTCPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void RemoteTCPSinkGUI::onMenuDialogCalled(const QPoint &p) void RemoteTCPSinkGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -148,7 +148,7 @@ public:
const QStringList& channelSettingsKeys, const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response); SWGSDRangel::SWGChannelSettings& response);
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
void getLocalDevices(std::vector<uint32_t>& indexes); void getLocalDevices(std::vector<uint32_t>& indexes);
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; } SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }

View File

@ -357,7 +357,7 @@ void SigMFFileSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void SigMFFileSinkGUI::onMenuDialogCalled(const QPoint &p) void SigMFFileSinkGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -615,7 +615,7 @@ void UDPSinkGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void UDPSinkGUI::onMenuDialogCalled(const QPoint &p) void UDPSinkGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -101,7 +101,7 @@ public:
return m_settings.m_inputFrequencyOffset; return m_settings.m_inputFrequencyOffset;
} }
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; } uint32_t getAudioSampleRate() const { return m_running ? m_basebandSink->getAudioSampleRate() : 0; }
uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; } uint32_t getChannelSampleRate() const { return m_running ? m_basebandSink->getChannelSampleRate() : 0; }
double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; } double getMagSq() const { return m_running ? m_basebandSink->getMagSq() : 0.0; }

View File

@ -59,6 +59,7 @@ void WDSPRxBaseband::reset()
{ {
QMutexLocker mutexLocker(&m_mutex); QMutexLocker mutexLocker(&m_mutex);
m_sink.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate()); m_sink.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate());
mutexLocker.unlock();
m_sampleFifo.reset(); m_sampleFifo.reset();
m_channelSampleRate = 0; m_channelSampleRate = 0;
} }

View File

@ -49,7 +49,7 @@
WDSPRxGUI* WDSPRxGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel) WDSPRxGUI* WDSPRxGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel)
{ {
WDSPRxGUI* gui = new WDSPRxGUI(pluginAPI, deviceUISet, rxChannel); auto* gui = new WDSPRxGUI(pluginAPI, deviceUISet, rxChannel);
return gui; return gui;
} }
@ -98,7 +98,7 @@ bool WDSPRxGUI::handleMessage(const Message& message)
if (WDSPRx::MsgConfigureWDSPRx::match(message)) if (WDSPRx::MsgConfigureWDSPRx::match(message))
{ {
qDebug("WDSPRxGUI::handleMessage: WDSPRx::MsgConfigureWDSPRx"); qDebug("WDSPRxGUI::handleMessage: WDSPRx::MsgConfigureWDSPRx");
const WDSPRx::MsgConfigureWDSPRx& cfg = (WDSPRx::MsgConfigureWDSPRx&) message; auto& cfg = (const WDSPRx::MsgConfigureWDSPRx&) message;
m_settings = cfg.getSettings(); m_settings = cfg.getSettings();
blockApplySettings(true); blockApplySettings(true);
ui->spectrumGUI->updateSettings(); ui->spectrumGUI->updateSettings();
@ -118,7 +118,7 @@ bool WDSPRxGUI::handleMessage(const Message& message)
} }
else if (DSPSignalNotification::match(message)) else if (DSPSignalNotification::match(message))
{ {
const DSPSignalNotification& notif = (const DSPSignalNotification&) message; auto& notif = (const DSPSignalNotification&) message;
m_deviceCenterFrequency = notif.getCenterFrequency(); m_deviceCenterFrequency = notif.getCenterFrequency();
m_basebandSampleRate = notif.getSampleRate(); m_basebandSampleRate = notif.getSampleRate();
qDebug("WDSPRxGUI::handleMessage: DSPSignalNotification: centerFrequency: %lld sampleRate: %d", qDebug("WDSPRxGUI::handleMessage: DSPSignalNotification: centerFrequency: %lld sampleRate: %d",
@ -138,7 +138,7 @@ void WDSPRxGUI::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = getInputMessageQueue()->pop()) != 0) while ((message = getInputMessageQueue()->pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -183,7 +183,7 @@ void WDSPRxGUI::on_dsb_toggled(bool dsb)
void WDSPRxGUI::on_deltaFrequency_changed(qint64 value) void WDSPRxGUI::on_deltaFrequency_changed(qint64 value)
{ {
m_channelMarker.setCenterFrequency(value); m_channelMarker.setCenterFrequency((int) value);
m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency(); m_settings.m_inputFrequencyOffset = m_channelMarker.getCenterFrequency();
updateAbsoluteCenterFrequency(); updateAbsoluteCenterFrequency();
applySettings(); applySettings();
@ -205,7 +205,7 @@ void WDSPRxGUI::on_lowCut_valueChanged(int value)
void WDSPRxGUI::on_volume_valueChanged(int value) void WDSPRxGUI::on_volume_valueChanged(int value)
{ {
ui->volumeText->setText(QString("%1").arg(value)); ui->volumeText->setText(QString("%1").arg(value));
m_settings.m_volume = CalcDb::powerFromdB(value); m_settings.m_volume = (Real) CalcDb::powerFromdB(value);
applySettings(); applySettings();
} }
@ -279,7 +279,7 @@ void WDSPRxGUI::on_rit_toggled(bool checked)
{ {
m_settings.m_rit = checked; m_settings.m_rit = checked;
m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit; m_settings.m_profiles[m_settings.m_profileIndex].m_rit = m_settings.m_rit;
m_channelMarker.setShift(checked ? m_settings.m_ritFrequency: 0); m_channelMarker.setShift(checked ? (int) m_settings.m_ritFrequency: 0);
applySettings(); applySettings();
} }
@ -406,7 +406,7 @@ void WDSPRxGUI::on_profileIndex_valueChanged(int value)
void WDSPRxGUI::on_demod_currentIndexChanged(int index) void WDSPRxGUI::on_demod_currentIndexChanged(int index)
{ {
WDSPRxProfile::WDSPRxDemod demod = (WDSPRxProfile::WDSPRxDemod) index; auto demod = (WDSPRxProfile::WDSPRxDemod) index;
if ((m_settings.m_demod != WDSPRxProfile::DemodSSB) && (demod == WDSPRxProfile::DemodSSB)) { if ((m_settings.m_demod != WDSPRxProfile::DemodSSB) && (demod == WDSPRxProfile::DemodSSB)) {
m_settings.m_dsb = false; m_settings.m_dsb = false;
@ -434,7 +434,7 @@ void WDSPRxGUI::on_demod_currentIndexChanged(int index)
void WDSPRxGUI::onMenuDialogCalled(const QPoint &p) void WDSPRxGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
@ -480,7 +480,7 @@ void WDSPRxGUI::onMenuDialogCalled(const QPoint &p)
resetContextMenuType(); resetContextMenuType();
} }
void WDSPRxGUI::onWidgetRolled(QWidget* widget, bool rollDown) void WDSPRxGUI::onWidgetRolled(const QWidget* widget, bool rollDown)
{ {
(void) widget; (void) widget;
(void) rollDown; (void) rollDown;
@ -524,7 +524,7 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
m_wdspRx = (WDSPRx*) rxChannel; m_wdspRx = (WDSPRx*) rxChannel;
m_spectrumVis = m_wdspRx->getSpectrumVis(); m_spectrumVis = m_wdspRx->getSpectrumVis();
m_spectrumVis->setGLSpectrum(ui->glSpectrum); m_spectrumVis->setGLSpectrum(ui->glSpectrum);
m_wdspRx->setMessageQueueToGUI(getInputMessageQueue()); m_wdspRx->setMessageQueueToGUI(WDSPRxGUI::getInputMessageQueue());
m_audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute); m_audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute);
connect(m_audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &))); connect(m_audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &)));
@ -588,7 +588,7 @@ WDSPRxGUI::WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
m_deviceUISet->addChannelMarker(&m_channelMarker); m_deviceUISet->addChannelMarker(&m_channelMarker);
connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor())); connect(&m_channelMarker, SIGNAL(changedByCursor()), this, SLOT(channelMarkerChangedByCursor()));
connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor())); connect(&m_channelMarker, SIGNAL(highlightedByCursor()), this, SLOT(channelMarkerHighlightedByCursor()));
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); connect(WDSPRxGUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
m_iconDSBUSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On); m_iconDSBUSB.addPixmap(QPixmap("://dsb.png"), QIcon::Normal, QIcon::On);
@ -654,7 +654,7 @@ uint32_t WDSPRxGUI::getValidAudioSampleRate() const
return sr; return sr;
} }
unsigned int WDSPRxGUI::spanLog2Max() unsigned int WDSPRxGUI::spanLog2Max() const
{ {
unsigned int spanLog2 = 0; unsigned int spanLog2 = 0;
for (; getValidAudioSampleRate() / (1<<spanLog2) >= 1000; spanLog2++); for (; getValidAudioSampleRate() / (1<<spanLog2) >= 1000; spanLog2++);
@ -668,7 +668,6 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force)
unsigned int limit = s2max < 1 ? 0 : s2max - 1; unsigned int limit = s2max < 1 ? 0 : s2max - 1;
ui->spanLog2->setMaximum(limit); ui->spanLog2->setMaximum(limit);
bool dsb = ui->dsb->isChecked(); bool dsb = ui->dsb->isChecked();
//int spanLog2 = ui->spanLog2->value();
m_spectrumRate = getValidAudioSampleRate() / (1<<spanLog2); m_spectrumRate = getValidAudioSampleRate() / (1<<spanLog2);
int bw = ui->BW->value(); int bw = ui->BW->value();
int lw = ui->lowCut->value(); int lw = ui->lowCut->value();
@ -764,8 +763,8 @@ void WDSPRxGUI::applyBandwidths(unsigned int spanLog2, bool force)
m_settings.m_dsb = dsb; m_settings.m_dsb = dsb;
m_settings.m_profiles[m_settings.m_profileIndex].m_dsb = dsb; m_settings.m_profiles[m_settings.m_profileIndex].m_dsb = dsb;
m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2 = spanLog2; m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2 = spanLog2;
m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff = bw * 100; m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff = (Real) (bw * 100);
m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff = lw * 100; m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff = (Real) (lw * 100);
applySettings(force); applySettings(force);
@ -785,11 +784,11 @@ void WDSPRxGUI::displaySettings()
{ {
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset);
m_channelMarker.setBandwidth(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2); m_channelMarker.setBandwidth((int) (m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff * 2));
m_channelMarker.setTitle(m_settings.m_title); m_channelMarker.setTitle(m_settings.m_title);
m_channelMarker.setLowCutoff(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff); m_channelMarker.setLowCutoff((int) m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff);
int shift = m_settings.m_profiles[m_settings.m_profileIndex].m_rit ? int shift = m_settings.m_profiles[m_settings.m_profileIndex].m_rit ?
m_settings.m_profiles[m_settings.m_profileIndex].m_ritFrequency : (int) m_settings.m_profiles[m_settings.m_profileIndex].m_ritFrequency :
0; 0;
m_channelMarker.setShift(shift); m_channelMarker.setShift(shift);
@ -880,7 +879,7 @@ void WDSPRxGUI::displaySettings()
ui->dsb->setChecked(m_settings.m_dsb); ui->dsb->setChecked(m_settings.m_dsb);
ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2); ui->spanLog2->setValue(1 + ui->spanLog2->maximum() - m_settings.m_profiles[m_settings.m_profileIndex].m_spanLog2);
ui->BW->setValue(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff / 100.0); ui->BW->setValue((int) (m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff / 100.0));
s = QString::number(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff/1000.0, 'f', 1); s = QString::number(m_settings.m_profiles[m_settings.m_profileIndex].m_highCutoff/1000.0, 'f', 1);
if (m_settings.m_dsb) { if (m_settings.m_dsb) {
@ -899,10 +898,10 @@ void WDSPRxGUI::displaySettings()
// The only one of the four signals triggering applyBandwidths will trigger it once only with all other values // The only one of the four signals triggering applyBandwidths will trigger it once only with all other values
// set correctly and therefore validate the settings and apply them to dependent widgets // set correctly and therefore validate the settings and apply them to dependent widgets
ui->lowCut->setValue(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 100.0); ui->lowCut->setValue((int) (m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 100.0));
ui->lowCutText->setText(tr("%1k").arg(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 1000.0)); ui->lowCutText->setText(tr("%1k").arg(m_settings.m_profiles[m_settings.m_profileIndex].m_lowCutoff / 1000.0));
int volume = CalcDb::dbPower(m_settings.m_volume); auto volume = (int) CalcDb::dbPower(m_settings.m_volume);
ui->volume->setValue(volume); ui->volume->setValue(volume);
ui->volumeText->setText(QString("%1").arg(volume)); ui->volumeText->setText(QString("%1").arg(volume));
@ -1199,15 +1198,11 @@ void WDSPRxGUI::amSetup(int iValueChanged)
auto valueChanged = (WDSPRxAMDialog::ValueChanged) iValueChanged; auto valueChanged = (WDSPRxAMDialog::ValueChanged) iValueChanged;
switch (valueChanged) if (valueChanged == WDSPRxAMDialog::ChangedFadeLevel)
{ {
case WDSPRxAMDialog::ChangedFadeLevel:
m_settings.m_amFadeLevel = m_amDialog->getFadeLevel(); m_settings.m_amFadeLevel = m_amDialog->getFadeLevel();
m_settings.m_profiles[m_settings.m_profileIndex].m_amFadeLevel = m_settings.m_amFadeLevel; m_settings.m_profiles[m_settings.m_profileIndex].m_amFadeLevel = m_settings.m_amFadeLevel;
applySettings(); applySettings();
break;
default:
break;
} }
} }
@ -1369,21 +1364,18 @@ void WDSPRxGUI::panSetup(int iValueChanged)
auto valueChanged = (WDSPRxPanDialog::ValueChanged) iValueChanged; auto valueChanged = (WDSPRxPanDialog::ValueChanged) iValueChanged;
switch (valueChanged) if (valueChanged == WDSPRxPanDialog::ChangedPan)
{ {
case WDSPRxPanDialog::ChangedPan:
m_settings.m_audioPan = m_panDialog->getPan(); m_settings.m_audioPan = m_panDialog->getPan();
m_settings.m_profiles[m_settings.m_profileIndex].m_audioPan = m_settings.m_audioPan; m_settings.m_profiles[m_settings.m_profileIndex].m_audioPan = m_settings.m_audioPan;
applySettings(); applySettings();
break;
default:
break;
} }
} }
void WDSPRxGUI::tick() void WDSPRxGUI::tick()
{ {
double powDbAvg, powDbPeak; double powDbAvg;
double powDbPeak;
int nbMagsqSamples; int nbMagsqSamples;
m_wdspRx->getMagSqLevels(powDbAvg, powDbPeak, nbMagsqSamples); // powers directly in dB m_wdspRx->getMagSqLevels(powDbAvg, powDbPeak, nbMagsqSamples); // powers directly in dB
@ -1416,7 +1408,7 @@ void WDSPRxGUI::tick()
m_tickCount++; m_tickCount++;
} }
void WDSPRxGUI::makeUIConnections() void WDSPRxGUI::makeUIConnections() const
{ {
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &WDSPRxGUI::on_deltaFrequency_changed); QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &WDSPRxGUI::on_deltaFrequency_changed);
QObject::connect(ui->audioBinaural, &QToolButton::toggled, this, &WDSPRxGUI::on_audioBinaural_toggled); QObject::connect(ui->audioBinaural, &QToolButton::toggled, this, &WDSPRxGUI::on_audioBinaural_toggled);

View File

@ -58,21 +58,21 @@ public:
static WDSPRxGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel); static WDSPRxGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSink *rxChannel);
virtual void destroy(); virtual void destroy();
void resetToDefaults(); void resetToDefaults() final;
QByteArray serialize() const; QByteArray serialize() const final;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data) final;
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue *getInputMessageQueue() final { return &m_inputMessageQueue; }
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; }; void setWorkspaceIndex(int index) final { m_settings.m_workspaceIndex = index; };
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }; int getWorkspaceIndex() const final { return m_settings.m_workspaceIndex; };
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }; void setGeometryBytes(const QByteArray& blob) final { m_settings.m_geometryBytes = blob; };
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }; QByteArray getGeometryBytes() const final { return m_settings.m_geometryBytes; };
virtual QString getTitle() const { return m_settings.m_title; }; QString getTitle() const final { return m_settings.m_title; };
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; }; QColor getTitleColor() const final { return m_settings.m_rgbColor; };
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; } void zetHidden(bool hidden) final { m_settings.m_hidden = hidden; }
virtual bool getHidden() const { return m_settings.m_hidden; } bool getHidden() const final { return m_settings.m_hidden; }
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; } ChannelMarker& getChannelMarker() final { return m_channelMarker; }
virtual int getStreamIndex() const { return m_settings.m_streamIndex; } int getStreamIndex() const final { return m_settings.m_streamIndex; }
virtual void setStreamIndex(int streamIndex) { m_settings.m_streamIndex = streamIndex; } void setStreamIndex(int streamIndex) final { m_settings.m_streamIndex = streamIndex; }
public slots: public slots:
void channelMarkerChangedByCursor(); void channelMarkerChangedByCursor();
@ -122,21 +122,21 @@ private:
QIcon m_iconDSBUSB; QIcon m_iconDSBUSB;
QIcon m_iconDSBLSB; QIcon m_iconDSBLSB;
explicit WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet* deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = 0); explicit WDSPRxGUI(PluginAPI* pluginAPI, DeviceUISet* deviceUISet, BasebandSampleSink *rxChannel, QWidget* parent = nullptr);
virtual ~WDSPRxGUI(); ~WDSPRxGUI() final;
bool blockApplySettings(bool block); bool blockApplySettings(bool block);
void applySettings(bool force = false); void applySettings(bool force = false);
void applyBandwidths(unsigned int spanLog2, bool force = false); void applyBandwidths(unsigned int spanLog2, bool force = false);
unsigned int spanLog2Max(); unsigned int spanLog2Max() const;
void displaySettings(); void displaySettings();
bool handleMessage(const Message& message); bool handleMessage(const Message& message);
void makeUIConnections(); void makeUIConnections() const;
void updateAbsoluteCenterFrequency(); void updateAbsoluteCenterFrequency();
uint32_t getValidAudioSampleRate() const; uint32_t getValidAudioSampleRate() const;
void leaveEvent(QEvent*); void leaveEvent(QEvent*) final;
void enterEvent(EnterEventType*); void enterEvent(EnterEventType*) final;
private slots: private slots:
void on_deltaFrequency_changed(qint64 value); void on_deltaFrequency_changed(qint64 value);
@ -164,7 +164,7 @@ private slots:
void on_rit_toggled(bool checked); void on_rit_toggled(bool checked);
void on_ritFrequency_valueChanged(int value); void on_ritFrequency_valueChanged(int value);
void on_dbOrS_toggled(bool checked); void on_dbOrS_toggled(bool checked);
void onWidgetRolled(QWidget* widget, bool rollDown); void onWidgetRolled(const QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void handleInputMessages(); void handleInputMessages();
void audioSelect(const QPoint& p); void audioSelect(const QPoint& p);

View File

@ -219,7 +219,7 @@ public:
double getMagSq() const; double getMagSq() const;
void getMagSqLevels(double& avg, double& peak, int& nbSamples) const; void getMagSqLevels(double& avg, double& peak, int& nbSamples) const;
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
static const char* const m_channelIdURI; static const char* const m_channelIdURI;

View File

@ -369,7 +369,7 @@ void FileSourceGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void FileSourceGUI::onMenuDialogCalled(const QPoint &p) void FileSourceGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -237,7 +237,7 @@ void LocalSourceGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void LocalSourceGUI::onMenuDialogCalled(const QPoint &p) void LocalSourceGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -331,7 +331,7 @@ void IEEE_802_15_4_ModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void IEEE_802_15_4_ModGUI::onMenuDialogCalled(const QPoint &p) void IEEE_802_15_4_ModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -353,7 +353,7 @@ void AISModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void AISModGUI::onMenuDialogCalled(const QPoint &p) void AISModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -55,19 +55,9 @@ const char* const AMMod::m_channelId ="AMMod";
AMMod::AMMod(DeviceAPI *deviceAPI) : AMMod::AMMod(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource), ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSource),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI)
m_fileSize(0),
m_recordLength(0),
m_sampleRate(48000)
{ {
setObjectName(m_channelId); setObjectName(m_channelId);
m_thread = new QThread(this);
m_basebandSource = new AMModBaseband();
m_basebandSource->setInputFileStream(&m_ifstream);
m_basebandSource->setChannel(this);
m_basebandSource->moveToThread(m_thread);
applySettings(m_settings, true); applySettings(m_settings, true);
m_deviceAPI->addChannelSource(this); m_deviceAPI->addChannelSource(this);
@ -93,8 +83,8 @@ AMMod::~AMMod()
delete m_networkManager; delete m_networkManager;
m_deviceAPI->removeChannelSourceAPI(this); m_deviceAPI->removeChannelSourceAPI(this);
m_deviceAPI->removeChannelSource(this); m_deviceAPI->removeChannelSource(this);
delete m_basebandSource;
delete m_thread; AMMod::stop();
} }
void AMMod::setDeviceAPI(DeviceAPI *deviceAPI) void AMMod::setDeviceAPI(DeviceAPI *deviceAPI)
@ -116,22 +106,62 @@ uint32_t AMMod::getNumberOfDeviceStreams() const
void AMMod::start() void AMMod::start()
{ {
if (m_running) {
return;
}
qDebug("AMMod::start"); qDebug("AMMod::start");
m_thread = new QThread(this);
m_basebandSource = new AMModBaseband();
m_basebandSource->setInputFileStream(&m_ifstream);
m_basebandSource->setChannel(this);
m_basebandSource->reset(); m_basebandSource->reset();
m_basebandSource->setCWKeyer(&m_cwKeyer);
m_basebandSource->moveToThread(m_thread);
QObject::connect(
m_thread,
&QThread::finished,
m_basebandSource,
&QObject::deleteLater
);
QObject::connect(
m_thread,
&QThread::finished,
m_thread,
&QThread::deleteLater
);
m_thread->start(); m_thread->start();
AMModBaseband::MsgConfigureAMModBaseband *msg = AMModBaseband::MsgConfigureAMModBaseband::create(m_settings, true);
m_basebandSource->getInputMessageQueue()->push(msg);
if (m_levelMeter) {
connect(m_basebandSource, SIGNAL(levelChanged(qreal, qreal, int)), m_levelMeter, SLOT(levelChanged(qreal, qreal, int)));
}
m_running = true;
} }
void AMMod::stop() void AMMod::stop()
{ {
if (!m_running) {
return;
}
qDebug("AMMod::stop"); qDebug("AMMod::stop");
m_running = false;
m_thread->exit(); m_thread->exit();
m_thread->wait(); m_thread->wait();
} }
void AMMod::pull(SampleVector::iterator& begin, unsigned int nbSamples) void AMMod::pull(SampleVector::iterator& begin, unsigned int nbSamples)
{ {
if (m_running) {
m_basebandSource->pull(begin, nbSamples); m_basebandSource->pull(begin, nbSamples);
} }
}
void AMMod::setCenterFrequency(qint64 frequency) void AMMod::setCenterFrequency(qint64 frequency)
{ {
@ -150,7 +180,7 @@ bool AMMod::handleMessage(const Message& cmd)
{ {
if (MsgConfigureAMMod::match(cmd)) if (MsgConfigureAMMod::match(cmd))
{ {
MsgConfigureAMMod& cfg = (MsgConfigureAMMod&) cmd; auto& cfg = (const MsgConfigureAMMod&) cmd;
qDebug() << "AMMod::handleMessage: MsgConfigureAMMod"; qDebug() << "AMMod::handleMessage: MsgConfigureAMMod";
applySettings(cfg.getSettings(), cfg.getForce()); applySettings(cfg.getSettings(), cfg.getForce());
@ -159,7 +189,7 @@ bool AMMod::handleMessage(const Message& cmd)
} }
else if (MsgConfigureFileSourceName::match(cmd)) else if (MsgConfigureFileSourceName::match(cmd))
{ {
MsgConfigureFileSourceName& conf = (MsgConfigureFileSourceName&) cmd; auto& conf = (const MsgConfigureFileSourceName&) cmd;
m_fileName = conf.getFileName(); m_fileName = conf.getFileName();
qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceName"; qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceName";
openFileStream(); openFileStream();
@ -167,7 +197,7 @@ bool AMMod::handleMessage(const Message& cmd)
} }
else if (MsgConfigureFileSourceSeek::match(cmd)) else if (MsgConfigureFileSourceSeek::match(cmd))
{ {
MsgConfigureFileSourceSeek& conf = (MsgConfigureFileSourceSeek&) cmd; auto& conf = (const MsgConfigureFileSourceSeek&) cmd;
int seekPercentage = conf.getPercentage(); int seekPercentage = conf.getPercentage();
qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceSeek"; qDebug() << "AMMod::handleMessage: MsgConfigureFileSourceSeek";
seekFileStream(seekPercentage); seekFileStream(seekPercentage);
@ -192,7 +222,7 @@ bool AMMod::handleMessage(const Message& cmd)
} }
else if (CWKeyer::MsgConfigureCWKeyer::match(cmd)) else if (CWKeyer::MsgConfigureCWKeyer::match(cmd))
{ {
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) cmd; auto& cfg = (const CWKeyer::MsgConfigureCWKeyer&) cmd;
qDebug() << "AMMod::handleMessage: MsgConfigureCWKeyer"; qDebug() << "AMMod::handleMessage: MsgConfigureCWKeyer";
if (m_settings.m_useReverseAPI) { if (m_settings.m_useReverseAPI) {
@ -203,11 +233,13 @@ bool AMMod::handleMessage(const Message& cmd)
} }
else if (DSPSignalNotification::match(cmd)) else if (DSPSignalNotification::match(cmd))
{ {
// Forward to the source
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
qDebug() << "AMMod::handleMessage: DSPSignalNotification"; qDebug() << "AMMod::handleMessage: DSPSignalNotification";
m_basebandSource->getInputMessageQueue()->push(rep); // Forward to the source
auto& notif = (const DSPSignalNotification&) cmd;
if (m_running) {
m_basebandSource->getInputMessageQueue()->push(new DSPSignalNotification(notif));
}
// Forward to GUI if any // Forward to GUI if any
if (getMessageQueueToGUI()) { if (getMessageQueueToGUI()) {
getMessageQueueToGUI()->push(new DSPSignalNotification(notif)); getMessageQueueToGUI()->push(new DSPSignalNotification(notif));
@ -239,7 +271,7 @@ void AMMod::openFileStream()
m_ifstream.seekg(0,std::ios_base::beg); m_ifstream.seekg(0,std::ios_base::beg);
m_sampleRate = 48000; // fixed rate m_sampleRate = 48000; // fixed rate
m_recordLength = m_fileSize / (sizeof(Real) * m_sampleRate); m_recordLength = (quint32) (m_fileSize / (sizeof(Real) * m_sampleRate));
qDebug() << "AMMod::openFileStream: " << m_fileName.toStdString().c_str() qDebug() << "AMMod::openFileStream: " << m_fileName.toStdString().c_str()
<< " fileSize: " << m_fileSize << "bytes" << " fileSize: " << m_fileSize << "bytes"
@ -338,8 +370,11 @@ void AMMod::applySettings(const AMModSettings& settings, bool force)
reverseAPIKeys.append("streamIndex"); reverseAPIKeys.append("streamIndex");
} }
if (m_running)
{
AMModBaseband::MsgConfigureAMModBaseband *msg = AMModBaseband::MsgConfigureAMModBaseband::create(settings, force); AMModBaseband::MsgConfigureAMModBaseband *msg = AMModBaseband::MsgConfigureAMModBaseband::create(settings, force);
m_basebandSource->getInputMessageQueue()->push(msg); m_basebandSource->getInputMessageQueue()->push(msg);
}
if (settings.m_useReverseAPI) if (settings.m_useReverseAPI)
{ {
@ -354,7 +389,7 @@ void AMMod::applySettings(const AMModSettings& settings, bool force)
QList<ObjectPipe*> pipes; QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes); MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
if (pipes.size() > 0) { if (!pipes.empty()) {
sendChannelSettings(pipes, reverseAPIKeys, settings, force); sendChannelSettings(pipes, reverseAPIKeys, settings, force);
} }
@ -383,12 +418,12 @@ bool AMMod::deserialize(const QByteArray& data)
} }
} }
void AMMod::sendSampleRateToDemodAnalyzer() void AMMod::sendSampleRateToDemodAnalyzer() const
{ {
QList<ObjectPipe*> pipes; QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes); MainCore::instance()->getMessagePipes().getMessagePipes(this, "reportdemod", pipes);
if (pipes.size() > 0) if (!pipes.empty())
{ {
for (const auto& pipe : pipes) for (const auto& pipe : pipes)
{ {
@ -412,7 +447,7 @@ int AMMod::webapiSettingsGet(
webapiFormatChannelSettings(response, m_settings); webapiFormatChannelSettings(response, m_settings);
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer(); SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_basebandSource->getCWKeyer().getSettings(); const CWKeyerSettings& cwKeyerSettings = getCWKeyer()->getSettings();
CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings); CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
return 200; return 200;
@ -440,11 +475,11 @@ int AMMod::webapiSettingsPutPatch(
if (channelSettingsKeys.contains("cwKeyer")) if (channelSettingsKeys.contains("cwKeyer"))
{ {
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer(); SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->getCwKeyer();
CWKeyerSettings cwKeyerSettings = m_basebandSource->getCWKeyer().getSettings(); CWKeyerSettings cwKeyerSettings = getCWKeyer()->getSettings();
CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings); CWKeyer::webapiSettingsPutPatch(channelSettingsKeys, cwKeyerSettings, apiCwKeyerSettings);
CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force); CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
m_basebandSource->getCWKeyer().getInputMessageQueue()->push(msgCwKeyer); getCWKeyer()->getInputMessageQueue()->push(msgCwKeyer);
if (m_guiMessageQueue) // forward to GUI if any if (m_guiMessageQueue) // forward to GUI if any
{ {
@ -515,13 +550,13 @@ void AMMod::webapiUpdateChannelSettings(
settings.m_reverseAPIAddress = *response.getAmModSettings()->getReverseApiAddress(); settings.m_reverseAPIAddress = *response.getAmModSettings()->getReverseApiAddress();
} }
if (channelSettingsKeys.contains("reverseAPIPort")) { if (channelSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getAmModSettings()->getReverseApiPort(); settings.m_reverseAPIPort = (uint16_t) response.getAmModSettings()->getReverseApiPort();
} }
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) { if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getAmModSettings()->getReverseApiDeviceIndex(); settings.m_reverseAPIDeviceIndex = (uint16_t) response.getAmModSettings()->getReverseApiDeviceIndex();
} }
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) { if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
settings.m_reverseAPIChannelIndex = response.getAmModSettings()->getReverseApiChannelIndex(); settings.m_reverseAPIChannelIndex = (uint16_t) response.getAmModSettings()->getReverseApiChannelIndex();
} }
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) { if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getAmModSettings()->getChannelMarker()); settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getAmModSettings()->getChannelMarker());
@ -591,7 +626,7 @@ void AMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respons
} }
else else
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
response.getAmModSettings()->setChannelMarker(swgChannelMarker); response.getAmModSettings()->setChannelMarker(swgChannelMarker);
} }
@ -605,23 +640,27 @@ void AMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respons
} }
else else
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
response.getAmModSettings()->setRollupState(swgRollupState); response.getAmModSettings()->setRollupState(swgRollupState);
} }
} }
} }
void AMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) void AMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const
{
response.getAmModReport()->setChannelPowerDb((float) CalcDb::dbPower(getMagSq()));
if (m_running)
{ {
response.getAmModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
response.getAmModReport()->setAudioSampleRate(m_basebandSource->getAudioSampleRate()); response.getAmModReport()->setAudioSampleRate(m_basebandSource->getAudioSampleRate());
response.getAmModReport()->setChannelSampleRate(m_basebandSource->getChannelSampleRate()); response.getAmModReport()->setChannelSampleRate(m_basebandSource->getChannelSampleRate());
} }
}
void AMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force) void AMMod::webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
@ -632,8 +671,8 @@ void AMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const
m_networkRequest.setUrl(QUrl(channelSettingsURL)); m_networkRequest.setUrl(QUrl(channelSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QBuffer *buffer = new QBuffer(); auto *buffer = new QBuffer();
buffer->open((QBuffer::ReadWrite)); buffer->open(QBuffer::ReadWrite);
buffer->write(swgChannelSettings->asJson().toUtf8()); buffer->write(swgChannelSettings->asJson().toUtf8());
buffer->seek(0); buffer->seek(0);
@ -646,7 +685,7 @@ void AMMod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const
void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings) void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
swgChannelSettings->setDirection(1); // single source (Tx) swgChannelSettings->setDirection(1); // single source (Tx)
swgChannelSettings->setChannelType(new QString("AMMod")); swgChannelSettings->setChannelType(new QString("AMMod"));
swgChannelSettings->setAmModSettings(new SWGSDRangel::SWGAMModSettings()); swgChannelSettings->setAmModSettings(new SWGSDRangel::SWGAMModSettings());
@ -654,7 +693,7 @@ void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings()); swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer(); SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
m_basebandSource->getCWKeyer().webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings); CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings") QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
.arg(m_settings.m_reverseAPIAddress) .arg(m_settings.m_reverseAPIAddress)
@ -664,8 +703,8 @@ void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
m_networkRequest.setUrl(QUrl(channelSettingsURL)); m_networkRequest.setUrl(QUrl(channelSettingsURL));
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json"); m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
QBuffer *buffer = new QBuffer(); auto *buffer = new QBuffer();
buffer->open((QBuffer::ReadWrite)); buffer->open(QBuffer::ReadWrite);
buffer->write(swgChannelSettings->asJson().toUtf8()); buffer->write(swgChannelSettings->asJson().toUtf8());
buffer->seek(0); buffer->seek(0);
@ -678,7 +717,7 @@ void AMMod::webapiReverseSendCWSettings(const CWKeyerSettings& cwKeyerSettings)
void AMMod::sendChannelSettings( void AMMod::sendChannelSettings(
const QList<ObjectPipe*>& pipes, const QList<ObjectPipe*>& pipes,
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const AMModSettings& settings, const AMModSettings& settings,
bool force) bool force)
{ {
@ -688,7 +727,7 @@ void AMMod::sendChannelSettings(
if (messageQueue) if (messageQueue)
{ {
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings(); auto *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force); webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create( MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
this, this,
@ -702,7 +741,7 @@ void AMMod::sendChannelSettings(
} }
void AMMod::webapiFormatChannelSettings( void AMMod::webapiFormatChannelSettings(
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const AMModSettings& settings, const AMModSettings& settings,
bool force bool force
@ -756,28 +795,28 @@ void AMMod::webapiFormatChannelSettings(
if (force) if (force)
{ {
const CWKeyerSettings& cwKeyerSettings = m_basebandSource->getCWKeyer().getSettings(); const CWKeyerSettings& cwKeyerSettings = getCWKeyer()->getSettings();
swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings()); swgAMModSettings->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings());
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer(); SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = swgAMModSettings->getCwKeyer();
m_basebandSource->getCWKeyer().webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings); CWKeyer::webapiFormatChannelSettings(apiCwKeyerSettings, cwKeyerSettings);
} }
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force)) if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
{ {
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker(); auto *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
settings.m_channelMarker->formatTo(swgChannelMarker); settings.m_channelMarker->formatTo(swgChannelMarker);
swgAMModSettings->setChannelMarker(swgChannelMarker); swgAMModSettings->setChannelMarker(swgChannelMarker);
} }
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force)) if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
{ {
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState(); auto *swgRollupState = new SWGSDRangel::SWGRollupState();
settings.m_rollupState->formatTo(swgRollupState); settings.m_rollupState->formatTo(swgRollupState);
swgAMModSettings->setRollupState(swgRollupState); swgAMModSettings->setRollupState(swgRollupState);
} }
} }
void AMMod::networkManagerFinished(QNetworkReply *reply) void AMMod::networkManagerFinished(QNetworkReply *reply) const
{ {
QNetworkReply::NetworkError replyError = reply->error(); QNetworkReply::NetworkError replyError = reply->error();
@ -800,25 +839,32 @@ void AMMod::networkManagerFinished(QNetworkReply *reply)
double AMMod::getMagSq() const double AMMod::getMagSq() const
{ {
if (m_running) {
return m_basebandSource->getMagSq(); return m_basebandSource->getMagSq();
} }
return 0;
}
CWKeyer *AMMod::getCWKeyer() CWKeyer *AMMod::getCWKeyer()
{ {
return &m_basebandSource->getCWKeyer(); return &m_cwKeyer;
}
void AMMod::setLevelMeter(QObject *levelMeter)
{
connect(m_basebandSource, SIGNAL(levelChanged(qreal, qreal, int)), levelMeter, SLOT(levelChanged(qreal, qreal, int)));
} }
int AMMod::getAudioSampleRate() const int AMMod::getAudioSampleRate() const
{ {
if (m_running) {
return m_basebandSource->getAudioSampleRate(); return m_basebandSource->getAudioSampleRate();
} }
return 0;
}
int AMMod::getFeedbackAudioSampleRate() const int AMMod::getFeedbackAudioSampleRate() const
{ {
if (m_running) {
return m_basebandSource->getFeedbackAudioSampleRate(); return m_basebandSource->getFeedbackAudioSampleRate();
} }
return 0;
}

View File

@ -28,6 +28,7 @@
#include <QNetworkRequest> #include <QNetworkRequest>
#include "dsp/basebandsamplesource.h" #include "dsp/basebandsamplesource.h"
#include "dsp/cwkeyer.h"
#include "channel/channelapi.h" #include "channel/channelapi.h"
#include "util/message.h" #include "util/message.h"
@ -235,7 +236,7 @@ public:
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
double getMagSq() const; double getMagSq() const;
CWKeyer *getCWKeyer(); CWKeyer *getCWKeyer();
void setLevelMeter(QObject *levelMeter); void setLevelMeter(QObject *levelMeter) { m_levelMeter = levelMeter; }
int getAudioSampleRate() const; int getAudioSampleRate() const;
int getFeedbackAudioSampleRate() const; int getFeedbackAudioSampleRate() const;
@ -250,6 +251,7 @@ private:
DeviceAPI* m_deviceAPI; DeviceAPI* m_deviceAPI;
QThread *m_thread; QThread *m_thread;
bool m_running = false;
AMModBaseband* m_basebandSource; AMModBaseband* m_basebandSource;
AMModSettings m_settings; AMModSettings m_settings;
@ -258,36 +260,38 @@ private:
std::ifstream m_ifstream; std::ifstream m_ifstream;
QString m_fileName; QString m_fileName;
quint64 m_fileSize; //!< raw file size (bytes) quint64 m_fileSize = 0; //!< raw file size (bytes)
quint32 m_recordLength; //!< record length in seconds computed from file size quint32 m_recordLength = 0; //!< record length in seconds computed from file size
int m_sampleRate; int m_sampleRate = 48000;
QNetworkAccessManager *m_networkManager; QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest; QNetworkRequest m_networkRequest;
CWKeyer m_cwKeyer;
QObject *m_levelMeter = nullptr;
virtual bool handleMessage(const Message& cmd); virtual bool handleMessage(const Message& cmd);
void applySettings(const AMModSettings& settings, bool force = false); void applySettings(const AMModSettings& settings, bool force = false);
void sendSampleRateToDemodAnalyzer(); void sendSampleRateToDemodAnalyzer() const;
void openFileStream(); void openFileStream();
void seekFileStream(int seekPercentage); void seekFileStream(int seekPercentage);
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response); void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response) const;
void webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force); void webapiReverseSendSettings(const QList<QString>& channelSettingsKeys, const AMModSettings& settings, bool force);
void webapiReverseSendCWSettings(const CWKeyerSettings& settings); void webapiReverseSendCWSettings(const CWKeyerSettings& settings);
void sendChannelSettings( void sendChannelSettings(
const QList<ObjectPipe*>& pipes, const QList<ObjectPipe*>& pipes,
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
const AMModSettings& settings, const AMModSettings& settings,
bool force bool force
); );
void webapiFormatChannelSettings( void webapiFormatChannelSettings(
QList<QString>& channelSettingsKeys, const QList<QString>& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings *swgChannelSettings, SWGSDRangel::SWGChannelSettings *swgChannelSettings,
const AMModSettings& settings, const AMModSettings& settings,
bool force bool force
); );
private slots: private slots:
void networkManagerFinished(QNetworkReply *reply); void networkManagerFinished(QNetworkReply *reply) const;
}; };

View File

@ -21,6 +21,7 @@
#include "dsp/upchannelizer.h" #include "dsp/upchannelizer.h"
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "dsp/dspcommands.h" #include "dsp/dspcommands.h"
#include "dsp/cwkeyer.h"
#include "ammodbaseband.h" #include "ammodbaseband.h"
@ -171,8 +172,8 @@ bool AMModBaseband::handleMessage(const Message& cmd)
qDebug() << "AMModBaseband::handleMessage: MsgConfigureCWKeyer"; qDebug() << "AMModBaseband::handleMessage: MsgConfigureCWKeyer";
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) cmd; const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) cmd;
CWKeyer::MsgConfigureCWKeyer *notif = new CWKeyer::MsgConfigureCWKeyer(cfg); CWKeyer::MsgConfigureCWKeyer *notif = new CWKeyer::MsgConfigureCWKeyer(cfg);
CWKeyer& cwKeyer = m_source.getCWKeyer(); CWKeyer *cwKeyer = m_source.getCWKeyer();
cwKeyer.getInputMessageQueue()->push(notif); cwKeyer->getInputMessageQueue()->push(notif);
return true; return true;
} }

View File

@ -63,7 +63,7 @@ public:
void reset(); void reset();
void pull(const SampleVector::iterator& begin, unsigned int nbSamples); void pull(const SampleVector::iterator& begin, unsigned int nbSamples);
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
CWKeyer& getCWKeyer() { return m_source.getCWKeyer(); } void setCWKeyer(CWKeyer *cwKeyer) { m_source.setCWKeyer(cwKeyer); }
double getMagSq() const { return m_source.getMagSq(); } double getMagSq() const { return m_source.getMagSq(); }
int getAudioSampleRate() const { return m_source.getAudioSampleRate(); } int getAudioSampleRate() const { return m_source.getAudioSampleRate(); }
int getFeedbackAudioSampleRate() const { return m_source.getFeedbackAudioSampleRate(); } int getFeedbackAudioSampleRate() const { return m_source.getFeedbackAudioSampleRate(); }

View File

@ -45,7 +45,7 @@
AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx) AMModGUI* AMModGUI::create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx)
{ {
AMModGUI* gui = new AMModGUI(pluginAPI, deviceUISet, channelTx); auto* gui = new AMModGUI(pluginAPI, deviceUISet, channelTx);
return gui; return gui;
} }
@ -82,21 +82,23 @@ bool AMModGUI::handleMessage(const Message& message)
{ {
if (AMMod::MsgReportFileSourceStreamData::match(message)) if (AMMod::MsgReportFileSourceStreamData::match(message))
{ {
m_recordSampleRate = ((AMMod::MsgReportFileSourceStreamData&)message).getSampleRate(); auto& cmd = (const AMMod::MsgReportFileSourceStreamData&) message;
m_recordLength = ((AMMod::MsgReportFileSourceStreamData&)message).getRecordLength(); m_recordSampleRate = cmd.getSampleRate();
m_recordLength = cmd.getRecordLength();
m_samplesCount = 0; m_samplesCount = 0;
updateWithStreamData(); updateWithStreamData();
return true; return true;
} }
else if (AMMod::MsgReportFileSourceStreamTiming::match(message)) else if (AMMod::MsgReportFileSourceStreamTiming::match(message))
{ {
m_samplesCount = ((AMMod::MsgReportFileSourceStreamTiming&)message).getSamplesCount(); auto& cmd = (const AMMod::MsgReportFileSourceStreamTiming&) message;
m_samplesCount = (int) cmd.getSamplesCount();
updateWithStreamTime(); updateWithStreamTime();
return true; return true;
} }
else if (AMMod::MsgConfigureAMMod::match(message)) else if (AMMod::MsgConfigureAMMod::match(message))
{ {
const AMMod::MsgConfigureAMMod& cfg = (AMMod::MsgConfigureAMMod&) message; auto& cfg = (const AMMod::MsgConfigureAMMod&) message;
m_settings = cfg.getSettings(); m_settings = cfg.getSettings();
blockApplySettings(true); blockApplySettings(true);
m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker)); m_channelMarker.updateSettings(static_cast<const ChannelMarker*>(m_settings.m_channelMarker));
@ -106,14 +108,14 @@ bool AMModGUI::handleMessage(const Message& message)
} }
else if (CWKeyer::MsgConfigureCWKeyer::match(message)) else if (CWKeyer::MsgConfigureCWKeyer::match(message))
{ {
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) message; auto& cfg = (const CWKeyer::MsgConfigureCWKeyer&) message;
ui->cwKeyerGUI->setSettings(cfg.getSettings()); ui->cwKeyerGUI->setSettings(cfg.getSettings());
ui->cwKeyerGUI->displaySettings(); ui->cwKeyerGUI->displaySettings();
return true; return true;
} }
else if (DSPSignalNotification::match(message)) else if (DSPSignalNotification::match(message))
{ {
const DSPSignalNotification& notif = (const DSPSignalNotification&) message; auto& notif = (const DSPSignalNotification&) message;
m_deviceCenterFrequency = notif.getCenterFrequency(); m_deviceCenterFrequency = notif.getCenterFrequency();
m_basebandSampleRate = notif.getSampleRate(); m_basebandSampleRate = notif.getSampleRate();
ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2); ui->deltaFrequency->setValueRange(false, 7, -m_basebandSampleRate/2, m_basebandSampleRate/2);
@ -138,7 +140,7 @@ void AMModGUI::handleSourceMessages()
{ {
Message* message; Message* message;
while ((message = getInputMessageQueue()->pop()) != 0) while ((message = getInputMessageQueue()->pop()) != nullptr)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
@ -149,7 +151,7 @@ void AMModGUI::handleSourceMessages()
void AMModGUI::on_deltaFrequency_changed(qint64 value) void AMModGUI::on_deltaFrequency_changed(qint64 value)
{ {
m_channelMarker.setCenterFrequency(value); m_channelMarker.setCenterFrequency((int) value);
m_settings.m_inputFrequencyOffset = value; m_settings.m_inputFrequencyOffset = value;
updateAbsoluteCenterFrequency(); updateAbsoluteCenterFrequency();
applySettings(); applySettings();
@ -158,7 +160,7 @@ void AMModGUI::on_deltaFrequency_changed(qint64 value)
void AMModGUI::on_rfBW_valueChanged(int value) void AMModGUI::on_rfBW_valueChanged(int value)
{ {
ui->rfBWText->setText(QString("%1 kHz").arg(value / 10.0, 0, 'f', 1)); ui->rfBWText->setText(QString("%1 kHz").arg(value / 10.0, 0, 'f', 1));
m_settings.m_rfBandwidth = value * 100.0; m_settings.m_rfBandwidth = (float) value * 100.0f;
m_channelMarker.setBandwidth(value * 100); m_channelMarker.setBandwidth(value * 100);
applySettings(); applySettings();
} }
@ -166,21 +168,21 @@ void AMModGUI::on_rfBW_valueChanged(int value)
void AMModGUI::on_modPercent_valueChanged(int value) void AMModGUI::on_modPercent_valueChanged(int value)
{ {
ui->modPercentText->setText(QString("%1").arg(value)); ui->modPercentText->setText(QString("%1").arg(value));
m_settings.m_modFactor = value / 100.0; m_settings.m_modFactor = (float) value / 100.0f;
applySettings(); applySettings();
} }
void AMModGUI::on_volume_valueChanged(int value) void AMModGUI::on_volume_valueChanged(int value)
{ {
ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1)); ui->volumeText->setText(QString("%1").arg(value / 10.0, 0, 'f', 1));
m_settings.m_volumeFactor = value / 10.0; m_settings.m_volumeFactor = (float) value / 10.0f;
applySettings(); applySettings();
} }
void AMModGUI::on_toneFrequency_valueChanged(int value) void AMModGUI::on_toneFrequency_valueChanged(int value)
{ {
ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2)); ui->toneFrequencyText->setText(QString("%1k").arg(value / 100.0, 0, 'f', 2));
m_settings.m_toneFrequency = value * 10.0; m_settings.m_toneFrequency = (float) value * 10.0f;
applySettings(); applySettings();
} }
@ -244,7 +246,7 @@ void AMModGUI::on_feedbackEnable_toggled(bool checked)
void AMModGUI::on_feedbackVolume_valueChanged(int value) void AMModGUI::on_feedbackVolume_valueChanged(int value)
{ {
ui->feedbackVolumeText->setText(QString("%1").arg(value / 100.0, 0, 'f', 2)); ui->feedbackVolumeText->setText(QString("%1").arg(value / 100.0, 0, 'f', 2));
m_settings.m_feedbackVolumeFactor = value / 100.0; m_settings.m_feedbackVolumeFactor = (float) value / 100.0f;
applySettings(); applySettings();
} }
@ -265,7 +267,7 @@ void AMModGUI::on_showFileDialog_clicked(bool checked)
{ {
(void) checked; (void) checked;
QString fileName = QFileDialog::getOpenFileName(this, QString fileName = QFileDialog::getOpenFileName(this,
tr("Open raw audio file"), ".", tr("Raw audio Files (*.raw)"), 0, QFileDialog::DontUseNativeDialog); tr("Open raw audio file"), ".", tr("Raw audio Files (*.raw)"), nullptr, QFileDialog::DontUseNativeDialog);
if (fileName != "") if (fileName != "")
{ {
@ -283,7 +285,7 @@ void AMModGUI::configureFileName()
m_amMod->getInputMessageQueue()->push(message); m_amMod->getInputMessageQueue()->push(message);
} }
void AMModGUI::onWidgetRolled(QWidget* widget, bool rollDown) void AMModGUI::onWidgetRolled(const QWidget* widget, bool rollDown)
{ {
(void) widget; (void) widget;
(void) rollDown; (void) rollDown;
@ -294,7 +296,7 @@ void AMModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void AMModGUI::onMenuDialogCalled(const QPoint &p) void AMModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
@ -367,15 +369,15 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
m_amMod = (AMMod*) channelTx; m_amMod = (AMMod*) channelTx;
m_amMod->setMessageQueueToGUI(getInputMessageQueue()); m_amMod->setMessageQueueToGUI(AMModGUI::getInputMessageQueue());
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick()));
CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->mic); m_audioMuteRightClickEnabler = new CRightClickEnabler(ui->mic);
connect(audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &))); connect(m_audioMuteRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioSelect(const QPoint &)));
CRightClickEnabler *feedbackRightClickEnabler = new CRightClickEnabler(ui->feedbackEnable); m_feedbackRightClickEnabler = new CRightClickEnabler(ui->feedbackEnable);
connect(feedbackRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioFeedbackSelect(const QPoint &))); connect(m_feedbackRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(audioFeedbackSelect(const QPoint &)));
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03))); ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));
@ -406,7 +408,7 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl
ui->cwKeyerGUI->setCWKeyer(m_amMod->getCWKeyer()); ui->cwKeyerGUI->setCWKeyer(m_amMod->getCWKeyer());
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); connect(AMModGUI::getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
m_amMod->setLevelMeter(ui->volumeMeter); m_amMod->setLevelMeter(ui->volumeMeter);
displaySettings(); displaySettings();
@ -419,6 +421,8 @@ AMModGUI::AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampl
AMModGUI::~AMModGUI() AMModGUI::~AMModGUI()
{ {
delete ui; delete ui;
delete m_audioMuteRightClickEnabler;
delete m_feedbackRightClickEnabler;
} }
void AMModGUI::blockApplySettings(bool block) void AMModGUI::blockApplySettings(bool block)
@ -439,9 +443,9 @@ void AMModGUI::applySettings(bool force)
void AMModGUI::displaySettings() void AMModGUI::displaySettings()
{ {
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
m_channelMarker.setCenterFrequency(m_settings.m_inputFrequencyOffset); m_channelMarker.setCenterFrequency((int) m_settings.m_inputFrequencyOffset);
m_channelMarker.setTitle(m_settings.m_title); m_channelMarker.setTitle(m_settings.m_title);
m_channelMarker.setBandwidth(m_settings.m_rfBandwidth); m_channelMarker.setBandwidth((int) m_settings.m_rfBandwidth);
m_channelMarker.blockSignals(false); m_channelMarker.blockSignals(false);
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
@ -453,17 +457,17 @@ void AMModGUI::displaySettings()
ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency()); ui->deltaFrequency->setValue(m_channelMarker.getCenterFrequency());
ui->rfBW->setValue(roundf(m_settings.m_rfBandwidth / 100.0)); ui->rfBW->setValue((int) roundf(m_settings.m_rfBandwidth / 100.f));
ui->rfBWText->setText(QString("%1 kHz").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1)); ui->rfBWText->setText(QString("%1 kHz").arg(m_settings.m_rfBandwidth / 1000.0, 0, 'f', 1));
int modPercent = roundf(m_settings.m_modFactor * 100.0); auto modPercent = (int) roundf(m_settings.m_modFactor * 100.0f);
ui->modPercent->setValue(modPercent); ui->modPercent->setValue(modPercent);
ui->modPercentText->setText(QString("%1").arg(modPercent)); ui->modPercentText->setText(QString("%1").arg(modPercent));
ui->toneFrequency->setValue(roundf(m_settings.m_toneFrequency / 10.0)); ui->toneFrequency->setValue((int) roundf(m_settings.m_toneFrequency / 10.0f));
ui->toneFrequencyText->setText(QString("%1k").arg(m_settings.m_toneFrequency / 1000.0, 0, 'f', 2)); ui->toneFrequencyText->setText(QString("%1k").arg(m_settings.m_toneFrequency / 1000.0, 0, 'f', 2));
ui->volume->setValue(roundf(m_settings.m_volumeFactor * 10.0)); ui->volume->setValue((int) roundf(m_settings.m_volumeFactor * 10.0f));
ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1)); ui->volumeText->setText(QString("%1").arg(m_settings.m_volumeFactor, 0, 'f', 1));
ui->channelMute->setChecked(m_settings.m_channelMute); ui->channelMute->setChecked(m_settings.m_channelMute);
@ -480,7 +484,7 @@ void AMModGUI::displaySettings()
ui->morseKeyer->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputCWTone); ui->morseKeyer->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputCWTone);
ui->feedbackEnable->setChecked(m_settings.m_feedbackAudioEnable); ui->feedbackEnable->setChecked(m_settings.m_feedbackAudioEnable);
ui->feedbackVolume->setValue(roundf(m_settings.m_feedbackVolumeFactor * 100.0)); ui->feedbackVolume->setValue((int) roundf(m_settings.m_feedbackVolumeFactor * 100.0f));
ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2)); ui->feedbackVolumeText->setText(QString("%1").arg(m_settings.m_feedbackVolumeFactor, 0, 'f', 2));
updateIndexLabel(); updateIndexLabel();
@ -605,7 +609,7 @@ void AMModGUI::updateWithStreamTime()
} }
} }
void AMModGUI::makeUIConnections() void AMModGUI::makeUIConnections() const
{ {
QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &AMModGUI::on_deltaFrequency_changed); QObject::connect(ui->deltaFrequency, &ValueDialZ::changed, this, &AMModGUI::on_deltaFrequency_changed);
QObject::connect(ui->rfBW, &QSlider::valueChanged, this, &AMModGUI::on_rfBW_valueChanged); QObject::connect(ui->rfBW, &QSlider::valueChanged, this, &AMModGUI::on_rfBW_valueChanged);

View File

@ -33,6 +33,7 @@ class DeviceUISet;
class AMMod; class AMMod;
class BasebandSampleSource; class BasebandSampleSource;
class CRightClickEnabler;
namespace Ui { namespace Ui {
class AMModGUI; class AMModGUI;
@ -45,21 +46,21 @@ public:
static AMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx); static AMModGUI* create(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx);
virtual void destroy(); virtual void destroy();
void resetToDefaults(); void resetToDefaults() final;
QByteArray serialize() const; QByteArray serialize() const final;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data) final;
virtual MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } MessageQueue *getInputMessageQueue() final { return &m_inputMessageQueue; }
virtual void setWorkspaceIndex(int index) { m_settings.m_workspaceIndex = index; }; void setWorkspaceIndex(int index) final { m_settings.m_workspaceIndex = index; };
virtual int getWorkspaceIndex() const { return m_settings.m_workspaceIndex; }; int getWorkspaceIndex() const final { return m_settings.m_workspaceIndex; };
virtual void setGeometryBytes(const QByteArray& blob) { m_settings.m_geometryBytes = blob; }; void setGeometryBytes(const QByteArray& blob) final { m_settings.m_geometryBytes = blob; };
virtual QByteArray getGeometryBytes() const { return m_settings.m_geometryBytes; }; QByteArray getGeometryBytes() const final { return m_settings.m_geometryBytes; };
virtual QString getTitle() const { return m_settings.m_title; }; QString getTitle() const final { return m_settings.m_title; };
virtual QColor getTitleColor() const { return m_settings.m_rgbColor; }; QColor getTitleColor() const final { return m_settings.m_rgbColor; };
virtual void zetHidden(bool hidden) { m_settings.m_hidden = hidden; } void zetHidden(bool hidden) final { m_settings.m_hidden = hidden; }
virtual bool getHidden() const { return m_settings.m_hidden; } bool getHidden() const final { return m_settings.m_hidden; }
virtual ChannelMarker& getChannelMarker() { return m_channelMarker; } ChannelMarker& getChannelMarker() final { return m_channelMarker; }
virtual int getStreamIndex() const { return m_settings.m_streamIndex; } int getStreamIndex() const final { return m_settings.m_streamIndex; }
virtual void setStreamIndex(int streamIndex) { m_settings.m_streamIndex = streamIndex; } void setStreamIndex(int streamIndex) final { m_settings.m_streamIndex = streamIndex; }
public slots: public slots:
void channelMarkerChangedByCursor(); void channelMarkerChangedByCursor();
@ -75,6 +76,9 @@ private:
int m_basebandSampleRate; int m_basebandSampleRate;
bool m_doApplySettings; bool m_doApplySettings;
CRightClickEnabler *m_audioMuteRightClickEnabler;
CRightClickEnabler *m_feedbackRightClickEnabler;
AMMod* m_amMod; AMMod* m_amMod;
MovingAverageUtil<double, double, 20> m_channelPowerDbAvg; MovingAverageUtil<double, double, 20> m_channelPowerDbAvg;
@ -88,8 +92,8 @@ private:
bool m_enableNavTime; bool m_enableNavTime;
MessageQueue m_inputMessageQueue; MessageQueue m_inputMessageQueue;
explicit AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0); explicit AMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = nullptr);
virtual ~AMModGUI(); ~AMModGUI() final;
void blockApplySettings(bool block); void blockApplySettings(bool block);
void applySettings(bool force = false); void applySettings(bool force = false);
@ -97,11 +101,11 @@ private:
void updateWithStreamData(); void updateWithStreamData();
void updateWithStreamTime(); void updateWithStreamTime();
bool handleMessage(const Message& message); bool handleMessage(const Message& message);
void makeUIConnections(); void makeUIConnections() const;
void updateAbsoluteCenterFrequency(); void updateAbsoluteCenterFrequency();
void leaveEvent(QEvent*); void leaveEvent(QEvent*) final;
void enterEvent(EnterEventType*); void enterEvent(EnterEventType*) final;
private slots: private slots:
void handleSourceMessages(); void handleSourceMessages();
@ -124,7 +128,7 @@ private slots:
void on_feedbackEnable_toggled(bool checked); void on_feedbackEnable_toggled(bool checked);
void on_feedbackVolume_valueChanged(int value); void on_feedbackVolume_valueChanged(int value);
void onWidgetRolled(QWidget* widget, bool rollDown); void onWidgetRolled(const QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p); void onMenuDialogCalled(const QPoint& p);
void configureFileName(); void configureFileName();

View File

@ -41,7 +41,7 @@ const PluginDescriptor AMModPlugin::m_pluginDescriptor = {
AMModPlugin::AMModPlugin(QObject* parent) : AMModPlugin::AMModPlugin(QObject* parent) :
QObject(parent), QObject(parent),
m_pluginAPI(0) m_pluginAPI(nullptr)
{ {
} }
@ -62,7 +62,7 @@ void AMModPlugin::createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **b
{ {
if (bs || cs) if (bs || cs)
{ {
AMMod *instance = new AMMod(deviceAPI); auto *instance = new AMMod(deviceAPI);
if (bs) { if (bs) {
*bs = instance; *bs = instance;

View File

@ -27,20 +27,20 @@
class DeviceUISet; class DeviceUISet;
class BasebandSampleSource; class BasebandSampleSource;
class AMModPlugin : public QObject, PluginInterface { class AMModPlugin : public QObject, public PluginInterface {
Q_OBJECT Q_OBJECT
Q_INTERFACES(PluginInterface) Q_INTERFACES(PluginInterface)
Q_PLUGIN_METADATA(IID "sdrangel.channeltx.ammod") Q_PLUGIN_METADATA(IID "sdrangel.channeltx.ammod")
public: public:
explicit AMModPlugin(QObject* parent = 0); explicit AMModPlugin(QObject* parent = nullptr);
const PluginDescriptor& getPluginDescriptor() const; const PluginDescriptor& getPluginDescriptor() const final;
void initPlugin(PluginAPI* pluginAPI); void initPlugin(PluginAPI* pluginAPI) final;
virtual void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const; void createTxChannel(DeviceAPI *deviceAPI, BasebandSampleSource **bs, ChannelAPI **cs) const final;
virtual ChannelGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const; ChannelGUI* createTxChannelGUI(DeviceUISet *deviceUISet, BasebandSampleSource *txChannel) const final;
virtual ChannelWebAPIAdapter* createChannelWebAPIAdapter() const; ChannelWebAPIAdapter* createChannelWebAPIAdapter() const final;
private: private:
static const PluginDescriptor m_pluginDescriptor; static const PluginDescriptor m_pluginDescriptor;

View File

@ -19,6 +19,7 @@
#include <QDebug> #include <QDebug>
#include "dsp/datafifo.h" #include "dsp/datafifo.h"
#include "dsp/cwkeyer.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
#include "maincore.h" #include "maincore.h"
@ -27,15 +28,8 @@
const int AMModSource::m_levelNbSamples = 480; // every 10ms const int AMModSource::m_levelNbSamples = 480; // every 10ms
AMModSource::AMModSource() : AMModSource::AMModSource() :
m_channelSampleRate(48000),
m_channelFrequencyOffset(0),
m_audioSampleRate(48000),
m_audioFifo(12000), m_audioFifo(12000),
m_feedbackAudioFifo(48000), m_feedbackAudioFifo(48000)
m_levelCalcCount(0),
m_peakLevel(0.0f),
m_levelSum(0.0f),
m_ifstream(nullptr)
{ {
m_audioFifo.setLabel("AMModSource.m_audioFifo"); m_audioFifo.setLabel("AMModSource.m_audioFifo");
m_feedbackAudioFifo.setLabel("AMModSource.m_feedbackAudioFifo"); m_feedbackAudioFifo.setLabel("AMModSource.m_feedbackAudioFifo");
@ -55,9 +49,7 @@ AMModSource::AMModSource() :
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true); applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
} }
AMModSource::~AMModSource() AMModSource::~AMModSource() = default;
{
}
void AMModSource::pull(SampleVector::iterator begin, unsigned int nbSamples) void AMModSource::pull(SampleVector::iterator begin, unsigned int nbSamples)
{ {
@ -109,7 +101,7 @@ void AMModSource::pullOne(Sample& sample)
sample.m_real = (FixReal) ci.real(); sample.m_real = (FixReal) ci.real();
sample.m_imag = (FixReal) ci.imag(); sample.m_imag = (FixReal) ci.imag();
m_demodBuffer[m_demodBufferFill] = ci.real() + ci.imag(); m_demodBuffer[m_demodBufferFill] = (qint16) (ci.real() + ci.imag());
++m_demodBufferFill; ++m_demodBufferFill;
if (m_demodBufferFill >= m_demodBuffer.size()) if (m_demodBufferFill >= m_demodBuffer.size())
@ -117,13 +109,11 @@ void AMModSource::pullOne(Sample& sample)
QList<ObjectPipe*> dataPipes; QList<ObjectPipe*> dataPipes;
MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes); MainCore::instance()->getDataPipes().getDataPipes(m_channel, "demod", dataPipes);
if (dataPipes.size() > 0) if (!dataPipes.empty())
{ {
QList<ObjectPipe*>::iterator it = dataPipes.begin(); for (auto& dataPipe : dataPipes)
for (; it != dataPipes.end(); ++it)
{ {
DataFifo *fifo = qobject_cast<DataFifo*>((*it)->m_element); DataFifo *fifo = qobject_cast<DataFifo*>(dataPipe->m_element);
if (fifo) { if (fifo) {
fifo->write((quint8*) &m_demodBuffer[0], m_demodBuffer.size() * sizeof(qint16), DataFifo::DataTypeI16); fifo->write((quint8*) &m_demodBuffer[0], m_demodBuffer.size() * sizeof(qint16), DataFifo::DataTypeI16);
@ -137,7 +127,7 @@ void AMModSource::pullOne(Sample& sample)
void AMModSource::prefetch(unsigned int nbSamples) void AMModSource::prefetch(unsigned int nbSamples)
{ {
unsigned int nbSamplesAudio = nbSamples * ((Real) m_audioSampleRate / (Real) m_channelSampleRate); auto nbSamplesAudio = (nbSamples * (unsigned int) ((Real) m_audioSampleRate / (Real) m_channelSampleRate));
pullAudio(nbSamplesAudio); pullAudio(nbSamplesAudio);
} }
@ -161,7 +151,7 @@ void AMModSource::pullAudio(unsigned int nbSamples)
void AMModSource::modulateSample() void AMModSource::modulateSample()
{ {
Real t; Real t = 0.0f;
pullAF(t); pullAF(t);
@ -184,18 +174,13 @@ void AMModSource::pullAF(Real& sample)
sample = m_toneNco.next(); sample = m_toneNco.next();
break; break;
case AMModSettings::AMModInputFile: case AMModSettings::AMModInputFile:
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
// ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
if (m_ifstream && m_ifstream->is_open()) if (m_ifstream && m_ifstream->is_open())
{ {
if (m_ifstream->eof()) if ((m_ifstream->eof()) && (m_settings.m_playLoop))
{
if (m_settings.m_playLoop)
{ {
m_ifstream->clear(); m_ifstream->clear();
m_ifstream->seekg(0, std::ios::beg); m_ifstream->seekg(0, std::ios::beg);
} }
}
if (m_ifstream->eof()) if (m_ifstream->eof())
{ {
@ -218,14 +203,18 @@ void AMModSource::pullAF(Real& sample)
case AMModSettings::AMModInputCWTone: case AMModSettings::AMModInputCWTone:
Real fadeFactor; Real fadeFactor;
if (m_cwKeyer.getSample()) if (!m_cwKeyer) {
break;
}
if (m_cwKeyer->getSample())
{ {
m_cwKeyer.getCWSmoother().getFadeSample(true, fadeFactor); m_cwKeyer->getCWSmoother().getFadeSample(true, fadeFactor);
sample = m_toneNco.next() * fadeFactor; sample = m_toneNco.next() * fadeFactor;
} }
else else
{ {
if (m_cwKeyer.getCWSmoother().getFadeSample(false, fadeFactor)) if (m_cwKeyer->getCWSmoother().getFadeSample(false, fadeFactor))
{ {
sample = m_toneNco.next() * fadeFactor; sample = m_toneNco.next() * fadeFactor;
} }
@ -236,7 +225,6 @@ void AMModSource::pullAF(Real& sample)
} }
} }
break; break;
case AMModSettings::AMModInputNone:
default: default:
sample = 0.0f; sample = 0.0f;
break; break;
@ -266,10 +254,10 @@ void AMModSource::pushFeedback(Real sample)
} }
} }
void AMModSource::processOneSample(Complex& ci) void AMModSource::processOneSample(const Complex& ci)
{ {
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = ci.real(); m_feedbackAudioBuffer[m_feedbackAudioBufferFill].l = (qint16) ci.real();
m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = ci.imag(); m_feedbackAudioBuffer[m_feedbackAudioBufferFill].r = (qint16) ci.imag();
++m_feedbackAudioBufferFill; ++m_feedbackAudioBufferFill;
if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size()) if (m_feedbackAudioBufferFill >= m_feedbackAudioBuffer.size())
@ -287,7 +275,7 @@ void AMModSource::processOneSample(Complex& ci)
} }
} }
void AMModSource::calculateLevel(Real& sample) void AMModSource::calculateLevel(const Real& sample)
{ {
if (m_levelCalcCount < m_levelNbSamples) if (m_levelCalcCount < m_levelNbSamples)
{ {
@ -319,14 +307,18 @@ void AMModSource::applyAudioSampleRate(int sampleRate)
m_interpolatorConsumed = false; m_interpolatorConsumed = false;
m_interpolatorDistance = (Real) sampleRate / (Real) m_channelSampleRate; m_interpolatorDistance = (Real) sampleRate / (Real) m_channelSampleRate;
m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0); m_interpolator.create(48, sampleRate, m_settings.m_rfBandwidth / 2.2, 3.0);
m_toneNco.setFreq(m_settings.m_toneFrequency, sampleRate); m_toneNco.setFreq(m_settings.m_toneFrequency, (float) sampleRate);
m_cwKeyer.setSampleRate(sampleRate);
m_cwKeyer.reset(); if (m_cwKeyer)
{
m_cwKeyer->setSampleRate(sampleRate);
m_cwKeyer->reset();
}
QList<ObjectPipe*> pipes; QList<ObjectPipe*> pipes;
MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes); MainCore::instance()->getMessagePipes().getMessagePipes(m_channel, "reportdemod", pipes);
if (pipes.size() > 0) if (!pipes.empty())
{ {
for (const auto& pipe : pipes) for (const auto& pipe : pipes)
{ {
@ -352,7 +344,7 @@ void AMModSource::applyFeedbackAudioSampleRate(int sampleRate)
m_feedbackInterpolatorDistanceRemain = 0; m_feedbackInterpolatorDistanceRemain = 0;
m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate; m_feedbackInterpolatorDistance = (Real) sampleRate / (Real) m_audioSampleRate;
Real cutoff = std::min(sampleRate, m_audioSampleRate) / 2.2f; Real cutoff = ((float) std::min(sampleRate, m_audioSampleRate)) / 2.2f;
m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0); m_feedbackInterpolator.create(48, sampleRate, cutoff, 3.0);
m_feedbackAudioSampleRate = sampleRate; m_feedbackAudioSampleRate = sampleRate;
} }
@ -365,9 +357,8 @@ void AMModSource::applySettings(const AMModSettings& settings, bool force)
applyAudioSampleRate(m_audioSampleRate); applyAudioSampleRate(m_audioSampleRate);
} }
if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) if ((settings.m_toneFrequency != m_settings.m_toneFrequency) || force) {
{ m_toneNco.setFreq(settings.m_toneFrequency, (float) m_audioSampleRate);
m_toneNco.setFreq(settings.m_toneFrequency, m_audioSampleRate);
} }
if ((settings.m_modAFInput != m_settings.m_modAFInput) || force) if ((settings.m_modAFInput != m_settings.m_modAFInput) || force)
@ -391,7 +382,7 @@ void AMModSource::applyChannelSettings(int channelSampleRate, int channelFrequen
if ((channelFrequencyOffset != m_channelFrequencyOffset) if ((channelFrequencyOffset != m_channelFrequencyOffset)
|| (channelSampleRate != m_channelSampleRate) || force) || (channelSampleRate != m_channelSampleRate) || force)
{ {
m_carrierNco.setFreq(channelFrequencyOffset, channelSampleRate); m_carrierNco.setFreq((float) channelFrequencyOffset, (float) channelSampleRate);
} }
if ((channelSampleRate != m_channelSampleRate) || force) if ((channelSampleRate != m_channelSampleRate) || force)
@ -408,7 +399,6 @@ void AMModSource::applyChannelSettings(int channelSampleRate, int channelFrequen
void AMModSource::handleAudio() void AMModSource::handleAudio()
{ {
QMutexLocker mlock(&m_mutex);
unsigned int nbRead; unsigned int nbRead;
while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0) while ((nbRead = m_audioFifo.read(reinterpret_cast<quint8*>(&m_audioReadBuffer[m_audioReadBufferFill]), 4096)) != 0)

View File

@ -31,23 +31,23 @@
#include "dsp/ncof.h" #include "dsp/ncof.h"
#include "dsp/interpolator.h" #include "dsp/interpolator.h"
#include "util/movingaverage.h" #include "util/movingaverage.h"
#include "dsp/cwkeyer.h"
#include "audio/audiofifo.h" #include "audio/audiofifo.h"
#include "ammodsettings.h" #include "ammodsettings.h"
class ChannelAPI; class ChannelAPI;
class CWKeyer;
class AMModSource : public QObject, public ChannelSampleSource class AMModSource : public QObject, public ChannelSampleSource
{ {
Q_OBJECT Q_OBJECT
public: public:
AMModSource(); AMModSource();
virtual ~AMModSource(); ~AMModSource() final;
virtual void pull(SampleVector::iterator begin, unsigned int nbSamples); void pull(SampleVector::iterator begin, unsigned int nbSamples) final;
virtual void pullOne(Sample& sample); void pullOne(Sample& sample) final;
virtual void prefetch(unsigned int nbSamples); void prefetch(unsigned int nbSamples) final;
void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; } void setInputFileStream(std::ifstream *ifstream) { m_ifstream = ifstream; }
AudioFifo *getAudioFifo() { return &m_audioFifo; } AudioFifo *getAudioFifo() { return &m_audioFifo; }
@ -57,7 +57,8 @@ public:
void applyFeedbackAudioSampleRate(int sampleRate); void applyFeedbackAudioSampleRate(int sampleRate);
int getAudioSampleRate() const { return m_audioSampleRate; } int getAudioSampleRate() const { return m_audioSampleRate; }
int getFeedbackAudioSampleRate() const { return m_feedbackAudioSampleRate; } int getFeedbackAudioSampleRate() const { return m_feedbackAudioSampleRate; }
CWKeyer& getCWKeyer() { return m_cwKeyer; } void setCWKeyer(CWKeyer *cwKeyer) { m_cwKeyer = cwKeyer; }
CWKeyer* getCWKeyer() { return m_cwKeyer; }
double getMagSq() const { return m_magsq; } double getMagSq() const { return m_magsq; }
void getLevels(qreal& rmsLevel, qreal& peakLevel, int& numSamples) const void getLevels(qreal& rmsLevel, qreal& peakLevel, int& numSamples) const
{ {
@ -69,8 +70,8 @@ public:
void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false); void applyChannelSettings(int channelSampleRate, int channelFrequencyOffset, bool force = false);
private: private:
int m_channelSampleRate; int m_channelSampleRate = 48000;
int m_channelFrequencyOffset; int m_channelFrequencyOffset = 0;
AMModSettings m_settings; AMModSettings m_settings;
ChannelAPI *m_channel; ChannelAPI *m_channel;
@ -90,7 +91,7 @@ private:
double m_magsq; double m_magsq;
MovingAverageUtil<double, double, 16> m_movingAverage; MovingAverageUtil<double, double, 16> m_movingAverage;
int m_audioSampleRate; int m_audioSampleRate = 48000;
AudioVector m_audioBuffer; AudioVector m_audioBuffer;
unsigned int m_audioBufferFill; unsigned int m_audioBufferFill;
AudioVector m_audioReadBuffer; AudioVector m_audioReadBuffer;
@ -105,24 +106,24 @@ private:
int m_demodBufferFill; int m_demodBufferFill;
bool m_demodBufferEnabled; bool m_demodBufferEnabled;
quint32 m_levelCalcCount; quint32 m_levelCalcCount = 0;
qreal m_rmsLevel; qreal m_rmsLevel;
qreal m_peakLevelOut; qreal m_peakLevelOut;
Real m_peakLevel; Real m_peakLevel = 0.0f;
Real m_levelSum; Real m_levelSum = 0.0f;
std::ifstream *m_ifstream; std::ifstream *m_ifstream = nullptr;
CWKeyer m_cwKeyer; CWKeyer *m_cwKeyer = nullptr;
QRecursiveMutex m_mutex; QRecursiveMutex m_mutex;
static const int m_levelNbSamples; static const int m_levelNbSamples;
void processOneSample(Complex& ci); void processOneSample(const Complex& ci);
void pullAF(Real& sample); void pullAF(Real& sample);
void pullAudio(unsigned int nbSamples); void pullAudio(unsigned int nbSamples);
void pushFeedback(Real sample); void pushFeedback(Real sample);
void calculateLevel(Real& sample); void calculateLevel(const Real& sample);
void modulateSample(); void modulateSample();
private slots: private slots:

View File

@ -309,7 +309,7 @@ public:
void setLevelMeter(QObject *levelMeter); void setLevelMeter(QObject *levelMeter);
int getEffectiveSampleRate() const; int getEffectiveSampleRate() const;
void getCameraNumbers(std::vector<int>& numbers); void getCameraNumbers(std::vector<int>& numbers);
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
static const char* const m_channelIdURI; static const char* const m_channelIdURI;
static const char* const m_channelId; static const char* const m_channelId;

View File

@ -702,7 +702,7 @@ void ATVModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void ATVModGUI::onMenuDialogCalled(const QPoint &p) void ATVModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -370,7 +370,7 @@ void ChirpChatModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void ChirpChatModGUI::onMenuDialogCalled(const QPoint &p) void ChirpChatModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -262,7 +262,7 @@ public:
uint32_t getNumberOfDeviceStreams() const; uint32_t getNumberOfDeviceStreams() const;
double getMagSq() const; double getMagSq() const;
int getEffectiveSampleRate() const; int getEffectiveSampleRate() const;
void setMessageQueueToGUI(MessageQueue* queue) override; void setMessageQueueToGUI(MessageQueue* queue) final;
static const char* const m_channelIdURI; static const char* const m_channelIdURI;
static const char* const m_channelId; static const char* const m_channelId;

View File

@ -497,7 +497,7 @@ void DATVModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void DATVModGUI::onMenuDialogCalled(const QPoint &p) void DATVModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -306,7 +306,7 @@ void FreeDVModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void FreeDVModGUI::onMenuDialogCalled(const QPoint &p) void FreeDVModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

View File

@ -402,7 +402,7 @@ void M17ModGUI::onWidgetRolled(QWidget* widget, bool rollDown)
void M17ModGUI::onMenuDialogCalled(const QPoint &p) void M17ModGUI::onMenuDialogCalled(const QPoint &p)
{ {
if (m_contextMenuType == ContextMenuChannelSettings) if (m_contextMenuType == ContextMenuType::ContextMenuChannelSettings)
{ {
BasicChannelSettingsDialog dialog(&m_channelMarker, this); BasicChannelSettingsDialog dialog(&m_channelMarker, this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI); dialog.setUseReverseAPI(m_settings.m_useReverseAPI);

Some files were not shown because too many files have changed in this diff Show More