1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-20 16:41:01 -05:00
sdrangel/sdrbase/dsp/threadedbasebandsamplesource.cpp

71 lines
2.8 KiB
C++
Raw Normal View History

2016-10-17 02:58:49 -04:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 F4EXB //
// written by Edouard Griffiths //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QDebug>
#include <QThread>
#include "dsp/threadedbasebandsamplesource.h"
ThreadedBasebandSampleSource::ThreadedBasebandSampleSource(BasebandSampleSource* sampleSource, QObject *parent) :
m_basebandSampleSource(sampleSource)
{
QString name = "ThreadedBasebandSampleSource(" + m_basebandSampleSource->objectName() + ")";
setObjectName(name);
qDebug() << "ThreadedBasebandSampleSource::ThreadedBasebandSampleSource: " << name;
m_thread = new QThread(parent);
m_basebandSampleSource->moveToThread(m_thread);
qDebug() << "ThreadedBasebandSampleSource::ThreadedBasebandSampleSource: thread: " << thread() << " m_thread: " << m_thread;
}
ThreadedBasebandSampleSource::~ThreadedBasebandSampleSource()
{
delete m_thread;
}
void ThreadedBasebandSampleSource::start()
{
qDebug() << "ThreadedBasebandSampleSource::start";
m_thread->start();
m_basebandSampleSource->start();
}
void ThreadedBasebandSampleSource::stop()
{
qDebug() << "ThreadedBasebandSampleSource::stop";
m_basebandSampleSource->stop();
m_thread->exit();
m_thread->wait();
}
void ThreadedBasebandSampleSource::pull(Sample& sample)
2016-10-17 02:58:49 -04:00
{
m_basebandSampleSource->pull(sample);
2016-10-17 02:58:49 -04:00
}
bool ThreadedBasebandSampleSource::handleSourceMessage(const Message& cmd)
{
return m_basebandSampleSource->handleMessage(cmd);
}
QString ThreadedBasebandSampleSource::getSampleSourceObjectName() const
{
return m_basebandSampleSource->objectName();
}