1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-08-14 15:33:34 -04:00

Channel local source (1)

This commit is contained in:
f4exb
2019-05-10 00:34:35 +02:00
parent 7e128335f1
commit 6d5d77dc6c
287 changed files with 454 additions and 298 deletions
+23 -7
View File
@@ -17,9 +17,10 @@
///////////////////////////////////////////////////////////////////////////////////
#include <dsp/upchannelizer.h>
#include "dsp/upchannelizer.h"
#include "dsp/inthalfbandfilter.h"
#include "dsp/dspcommands.h"
#include "dsp/hbfilterchainconverter.h"
#include <QString>
#include <QDebug>
@@ -28,6 +29,7 @@ MESSAGE_CLASS_DEFINITION(UpChannelizer::MsgChannelizerNotification, Message)
MESSAGE_CLASS_DEFINITION(UpChannelizer::MsgSetChannelizer, Message)
UpChannelizer::UpChannelizer(BasebandSampleSource* sampleSource) :
m_filterChainSetMode(false),
m_sampleSource(sampleSource),
m_outputSampleRate(0),
m_requestedInputSampleRate(0),
@@ -50,6 +52,12 @@ void UpChannelizer::configure(MessageQueue* messageQueue, int sampleRate, int ce
messageQueue->push(cmd);
}
void UpChannelizer::set(MessageQueue* messageQueue, unsigned int log2Interp, unsigned int filterChainHash)
{
Message* cmd = new MsgSetChannelizer(log2Interp, filterChainHash);
messageQueue->push(cmd);
}
void UpChannelizer::pull(Sample& sample)
{
if(m_sampleSource == 0) {
@@ -133,7 +141,10 @@ bool UpChannelizer::handleMessage(const Message& cmd)
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
m_outputSampleRate = notif.getSampleRate();
qDebug() << "UpChannelizer::handleMessage: DSPSignalNotification: m_outputSampleRate: " << m_outputSampleRate;
applyConfiguration();
if (!m_filterChainSetMode) {
applyConfiguration();
}
if (m_sampleSource != 0)
{
@@ -162,7 +173,7 @@ bool UpChannelizer::handleMessage(const Message& cmd)
{
MsgSetChannelizer& chan = (MsgSetChannelizer&) cmd;
qDebug() << "UpChannelizer::handleMessage: MsgSetChannelizer";
applySetting(chan.getStageIndexes());
applySetting(chan.getLog2Interp(), chan.getFilterChainHash());
return true;
}
@@ -182,6 +193,8 @@ bool UpChannelizer::handleMessage(const Message& cmd)
void UpChannelizer::applyConfiguration()
{
m_filterChainSetMode = false;
if (m_outputSampleRate == 0)
{
qDebug() << "UpChannelizer::applyConfiguration: aborting (out=0):"
@@ -192,6 +205,7 @@ void UpChannelizer::applyConfiguration()
return;
}
m_mutex.lock();
freeFilterChain();
@@ -217,14 +231,16 @@ void UpChannelizer::applyConfiguration()
}
}
void UpChannelizer::applySetting(const std::vector<unsigned int>& stageIndexes)
void UpChannelizer::applySetting(unsigned int log2Interp, unsigned int filterChainHash)
{
m_filterChainSetMode = true;
std::vector<unsigned int> stageIndexes;
m_currentCenterFrequency = m_outputSampleRate * HBFilterChainConverter::convertToIndexes(log2Interp, filterChainHash, stageIndexes);
m_requestedCenterFrequency = m_currentCenterFrequency;
m_mutex.lock();
freeFilterChain();
m_currentCenterFrequency = m_outputSampleRate * setFilterChain(stageIndexes);
m_mutex.unlock();
m_currentInputSampleRate = m_outputSampleRate / (1 << m_filterStages.size());