1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-25 17:28:50 -05:00

Pager demod: optimize feed samples to scope and set sample rate in scope GUI

This commit is contained in:
f4exb 2021-07-13 18:03:12 +02:00
parent 4bd7c5dac8
commit 8750ca9160
3 changed files with 16 additions and 7 deletions

View File

@ -463,6 +463,7 @@ PagerDemodGUI::PagerDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Bas
m_scopeVis->setLiveRate(PagerDemodSettings::m_channelSampleRate);
ui->glScope->connectTimer(MainCore::instance()->getMasterTimer());
ui->scopeGUI->setBuddies(m_scopeVis->getInputMessageQueue(), m_scopeVis, ui->glScope);
ui->scopeGUI->setSampleRate(PagerDemodSettings::m_channelSampleRate);
ui->deltaFrequencyLabel->setText(QString("%1f").arg(QChar(0x94, 0x03)));
ui->deltaFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold));

View File

@ -49,7 +49,8 @@ PagerDemodSink::PagerDemodSink(PagerDemod *pagerDemod) :
m_syncCount(75),
m_batchNumber(0),
m_wordCount(0),
m_addressValid(0)
m_addressValid(0),
m_sampleBufferIndex(0)
{
m_magsq = 0.0;
@ -58,6 +59,7 @@ PagerDemodSink::PagerDemodSink(PagerDemod *pagerDemod) :
applySettings(m_settings, true);
applyChannelSettings(m_channelSampleRate, m_channelFrequencyOffset, true);
m_sampleBuffer.resize(m_sampleBufferSize);
}
PagerDemodSink::~PagerDemodSink()
@ -68,12 +70,15 @@ void PagerDemodSink::sampleToScope(Complex sample)
{
if (m_scopeSink)
{
ComplexVector m_sampleBuffer;
m_sampleBuffer.push_back(sample);
std::vector<ComplexVector::const_iterator> vbegin;
vbegin.push_back(m_sampleBuffer.begin());
m_scopeSink->feed(vbegin, m_sampleBuffer.end() - m_sampleBuffer.begin());
m_sampleBuffer.clear();
m_sampleBuffer[m_sampleBufferIndex++] = sample;
if (m_sampleBufferIndex == m_sampleBufferSize)
{
std::vector<ComplexVector::const_iterator> vbegin;
vbegin.push_back(m_sampleBuffer.begin());
m_scopeSink->feed(vbegin, m_sampleBufferSize);
m_sampleBufferIndex = 0;
}
}
}

View File

@ -140,6 +140,9 @@ private:
QVector<qint16> m_demodBuffer;
int m_demodBufferFill;
ComplexVector m_sampleBuffer;
static const int m_sampleBufferSize = PagerDemodSettings::m_channelSampleRate / 20; // 50ms
int m_sampleBufferIndex;
void processOneSample(Complex &ci);
MessageQueue *getMessageQueueToChannel() { return m_messageQueueToChannel; }