kopia lustrzana https://github.com/f4exb/sdrangel
DATV demod: allocate DATVDemodSink dynamically
rodzic
8e76700618
commit
414e695121
|
@ -31,12 +31,14 @@ DATVDemodBaseband::DATVDemodBaseband() :
|
||||||
{
|
{
|
||||||
qDebug("DATVDemodBaseband::DATVDemodBaseband");
|
qDebug("DATVDemodBaseband::DATVDemodBaseband");
|
||||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
|
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(48000));
|
||||||
m_channelizer = new DownChannelizer(&m_sink);
|
m_sink = new DATVDemodSink();
|
||||||
|
m_channelizer = new DownChannelizer(m_sink);
|
||||||
}
|
}
|
||||||
|
|
||||||
DATVDemodBaseband::~DATVDemodBaseband()
|
DATVDemodBaseband::~DATVDemodBaseband()
|
||||||
{
|
{
|
||||||
delete m_channelizer;
|
delete m_channelizer;
|
||||||
|
delete m_sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DATVDemodBaseband::reset()
|
void DATVDemodBaseband::reset()
|
||||||
|
@ -62,7 +64,7 @@ void DATVDemodBaseband::startWork()
|
||||||
void DATVDemodBaseband::stopWork()
|
void DATVDemodBaseband::stopWork()
|
||||||
{
|
{
|
||||||
QMutexLocker mutexLocker(&m_mutex);
|
QMutexLocker mutexLocker(&m_mutex);
|
||||||
m_sink.stopVideo();
|
m_sink->stopVideo();
|
||||||
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
disconnect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||||
QObject::disconnect(
|
QObject::disconnect(
|
||||||
&m_sampleFifo,
|
&m_sampleFifo,
|
||||||
|
@ -136,7 +138,7 @@ bool DATVDemodBaseband::handleMessage(const Message& cmd)
|
||||||
qDebug() << "DATVDemodBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
|
qDebug() << "DATVDemodBaseband::handleMessage: DSPSignalNotification: basebandSampleRate: " << notif.getSampleRate();
|
||||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(notif.getSampleRate()));
|
||||||
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
m_channelizer->setBasebandSampleRate(notif.getSampleRate());
|
||||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
m_sink->applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -156,17 +158,17 @@ void DATVDemodBaseband::applySettings(const DATVDemodSettings& settings, bool fo
|
||||||
unsigned int desiredSampleRate = 2 * settings.m_symbolRate; // m_channelizer->getBasebandSampleRate();
|
unsigned int desiredSampleRate = 2 * settings.m_symbolRate; // m_channelizer->getBasebandSampleRate();
|
||||||
m_channelizer->setChannelization(desiredSampleRate, settings.m_centerFrequency);
|
m_channelizer->setChannelization(desiredSampleRate, settings.m_centerFrequency);
|
||||||
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(m_channelizer->getBasebandSampleRate()));
|
m_sampleFifo.setSize(SampleSinkFifo::getSizePolicy(m_channelizer->getBasebandSampleRate()));
|
||||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
m_sink->applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force)
|
||||||
{
|
{
|
||||||
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
AudioDeviceManager *audioDeviceManager = DSPEngine::instance()->getAudioDeviceManager();
|
||||||
int audioDeviceIndex = audioDeviceManager->getOutputDeviceIndex(settings.m_audioDeviceName);
|
int audioDeviceIndex = audioDeviceManager->getOutputDeviceIndex(settings.m_audioDeviceName);
|
||||||
audioDeviceManager->addAudioSink(m_sink.getAudioFifo(), getInputMessageQueue(), audioDeviceIndex);
|
audioDeviceManager->addAudioSink(m_sink->getAudioFifo(), getInputMessageQueue(), audioDeviceIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sink.applySettings(settings, force);
|
m_sink->applySettings(settings, force);
|
||||||
m_settings = settings;
|
m_settings = settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,5 +182,5 @@ void DATVDemodBaseband::setBasebandSampleRate(int sampleRate)
|
||||||
{
|
{
|
||||||
qDebug("DATVDemodBaseband::setBasebandSampleRate: %d", sampleRate);
|
qDebug("DATVDemodBaseband::setBasebandSampleRate: %d", sampleRate);
|
||||||
m_channelizer->setBasebandSampleRate(sampleRate);
|
m_channelizer->setBasebandSampleRate(sampleRate);
|
||||||
m_sink.applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
m_sink->applyChannelSettings(m_channelizer->getChannelSampleRate(), m_channelizer->getChannelFrequencyOffset());
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
#include "util/messagequeue.h"
|
#include "util/messagequeue.h"
|
||||||
|
|
||||||
|
#include "datvdemodsettings.h"
|
||||||
#include "datvdemodsink.h"
|
#include "datvdemodsink.h"
|
||||||
|
|
||||||
class DownChannelizer;
|
class DownChannelizer;
|
||||||
|
@ -64,39 +65,39 @@ public:
|
||||||
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
|
void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end);
|
||||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
|
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
|
||||||
int getChannelSampleRate() const;
|
int getChannelSampleRate() const;
|
||||||
double getMagSq() const { return m_sink.getMagSq(); }
|
double getMagSq() const { return m_sink->getMagSq(); }
|
||||||
void setTVScreen(TVScreen *tvScreen) { m_sink.setTVScreen(tvScreen); }
|
void setTVScreen(TVScreen *tvScreen) { m_sink->setTVScreen(tvScreen); }
|
||||||
float getMERAvg() const { return m_sink.getMERAvg(); }
|
float getMERAvg() const { return m_sink->getMERAvg(); }
|
||||||
float getMERRMS() const { return m_sink.getMERRMS(); }
|
float getMERRMS() const { return m_sink->getMERRMS(); }
|
||||||
float getMERPeak() const { return m_sink.getMERPeak(); }
|
float getMERPeak() const { return m_sink->getMERPeak(); }
|
||||||
int getMERNbAvg() const { return m_sink.getMERNbAvg(); }
|
int getMERNbAvg() const { return m_sink->getMERNbAvg(); }
|
||||||
float getCNRAvg() const { return m_sink.getCNRAvg(); }
|
float getCNRAvg() const { return m_sink->getCNRAvg(); }
|
||||||
float getCNRRMS() const { return m_sink.getCNRRMS(); }
|
float getCNRRMS() const { return m_sink->getCNRRMS(); }
|
||||||
float getCNRPeak() const { return m_sink.getCNRPeak(); }
|
float getCNRPeak() const { return m_sink->getCNRPeak(); }
|
||||||
int getCNRNbAvg() const { return m_sink.getCNRNbAvg(); }
|
int getCNRNbAvg() const { return m_sink->getCNRNbAvg(); }
|
||||||
void setMessageQueueToGUI(MessageQueue *messageQueue) { m_sink.setMessageQueueToGUI(messageQueue); }
|
void setMessageQueueToGUI(MessageQueue *messageQueue) { m_sink->setMessageQueueToGUI(messageQueue); }
|
||||||
void setBasebandSampleRate(int sampleRate); //!< To be used when supporting thread is stopped
|
void setBasebandSampleRate(int sampleRate); //!< To be used when supporting thread is stopped
|
||||||
void SetVideoRender(DATVideoRender *objScreen) { m_sink.SetVideoRender(objScreen); }
|
void SetVideoRender(DATVideoRender *objScreen) { m_sink->SetVideoRender(objScreen); }
|
||||||
DATVideostream *getVideoStream() { return m_sink.getVideoStream(); }
|
DATVideostream *getVideoStream() { return m_sink->getVideoStream(); }
|
||||||
DATVUDPStream *getUDPStream() { return m_sink.getUDPStream(); }
|
DATVUDPStream *getUDPStream() { return m_sink->getUDPStream(); }
|
||||||
bool audioActive() { return m_sink.audioActive(); }
|
bool audioActive() { return m_sink->audioActive(); }
|
||||||
bool audioDecodeOK() { return m_sink.audioDecodeOK(); }
|
bool audioDecodeOK() { return m_sink->audioDecodeOK(); }
|
||||||
bool videoActive() { return m_sink.videoActive(); }
|
bool videoActive() { return m_sink->videoActive(); }
|
||||||
bool videoDecodeOK() { return m_sink.videoDecodeOK(); }
|
bool videoDecodeOK() { return m_sink->videoDecodeOK(); }
|
||||||
bool udpRunning() { return m_sink.udpRunning(); }
|
bool udpRunning() { return m_sink->udpRunning(); }
|
||||||
bool playVideo() { return m_sink.playVideo(); }
|
bool playVideo() { return m_sink->playVideo(); }
|
||||||
|
|
||||||
int getModcodModulation() const { return m_sink.getModcodModulation(); }
|
int getModcodModulation() const { return m_sink->getModcodModulation(); }
|
||||||
int getModcodCodeRate() const { return m_sink.getModcodCodeRate(); }
|
int getModcodCodeRate() const { return m_sink->getModcodCodeRate(); }
|
||||||
bool isCstlnSetByModcod() const { return m_sink.isCstlnSetByModcod(); }
|
bool isCstlnSetByModcod() const { return m_sink->isCstlnSetByModcod(); }
|
||||||
bool isRunning() const { return m_running; }
|
bool isRunning() const { return m_running; }
|
||||||
void setFifoLabel(const QString& label) { m_sampleFifo.setLabel(label); }
|
void setFifoLabel(const QString& label) { m_sampleFifo.setLabel(label); }
|
||||||
void setAudioFifoLabel(const QString& label) { m_sink.setAudioFifoLabel(label); }
|
void setAudioFifoLabel(const QString& label) { m_sink->setAudioFifoLabel(label); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SampleSinkFifo m_sampleFifo;
|
SampleSinkFifo m_sampleFifo;
|
||||||
DownChannelizer *m_channelizer;
|
DownChannelizer *m_channelizer;
|
||||||
DATVDemodSink m_sink;
|
DATVDemodSink *m_sink;
|
||||||
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
|
||||||
DATVDemodSettings m_settings;
|
DATVDemodSettings m_settings;
|
||||||
bool m_running;
|
bool m_running;
|
||||||
|
|
Ładowanie…
Reference in New Issue