mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-10 10:33:29 -05:00
post sample rate changes directly on DSP input message queue. Removed sample source output queue entirely as it was not reliable under stress
This commit is contained in:
parent
7cc0d95054
commit
525a3f0024
@ -33,8 +33,8 @@ ENDIF()
|
||||
##############################################################################
|
||||
|
||||
#include(${QT_USE_FILE})
|
||||
set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" )
|
||||
#set( QT_DEFINITIONS "${QT_DEFINITIONS}" )
|
||||
#set( QT_DEFINITIONS "${QT_DEFINITIONS} -DQT_NO_DEBUG_OUTPUT" )
|
||||
set( QT_DEFINITIONS "${QT_DEFINITIONS}" )
|
||||
add_definitions(${QT_DEFINITIONS})
|
||||
|
||||
if(MSVC)
|
||||
|
@ -129,7 +129,6 @@ private:
|
||||
|
||||
private slots:
|
||||
void handleData(); //!< Handle data when samples from source FIFO are ready to be processed
|
||||
void handleSourceMessages(); //!< Handle source message output
|
||||
void handleInputMessages(); //!< Handle input message queue
|
||||
void handleSynchronousMessages(); //!< Handle synchronous messages with the thread
|
||||
};
|
||||
|
@ -41,7 +41,6 @@ public:
|
||||
virtual bool handleMessage(const Message& message) = 0;
|
||||
|
||||
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
|
||||
MessageQueue *getOutputMessageQueue() { return &m_outputMessageQueue; }
|
||||
MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; }
|
||||
SampleFifo* getSampleFifo() { return &m_sampleFifo; }
|
||||
|
||||
@ -51,8 +50,7 @@ protected slots:
|
||||
protected:
|
||||
SampleFifo m_sampleFifo;
|
||||
MessageQueue m_inputMessageQueue; //!< Input queue to the source
|
||||
MessageQueue m_outputMessageQueue; //!< Generic output queue
|
||||
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the source GUI
|
||||
MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the source GUI
|
||||
};
|
||||
|
||||
#endif // INCLUDE_SAMPLESOURCE_H
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "airspyinput.h"
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "airspyserializer.h"
|
||||
#include "airspythread.h"
|
||||
|
||||
@ -463,7 +464,7 @@ bool AirspyInput::applySettings(const Settings& settings, bool force)
|
||||
{
|
||||
int sampleRate = devSampleRate/(1<<m_settings.m_log2Decim);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||
getOutputMessageQueue()->push(notif);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "bladerfgui.h"
|
||||
#include "bladerfinput.h"
|
||||
#include "bladerfthread.h"
|
||||
@ -475,7 +476,7 @@ bool BladerfInput::applySettings(const Settings& settings, bool force)
|
||||
{
|
||||
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||
getOutputMessageQueue()->push(notif);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
}
|
||||
|
||||
qDebug() << "BladerfInput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "fcdproinput.h"
|
||||
|
||||
#include "fcdprogui.h"
|
||||
@ -417,7 +418,7 @@ void FCDProInput::applySettings(const Settings& settings, bool force)
|
||||
if (signalChange)
|
||||
{
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<Pro>::sampleRate, m_settings.centerFrequency);
|
||||
getOutputMessageQueue()->push(notif);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "fcdproplusinput.h"
|
||||
|
||||
#include "fcdproplusgui.h"
|
||||
@ -326,7 +327,7 @@ void FCDProPlusInput::applySettings(const Settings& settings, bool force)
|
||||
if (signalChange)
|
||||
{
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(fcd_traits<ProPlus>::sampleRate, m_settings.centerFrequency);
|
||||
getOutputMessageQueue()->push(notif);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "dsp/filesink.h"
|
||||
|
||||
#include "filesourcegui.h"
|
||||
@ -276,7 +277,7 @@ bool FileSourceInput::applySettings(const Settings& settings, bool force)
|
||||
}
|
||||
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(m_sampleRate, m_centerFrequency);
|
||||
getOutputMessageQueue()->push(notif);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
|
||||
qDebug() << "FileSourceInput::applySettings:"
|
||||
<< " file name: " << settings.m_fileName.toStdString().c_str()
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include "util/simpleserializer.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "hackrfinput.h"
|
||||
|
||||
#include "hackrfgui.h"
|
||||
@ -396,7 +397,7 @@ bool HackRFInput::applySettings(const Settings& settings, bool force)
|
||||
|
||||
if (m_dev != 0)
|
||||
{
|
||||
uint32_t bw_index = hackrf_compute_baseband_filter_bw_round_down_lt(HackRFBandwidths::m_bw_k[m_settings.m_bandwidthIndex]);
|
||||
uint32_t bw_index = hackrf_compute_baseband_filter_bw_round_down_lt(HackRFBandwidths::m_bw_k[m_settings.m_bandwidthIndex]*1000);
|
||||
rc = (hackrf_error) hackrf_set_baseband_filter_bandwidth(m_dev, bw_index);
|
||||
|
||||
if (rc != HACKRF_SUCCESS)
|
||||
@ -405,7 +406,7 @@ bool HackRFInput::applySettings(const Settings& settings, bool force)
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "HackRFInput:applySettings: Baseband BW gain set to " << HackRFBandwidths::m_bw_k[m_settings.m_bandwidthIndex];
|
||||
qDebug() << "HackRFInput:applySettings: Baseband BW filter set to " << HackRFBandwidths::m_bw_k[m_settings.m_bandwidthIndex] << " kHz";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -452,7 +453,8 @@ bool HackRFInput::applySettings(const Settings& settings, bool force)
|
||||
{
|
||||
int sampleRate = devSampleRate/(1<<m_settings.m_log2Decim);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||
getOutputMessageQueue()->push(notif);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
//getOutputMessageQueue()->push(notif);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -24,7 +24,7 @@
|
||||
#include "dsp/samplefifo.h"
|
||||
#include "dsp/decimators.h"
|
||||
|
||||
#define HACKRF_BLOCKSIZE (1<<16)
|
||||
#define HACKRF_BLOCKSIZE (1<<17)
|
||||
|
||||
class HackRFThread : public QThread {
|
||||
Q_OBJECT
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "rtlsdrthread.h"
|
||||
#include "rtlsdrgui.h"
|
||||
#include "dsp/dspcommands.h"
|
||||
#include "dsp/dspengine.h"
|
||||
#include "rtlsdrserializer.h"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(RTLSDRInput::MsgConfigureRTLSDR, Message)
|
||||
@ -351,7 +352,7 @@ bool RTLSDRInput::applySettings(const Settings& settings, bool force)
|
||||
{
|
||||
int sampleRate = m_settings.m_devSampleRate/(1<<m_settings.m_log2Decim);
|
||||
DSPSignalNotification *notif = new DSPSignalNotification(sampleRate, m_settings.m_centerFrequency);
|
||||
getOutputMessageQueue()->push(notif);
|
||||
DSPEngine::instance()->getInputMessageQueue()->push(notif);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -502,7 +502,6 @@ void DSPEngine::handleSetSource(SampleSource* source)
|
||||
if(m_sampleSource != 0)
|
||||
{
|
||||
disconnect(m_sampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()));
|
||||
disconnect(m_sampleSource->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
}
|
||||
|
||||
m_sampleSource = source;
|
||||
@ -511,7 +510,6 @@ void DSPEngine::handleSetSource(SampleSource* source)
|
||||
{
|
||||
qDebug() << " - set " << source->getDeviceDescription().toStdString().c_str();
|
||||
connect(m_sampleSource->getSampleFifo(), SIGNAL(dataReady()), this, SLOT(handleData()), Qt::QueuedConnection);
|
||||
connect(m_sampleSource->getOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -638,21 +636,8 @@ void DSPEngine::handleInputMessages()
|
||||
|
||||
delete message;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DSPEngine::handleSourceMessages()
|
||||
{
|
||||
Message *message;
|
||||
|
||||
while ((message = m_sampleSource->getOutputMessageQueue()->pop()) != 0)
|
||||
{
|
||||
qDebug() << "DSPEngine::handleSourceMessages: " << message->getIdentifier();
|
||||
|
||||
if (DSPSignalNotification::match(*message))
|
||||
else if (DSPSignalNotification::match(*message))
|
||||
{
|
||||
qDebug() << "DSPEngine::handleSourceMessages: process DSPSignalNotification";
|
||||
|
||||
DSPSignalNotification *notif = (DSPSignalNotification *) message;
|
||||
|
||||
// update DSP values
|
||||
@ -660,13 +645,13 @@ void DSPEngine::handleSourceMessages()
|
||||
m_sampleRate = notif->getSampleRate();
|
||||
m_centerFrequency = notif->getCenterFrequency();
|
||||
|
||||
qDebug() << "DSPEngine::handleSourceMessages: DSPSignalNotification(" << m_sampleRate << "," << m_centerFrequency << ")";
|
||||
qDebug() << "DSPEngine::handleInputMessages: DSPSignalNotification(" << m_sampleRate << "," << m_centerFrequency << ")";
|
||||
|
||||
// forward source changes to sinks with immediate execution
|
||||
|
||||
for(SampleSinks::const_iterator it = m_sampleSinks.begin(); it != m_sampleSinks.end(); it++)
|
||||
{
|
||||
qDebug() << "DSPEngine::handleSourceMessages: forward message to " << (*it)->objectName().toStdString().c_str();
|
||||
qDebug() << "DSPEngine::handleInputMessages: forward message to " << (*it)->objectName().toStdString().c_str();
|
||||
(*it)->handleMessage(*message);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user