1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Removed Remote Sink from build

This commit is contained in:
f4exb 2019-12-11 03:03:36 +01:00
parent 8004559ab5
commit fb3ccd05d3
9 changed files with 72 additions and 108 deletions

View File

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

View File

@ -39,7 +39,6 @@
#include "remotesinkbaseband.h"
MESSAGE_CLASS_DEFINITION(RemoteSink::MsgConfigureRemoteSink, Message)
MESSAGE_CLASS_DEFINITION(RemoteSink::MsgBasebandSampleRateNotification, Message)
const QString RemoteSink::m_channelIdURI = "sdrangel.channel.remotesink";
const QString RemoteSink::m_channelId = "RemoteSink";
@ -48,7 +47,7 @@ RemoteSink::RemoteSink(DeviceAPI *deviceAPI) :
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
m_deviceAPI(deviceAPI),
m_frequencyOffset(0),
m_basebandSampleRate(48000)
m_basebandSampleRate(0)
{
setObjectName(m_channelId);
@ -88,8 +87,13 @@ void RemoteSink::feed(const SampleVector::const_iterator& begin, const SampleVec
void RemoteSink::start()
{
qDebug("RemoteSink::start");
qDebug("RemoteSink::start: m_basebandSampleRate: %d", m_basebandSampleRate);
m_basebandSink->reset();
if (m_basebandSampleRate != 0) {
m_basebandSink->setBasebandSampleRate(m_basebandSampleRate);
}
m_thread->start();
m_basebandSink->startSink();
}
@ -104,33 +108,7 @@ void RemoteSink::stop()
bool RemoteSink::handleMessage(const Message& cmd)
{
(void) 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))
if (MsgConfigureRemoteSink::match(cmd))
{
MsgConfigureRemoteSink& cfg = (MsgConfigureRemoteSink&) cmd;
qDebug() << "RemoteSink::handleMessage: MsgConfigureRemoteSink";
@ -138,6 +116,25 @@ bool RemoteSink::handleMessage(const Message& cmd)
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
{
return false;

View File

@ -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);
virtual ~RemoteSink();
virtual void destroy() { delete this; }

View File

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

View File

@ -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();
void reset();
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
int getChannelSampleRate() const;
void setBasebandSampleRate(int sampleRate);
void startSink() { m_sink.start(); }
void stopSink() { m_sink.stop(); }
private:
SampleSinkFifo m_sampleFifo;
DownSampleChannelizer *m_channelizer;
int m_basebandSampleRate;
RemoteSinkSink m_sink;
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
RemoteSinkSettings m_settings;
DeviceSampleSource *m_localSampleSource;
QMutex m_mutex;
bool handleMessage(const Message& cmd);

View File

@ -21,6 +21,7 @@
#include "gui/basicchannelsettingsdialog.h"
#include "gui/devicestreamselectiondialog.h"
#include "dsp/hbfilterchainconverter.h"
#include "dsp/dspcommands.h"
#include "mainwindow.h"
#include "remotesinkgui.h"
@ -83,22 +84,24 @@ bool RemoteSinkGUI::deserialize(const QByteArray& data)
bool RemoteSinkGUI::handleMessage(const Message& message)
{
if (RemoteSink::MsgBasebandSampleRateNotification::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))
if (RemoteSink::MsgConfigureRemoteSink::match(message))
{
const RemoteSink::MsgConfigureRemoteSink& cfg = (RemoteSink::MsgConfigureRemoteSink&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
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;
}
else
@ -112,7 +115,7 @@ RemoteSinkGUI::RemoteSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
ui(new Ui::RemoteSinkGUI),
m_pluginAPI(pluginAPI),
m_deviceUISet(deviceUISet),
m_sampleRate(0),
m_basebandSampleRate(0),
m_tickCount(0)
{
ui->setupUi(this);
@ -173,7 +176,7 @@ void RemoteSinkGUI::displaySettings()
m_channelMarker.blockSignals(true);
m_channelMarker.setCenterFrequency(0);
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.blockSignals(false);
m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only
@ -207,8 +210,8 @@ void RemoteSinkGUI::displayStreamIndex()
void RemoteSinkGUI::displayRateAndShift()
{
int shift = m_shiftFrequencyFactor * m_sampleRate;
double channelSampleRate = ((double) m_sampleRate) / (1<<m_settings.m_log2Decim);
int shift = m_shiftFrequencyFactor * m_basebandSampleRate;
double channelSampleRate = ((double) m_basebandSampleRate) / (1<<m_settings.m_log2Decim);
QLocale loc;
ui->offsetFrequencyText->setText(tr("%1 Hz").arg(loc.toString(shift)));
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;
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;
ui->txDelayTime->setText(tr("%1µs").arg(QString::number(delay*1e6, 'f', 0)));
}

View File

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

View File

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

View File

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