LocalSink: fixed DSPSignalNotification& message passing to baseband and size sink FIFO depending on channel sample rate

pull/575/head
f4exb 2020-06-27 04:59:40 +02:00
rodzic 83e78deb9f
commit eee7640cdd
5 zmienionych plików z 14 dodań i 27 usunięć

Wyświetl plik

@ -116,7 +116,7 @@ bool LocalSink::handleMessage(const Message& cmd)
calculateFrequencyOffset(m_settings.m_log2Decim, m_settings.m_filterChainHash); // This is when device sample rate changes
propagateSampleRateAndFrequency(m_settings.m_localDeviceIndex, m_settings.m_log2Decim);
MsgBasebandSampleRateNotification *msg = MsgBasebandSampleRateNotification::create(notif.getSampleRate());
DSPSignalNotification *msg = new DSPSignalNotification(notif.getSampleRate(), notif.getCenterFrequency());
m_basebandSink->getInputMessageQueue()->push(msg);
if (getMessageQueueToGUI())

Wyświetl plik

@ -25,7 +25,6 @@
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkBaseband, Message)
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalSinkWork, Message)
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgBasebandSampleRateNotification, Message)
MESSAGE_CLASS_DEFINITION(LocalSinkBaseband::MsgConfigureLocalDeviceSampleSource, Message)
LocalSinkBaseband::LocalSinkBaseband() :
@ -114,13 +113,14 @@ bool LocalSinkBaseband::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() << "LocalSinkBaseband::handleMessage: MsgBasebandSampleRateNotification: basebandSampleRate: " << notif.getBasebandSampleRate();
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getBasebandSampleRate()));
m_channelizer->setBasebandSampleRate(notif.getBasebandSampleRate());
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
qDebug() << "LocalSinkBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
m_channelizer->setBasebandSampleRate(notif.getSampleRate(), true); // apply decimation
m_sink.setSampleRate(getChannelSampleRate());
return true;
}
@ -169,6 +169,7 @@ void LocalSinkBaseband::applySettings(const LocalSinkSettings& settings, bool fo
|| (settings.m_filterChainHash != m_settings.m_filterChainHash) || force)
{
m_channelizer->setDecimation(settings.m_log2Decim, settings.m_filterChainHash);
m_sink.setSampleRate(getChannelSampleRate());
}
//m_source.applySettings(settings, force);

Wyświetl plik

@ -77,26 +77,6 @@ public:
{ }
};
class MsgBasebandSampleRateNotification : public Message {
MESSAGE_CLASS_DECLARATION
public:
static MsgBasebandSampleRateNotification* create(int sampleRate) {
return new MsgBasebandSampleRateNotification(sampleRate);
}
int getBasebandSampleRate() const { return m_sampleRate; }
private:
MsgBasebandSampleRateNotification(int sampleRate) :
Message(),
m_sampleRate(sampleRate)
{ }
int m_sampleRate;
};
class MsgConfigureLocalDeviceSampleSource : public Message {
MESSAGE_CLASS_DECLARATION

Wyświetl plik

@ -103,3 +103,8 @@ void LocalSinkSink::applySettings(const LocalSinkSettings& settings, bool force)
m_settings = settings;
}
void LocalSinkSink::setSampleRate(int sampleRate)
{
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(sampleRate));
}

Wyświetl plik

@ -39,6 +39,7 @@ public:
void start(DeviceSampleSource *deviceSource);
void stop();
bool isRunning() const { return m_running; }
void setSampleRate(int sampleRate);
private:
SampleSinkFifo m_sampleFifo;