Removed Remote Sink from build

pull/480/head
f4exb 2019-12-11 03:03:36 +01:00
rodzic 8004559ab5
commit fb3ccd05d3
9 zmienionych plików z 72 dodań i 108 usunięć

Wyświetl plik

@ -13,9 +13,9 @@ if(LIBDSDCC_FOUND AND LIBMBE_FOUND)
add_subdirectory(demoddsd) add_subdirectory(demoddsd)
endif(LIBDSDCC_FOUND AND LIBMBE_FOUND) endif(LIBDSDCC_FOUND AND LIBMBE_FOUND)
if(CM256CC_FOUND) # if(CM256CC_FOUND)
add_subdirectory(remotesink) # add_subdirectory(remotesink)
endif(CM256CC_FOUND) # endif(CM256CC_FOUND)
if (CODEC2_FOUND) if (CODEC2_FOUND)
add_subdirectory(demodfreedv) add_subdirectory(demodfreedv)

Wyświetl plik

@ -39,7 +39,6 @@
#include "remotesinkbaseband.h" #include "remotesinkbaseband.h"
MESSAGE_CLASS_DEFINITION(RemoteSink::MsgConfigureRemoteSink, Message) MESSAGE_CLASS_DEFINITION(RemoteSink::MsgConfigureRemoteSink, Message)
MESSAGE_CLASS_DEFINITION(RemoteSink::MsgBasebandSampleRateNotification, Message)
const QString RemoteSink::m_channelIdURI = "sdrangel.channel.remotesink"; const QString RemoteSink::m_channelIdURI = "sdrangel.channel.remotesink";
const QString RemoteSink::m_channelId = "RemoteSink"; const QString RemoteSink::m_channelId = "RemoteSink";
@ -48,7 +47,7 @@ RemoteSink::RemoteSink(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink), ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
m_deviceAPI(deviceAPI), m_deviceAPI(deviceAPI),
m_frequencyOffset(0), m_frequencyOffset(0),
m_basebandSampleRate(48000) m_basebandSampleRate(0)
{ {
setObjectName(m_channelId); setObjectName(m_channelId);
@ -88,8 +87,13 @@ void RemoteSink::feed(const SampleVector::const_iterator& begin, const SampleVec
void RemoteSink::start() void RemoteSink::start()
{ {
qDebug("RemoteSink::start"); qDebug("RemoteSink::start: m_basebandSampleRate: %d", m_basebandSampleRate);
m_basebandSink->reset(); m_basebandSink->reset();
if (m_basebandSampleRate != 0) {
m_basebandSink->setBasebandSampleRate(m_basebandSampleRate);
}
m_thread->start(); m_thread->start();
m_basebandSink->startSink(); m_basebandSink->startSink();
} }
@ -104,33 +108,7 @@ void RemoteSink::stop()
bool RemoteSink::handleMessage(const Message& cmd) bool RemoteSink::handleMessage(const Message& cmd)
{ {
(void) cmd; if (MsgConfigureRemoteSink::match(cmd))
if (DSPSignalNotification::match(cmd))
{
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
qDebug() << "RemoteSink::handleMessage: DSPSignalNotification:"
<< " inputSampleRate: " << notif.getSampleRate()
<< " centerFrequency: " << notif.getCenterFrequency();
m_basebandSampleRate = notif.getSampleRate();
m_centerFrequency = notif.getCenterFrequency();
calculateFrequencyOffset(); // This is when device sample rate changes
//propagateSampleRateAndFrequency(m_settings.m_localDeviceIndex, m_settings.m_log2Decim);
MsgBasebandSampleRateNotification *msg = MsgBasebandSampleRateNotification::create(m_basebandSampleRate);
m_basebandSink->getInputMessageQueue()->push(msg);
if (m_guiMessageQueue)
{
MsgBasebandSampleRateNotification *msg = MsgBasebandSampleRateNotification::create(m_basebandSampleRate);
m_guiMessageQueue->push(msg);
}
return true;
}
else if (MsgConfigureRemoteSink::match(cmd))
{ {
MsgConfigureRemoteSink& cfg = (MsgConfigureRemoteSink&) cmd; MsgConfigureRemoteSink& cfg = (MsgConfigureRemoteSink&) cmd;
qDebug() << "RemoteSink::handleMessage: MsgConfigureRemoteSink"; qDebug() << "RemoteSink::handleMessage: MsgConfigureRemoteSink";
@ -138,6 +116,25 @@ bool RemoteSink::handleMessage(const Message& cmd)
return true; return true;
} }
else if (DSPSignalNotification::match(cmd))
{
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
m_basebandSampleRate = notif.getSampleRate();
qDebug() << "RemoteSink::handleMessage: DSPSignalNotification: m_basebandSampleRate:" << m_basebandSampleRate;
// Forward to the sink
DSPSignalNotification* msgToBaseband = new DSPSignalNotification(notif); // make a copy
m_basebandSink->getInputMessageQueue()->push(msgToBaseband);
// Forward to the GUI
if (getMessageQueueToGUI())
{
DSPSignalNotification* msgToGUI = new DSPSignalNotification(notif); // make a copy
getMessageQueueToGUI()->push(msgToBaseband);
}
return true;
}
else else
{ {
return false; return false;

Wyświetl plik

@ -61,26 +61,6 @@ public:
{ } { }
}; };
class MsgBasebandSampleRateNotification : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgBasebandSampleRateNotification* create(int sampleRate) {
return new MsgBasebandSampleRateNotification(sampleRate);
}
int getBasebandSampleRate() const { return m_basebandSampleRate; }
private:
MsgBasebandSampleRateNotification(int sampleRate) :
Message(),
m_basebandSampleRate(sampleRate)
{ }
int m_basebandSampleRate;
};
RemoteSink(DeviceAPI *deviceAPI); RemoteSink(DeviceAPI *deviceAPI);
virtual ~RemoteSink(); virtual ~RemoteSink();
virtual void destroy() { delete this; } virtual void destroy() { delete this; }

Wyświetl plik

@ -24,10 +24,8 @@
#include "remotesinkbaseband.h" #include "remotesinkbaseband.h"
MESSAGE_CLASS_DEFINITION(RemoteSinkBaseband::MsgConfigureRemoteSinkBaseband, Message) MESSAGE_CLASS_DEFINITION(RemoteSinkBaseband::MsgConfigureRemoteSinkBaseband, Message)
MESSAGE_CLASS_DEFINITION(RemoteSinkBaseband::MsgBasebandSampleRateNotification, Message)
RemoteSinkBaseband::RemoteSinkBaseband() : RemoteSinkBaseband::RemoteSinkBaseband() :
m_localSampleSource(nullptr),
m_mutex(QMutex::Recursive) m_mutex(QMutex::Recursive)
{ {
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000)); m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
@ -112,16 +110,15 @@ bool RemoteSinkBaseband::handleMessage(const Message& cmd)
return true; return true;
} }
else if (MsgBasebandSampleRateNotification::match(cmd)) else if (DSPSignalNotification::match(cmd))
{ {
QMutexLocker mutexLocker(&m_mutex); DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
MsgBasebandSampleRateNotification& notif = (MsgBasebandSampleRateNotification&) cmd; m_basebandSampleRate = notif.getSampleRate();
qDebug() << "RemoteSinkBaseband::handleMessage: MsgBasebandSampleRateNotification: basebandSampleRate: " << notif.getBasebandSampleRate(); qDebug() << "RemoteSinkBaseband::handleMessage: DSPSignalNotification: basebandSampleRate:" << m_basebandSampleRate;
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getBasebandSampleRate())); m_channelizer->setBasebandSampleRate(m_basebandSampleRate);
m_channelizer->setBasebandSampleRate(notif.getBasebandSampleRate()); m_sink.applySampleRate(m_basebandSampleRate/ (1<<m_settings.m_log2Decim));
m_sink.applySampleRate(m_channelizer->getChannelSampleRate());
return true; return true;
} }
else else
{ {
@ -140,10 +137,10 @@ void RemoteSinkBaseband::applySettings(const RemoteSinkSettings& settings, bool
|| (settings.m_filterChainHash != m_settings.m_filterChainHash) || force) || (settings.m_filterChainHash != m_settings.m_filterChainHash) || force)
{ {
m_channelizer->setDecimation(settings.m_log2Decim, settings.m_filterChainHash); m_channelizer->setDecimation(settings.m_log2Decim, settings.m_filterChainHash);
m_sink.applySampleRate(m_channelizer->getChannelSampleRate()); m_sink.applySampleRate(m_basebandSampleRate/ (1<<settings.m_log2Decim));
} }
//m_source.applySettings(settings, force); m_sink.applySettings(settings, force);
m_settings = settings; m_settings = settings;
} }
@ -151,3 +148,10 @@ int RemoteSinkBaseband::getChannelSampleRate() const
{ {
return m_channelizer->getChannelSampleRate(); return m_channelizer->getChannelSampleRate();
} }
void RemoteSinkBaseband::setBasebandSampleRate(int sampleRate)
{
m_basebandSampleRate = sampleRate;
m_channelizer->setBasebandSampleRate(m_basebandSampleRate);
m_sink.applySampleRate(m_basebandSampleRate/ (1<<m_settings.m_log2Decim));
}

Wyświetl plik

@ -57,42 +57,23 @@ public:
{ } { }
}; };
class MsgBasebandSampleRateNotification : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgBasebandSampleRateNotification* create(int sampleRate) {
return new MsgBasebandSampleRateNotification(sampleRate);
}
int getBasebandSampleRate() const { return m_basebandSampleRate; }
private:
MsgBasebandSampleRateNotification(int sampleRate) :
Message(),
m_basebandSampleRate(sampleRate)
{ }
int m_basebandSampleRate;
};
RemoteSinkBaseband(); RemoteSinkBaseband();
~RemoteSinkBaseband(); ~RemoteSinkBaseband();
void reset(); void reset();
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end); void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
int getChannelSampleRate() const; int getChannelSampleRate() const;
void setBasebandSampleRate(int sampleRate);
void startSink() { m_sink.start(); } void startSink() { m_sink.start(); }
void stopSink() { m_sink.stop(); } void stopSink() { m_sink.stop(); }
private: private:
SampleSinkFifo m_sampleFifo; SampleSinkFifo m_sampleFifo;
DownSampleChannelizer *m_channelizer; DownSampleChannelizer *m_channelizer;
int m_basebandSampleRate;
RemoteSinkSink m_sink; RemoteSinkSink m_sink;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
RemoteSinkSettings m_settings; RemoteSinkSettings m_settings;
DeviceSampleSource *m_localSampleSource;
QMutex m_mutex; QMutex m_mutex;
bool handleMessage(const Message& cmd); bool handleMessage(const Message& cmd);

Wyświetl plik

@ -21,6 +21,7 @@
#include "gui/basicchannelsettingsdialog.h" #include "gui/basicchannelsettingsdialog.h"
#include "gui/devicestreamselectiondialog.h" #include "gui/devicestreamselectiondialog.h"
#include "dsp/hbfilterchainconverter.h" #include "dsp/hbfilterchainconverter.h"
#include "dsp/dspcommands.h"
#include "mainwindow.h" #include "mainwindow.h"
#include "remotesinkgui.h" #include "remotesinkgui.h"
@ -83,22 +84,24 @@ bool RemoteSinkGUI::deserialize(const QByteArray& data)
bool RemoteSinkGUI::handleMessage(const Message& message) bool RemoteSinkGUI::handleMessage(const Message& message)
{ {
if (RemoteSink::MsgBasebandSampleRateNotification::match(message)) if (RemoteSink::MsgConfigureRemoteSink::match(message))
{
RemoteSink::MsgBasebandSampleRateNotification& notif = (RemoteSink::MsgBasebandSampleRateNotification&) message;
//m_channelMarker.setBandwidth(notif.getSampleRate());
m_sampleRate = notif.getBasebandSampleRate();
updateTxDelayTime();
displayRateAndShift();
return true;
}
else if (RemoteSink::MsgConfigureRemoteSink::match(message))
{ {
const RemoteSink::MsgConfigureRemoteSink& cfg = (RemoteSink::MsgConfigureRemoteSink&) message; const RemoteSink::MsgConfigureRemoteSink& cfg = (RemoteSink::MsgConfigureRemoteSink&) message;
m_settings = cfg.getSettings(); m_settings = cfg.getSettings();
blockApplySettings(true); blockApplySettings(true);
displaySettings(); displaySettings();
blockApplySettings(false); blockApplySettings(false);
return true;
}
else if (DSPSignalNotification::match(message))
{
DSPSignalNotification& cfg = (DSPSignalNotification&) message;
m_basebandSampleRate = cfg.getSampleRate();
qDebug("RemoteSinkGUI::handleMessage: DSPSignalNotification: m_basebandSampleRate: %d", m_basebandSampleRate);
updateTxDelayTime();
displayRateAndShift();
return true; return true;
} }
else else
@ -112,7 +115,7 @@ RemoteSinkGUI::RemoteSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
ui(new Ui::RemoteSinkGUI), ui(new Ui::RemoteSinkGUI),
m_pluginAPI(pluginAPI), m_pluginAPI(pluginAPI),
m_deviceUISet(deviceUISet), m_deviceUISet(deviceUISet),
m_sampleRate(0), m_basebandSampleRate(0),
m_tickCount(0) m_tickCount(0)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -173,7 +176,7 @@ void RemoteSinkGUI::displaySettings()
m_channelMarker.blockSignals(true); m_channelMarker.blockSignals(true);
m_channelMarker.setCenterFrequency(0); m_channelMarker.setCenterFrequency(0);
m_channelMarker.setTitle(m_settings.m_title); m_channelMarker.setTitle(m_settings.m_title);
m_channelMarker.setBandwidth(m_sampleRate); // TODO m_channelMarker.setBandwidth(m_basebandSampleRate); // TODO
m_channelMarker.setMovable(false); // do not let user move the center arbitrarily m_channelMarker.setMovable(false); // do not let user move the center arbitrarily
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
@ -207,8 +210,8 @@ void RemoteSinkGUI::displayStreamIndex()
void RemoteSinkGUI::displayRateAndShift() void RemoteSinkGUI::displayRateAndShift()
{ {
int shift = m_shiftFrequencyFactor * m_sampleRate; int shift = m_shiftFrequencyFactor * m_basebandSampleRate;
double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Decim); double channelSampleRate = ((double) m_basebandSampleRate) / (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)));
@ -365,7 +368,7 @@ void RemoteSinkGUI::updateTxDelayTime()
{ {
double txDelayRatio = m_settings.m_txDelay / 100.0; double txDelayRatio = m_settings.m_txDelay / 100.0;
int samplesPerBlock = RemoteNbBytesPerBlock / sizeof(Sample); int samplesPerBlock = RemoteNbBytesPerBlock / sizeof(Sample);
double delay = m_sampleRate == 0 ? 0.0 : (127*samplesPerBlock*txDelayRatio) / m_sampleRate; double delay = m_basebandSampleRate == 0 ? 0.0 : (127*samplesPerBlock*txDelayRatio) / m_basebandSampleRate;
delay /= 128 + m_settings.m_nbFECBlocks; delay /= 128 + m_settings.m_nbFECBlocks;
ui->txDelayTime->setText(tr("%1µs").arg(QString::number(delay*1e6, 'f', 0))); ui->txDelayTime->setText(tr("%1µs").arg(QString::number(delay*1e6, 'f', 0)));
} }

Wyświetl plik

@ -62,7 +62,7 @@ private:
DeviceUISet* m_deviceUISet; DeviceUISet* m_deviceUISet;
ChannelMarker m_channelMarker; ChannelMarker m_channelMarker;
RemoteSinkSettings m_settings; RemoteSinkSettings m_settings;
int m_sampleRate; int m_basebandSampleRate;
quint64 m_deviceCenterFrequency; //!< Center frequency in device quint64 m_deviceCenterFrequency; //!< Center frequency in device
double m_shiftFrequencyFactor; //!< Channel frequency shift factor double m_shiftFrequencyFactor; //!< Channel frequency shift factor
bool m_doApplySettings; bool m_doApplySettings;

Wyświetl plik

@ -61,9 +61,9 @@ void RemoteSinkSink::setTxDelay(int txDelay, int nbBlocksFEC)
delay /= 128 + nbBlocksFEC; delay /= 128 + nbBlocksFEC;
m_txDelay = roundf(delay*1e6); // microseconds m_txDelay = roundf(delay*1e6); // microseconds
qDebug() << "RemoteSinkSink::setTxDelay:" qDebug() << "RemoteSinkSink::setTxDelay:"
<< " " << txDelay << "txDelay:" << txDelay << "%"
<< "% m_txDelay: " << m_txDelay << "us" << "m_txDelay:" << m_txDelay << "us"
<< " m_sampleRate: " << m_sampleRate << "S/s"; << "m_sampleRate: " << m_sampleRate << "S/s";
} }
void RemoteSinkSink::setNbBlocksFEC(int nbBlocksFEC) void RemoteSinkSink::setNbBlocksFEC(int nbBlocksFEC)
@ -210,7 +210,6 @@ void RemoteSinkSink::stop()
{ {
m_remoteSinkThread->startStop(false); m_remoteSinkThread->startStop(false);
m_remoteSinkThread->deleteLater(); m_remoteSinkThread->deleteLater();
m_remoteSinkThread = nullptr;
} }
m_running = false; m_running = false;

Wyświetl plik

@ -114,7 +114,7 @@ void RemoteSinkThread::handleDataBlock(RemoteDataBlock& dataBlock)
{ {
// send block via UDP // send block via UDP
m_socket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_address, dataPort); m_socket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_address, dataPort);
usleep(txDelay); //usleep(txDelay);
} }
} }
} }
@ -159,7 +159,7 @@ void RemoteSinkThread::handleDataBlock(RemoteDataBlock& dataBlock)
{ {
// send block via UDP // send block via UDP
m_socket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_address, dataPort); m_socket->writeDatagram((const char*)&txBlockx[i], (qint64 ) RemoteUdpSize, m_address, dataPort);
usleep(txDelay); //usleep(txDelay);
} }
} }
} }