mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
Bring BFM demod closer to AM demod design.
This commit is contained in:
parent
605cf51d7f
commit
60db324abc
@ -76,7 +76,6 @@ BFMDemod::BFMDemod(DeviceAPI *deviceAPI) :
|
||||
this,
|
||||
&BFMDemod::handleIndexInDeviceSetChanged
|
||||
);
|
||||
start();
|
||||
}
|
||||
|
||||
BFMDemod::~BFMDemod()
|
||||
@ -129,21 +128,25 @@ void BFMDemod::start()
|
||||
m_basebandSink->setSpectrumSink(&m_spectrumVis);
|
||||
m_basebandSink->setChannel(this);
|
||||
m_basebandSink->moveToThread(m_thread);
|
||||
m_basebandSink->setMessageQueueToGUI(getMessageQueueToGUI());
|
||||
|
||||
QObject::connect(m_thread, &QThread::finished, m_basebandSink, &QObject::deleteLater);
|
||||
QObject::connect(m_thread, &QThread::finished, m_thread, &QThread::deleteLater);
|
||||
|
||||
if (m_basebandSampleRate != 0) {
|
||||
m_basebandSink->setBasebandSampleRate(m_basebandSampleRate);
|
||||
}
|
||||
m_basebandSink->reset();
|
||||
m_basebandSink->startWork();
|
||||
m_thread->start();
|
||||
|
||||
DSPSignalNotification *dspMsg = new DSPSignalNotification(m_basebandSampleRate, 0);
|
||||
m_basebandSink->getInputMessageQueue()->push(dspMsg);
|
||||
|
||||
BFMDemodBaseband::MsgConfigureBFMDemodBaseband *msg = BFMDemodBaseband::MsgConfigureBFMDemodBaseband::create(m_settings, true);
|
||||
m_basebandSink->getInputMessageQueue()->push(msg);
|
||||
|
||||
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
||||
spectrumSettings.m_ssb = true;
|
||||
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
m_spectrumVis.getInputMessageQueue()->push(msg);
|
||||
SpectrumVis::MsgConfigureSpectrumVis *visMsg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
||||
m_spectrumVis.getInputMessageQueue()->push(visMsg);
|
||||
|
||||
m_running = true;
|
||||
}
|
||||
|
@ -76,7 +76,6 @@ public:
|
||||
virtual void setDeviceAPI(DeviceAPI *deviceAPI);
|
||||
virtual DeviceAPI *getDeviceAPI() { return m_deviceAPI; }
|
||||
SpectrumVis *getSpectrumVis() { return &m_spectrumVis; }
|
||||
void setBasebandMessageQueueToGUI(MessageQueue *messageQueue) { m_basebandSink->setMessageQueueToGUI(messageQueue); }
|
||||
|
||||
using BasebandSampleSink::feed;
|
||||
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool po);
|
||||
|
@ -43,8 +43,6 @@ BFMDemodBaseband::BFMDemodBaseband() :
|
||||
DSPEngine::instance()->getAudioDeviceManager()->addAudioSink(m_sink.getAudioFifo(), getInputMessageQueue());
|
||||
m_sink.applyAudioSampleRate(DSPEngine::instance()->getAudioDeviceManager()->getOutputSampleRate());
|
||||
m_channelSampleRate = 0;
|
||||
|
||||
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
}
|
||||
|
||||
BFMDemodBaseband::~BFMDemodBaseband()
|
||||
@ -56,6 +54,7 @@ BFMDemodBaseband::~BFMDemodBaseband()
|
||||
void BFMDemodBaseband::reset()
|
||||
{
|
||||
QMutexLocker mutexLocker(&m_mutex);
|
||||
m_inputMessageQueue.clear();
|
||||
m_sampleFifo.reset();
|
||||
m_channelSampleRate = 0;
|
||||
}
|
||||
|
@ -413,7 +413,6 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
m_spectrumVis = m_bfmDemod->getSpectrumVis();
|
||||
m_spectrumVis->setGLSpectrum(ui->glSpectrum);
|
||||
m_bfmDemod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
m_bfmDemod->setBasebandMessageQueueToGUI(getInputMessageQueue());
|
||||
|
||||
ui->spectrumGUI->setBuddies(m_spectrumVis, ui->glSpectrum);
|
||||
|
||||
|
@ -222,8 +222,10 @@ void BFMDemodSink::feed(const SampleVector::const_iterator& begin, const SampleV
|
||||
{
|
||||
std::size_t res = m_audioFifo.write((const quint8*)&m_audioBuffer[0], std::min(m_audioBufferFill, m_audioBuffer.size()));
|
||||
|
||||
if(res != m_audioBufferFill) {
|
||||
if (res != m_audioBufferFill)
|
||||
{
|
||||
qDebug("BFMDemodSink::feed: %lu/%lu audio samples written", res, m_audioBufferFill);
|
||||
m_audioFifo.clear();
|
||||
}
|
||||
|
||||
m_audioBufferFill = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user