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

Make the DSP source engine forward messages to own source input GUI message queue. Example of handling with SDRplay

This commit is contained in:
f4exb 2017-09-17 00:06:09 +02:00
parent c83b6e61d5
commit dc45452a76
3 changed files with 23 additions and 25 deletions

View File

@ -69,8 +69,9 @@ SDRPlayGui::SDRPlayGui(DeviceSourceAPI *deviceAPI, QWidget* parent) :
displaySettings();
connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
// connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages()));
// connect(m_deviceAPI->getDeviceEngineOutputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleDSPMessages()), Qt::QueuedConnection);
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
}
SDRPlayGui::~SDRPlayGui()
@ -167,38 +168,30 @@ bool SDRPlayGui::handleMessage(const Message& message)
}
}
void SDRPlayGui::handleDSPMessages()
void SDRPlayGui::handleInputMessages()
{
Message* message;
while ((message = m_deviceAPI->getDeviceEngineOutputMessageQueue()->pop()) != 0)
while ((message = m_inputMessageQueue.pop()) != 0)
{
qDebug("SDRPlayGui::handleDSPMessages: message: %s", message->getIdentifier());
qDebug("SDRPlayGui::handleInputMessages: message: %s", message->getIdentifier());
if (DSPSignalNotification::match(*message))
{
DSPSignalNotification* notif = (DSPSignalNotification*) message;
m_sampleRate = notif->getSampleRate();
m_deviceCenterFrequency = notif->getCenterFrequency();
qDebug("SDRPlayGui::handleDSPMessages: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
qDebug("SDRPlayGui::handleInputMessages: DSPSignalNotification: SampleRate:%d, CenterFrequency:%llu", notif->getSampleRate(), notif->getCenterFrequency());
updateSampleRateAndFrequency();
delete message;
}
}
}
void SDRPlayGui::handleSourceMessages()
{
Message* message;
while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
{
qDebug("SDRPlayGui::HandleSourceMessages: message: %s", message->getIdentifier());
if (handleMessage(*message))
else
{
delete message;
if (handleMessage(*message))
{
delete message;
}
}
}
}

View File

@ -73,8 +73,7 @@ private:
private slots:
void updateHardware();
void updateStatus();
void handleSourceMessages();
void handleDSPMessages();
void handleInputMessages();
void on_centerFrequency_changed(quint64 value);
void on_ppm_valueChanged(int value);
void on_dcOffset_toggled(bool checked);

View File

@ -629,7 +629,7 @@ void DSPDeviceSourceEngine::handleInputMessages()
qDebug() << "DSPDeviceSourceEngine::handleInputMessages: DSPSignalNotification(" << m_sampleRate << "," << m_centerFrequency << ")";
// forward source changes to sinks with immediate execution
// forward source changes to channel sinks with immediate execution (no queuing)
for(BasebandSampleSinks::const_iterator it = m_basebandSampleSinks.begin(); it != m_basebandSampleSinks.end(); it++)
{
@ -643,10 +643,16 @@ void DSPDeviceSourceEngine::handleInputMessages()
(*it)->handleSinkMessage(*message);
}
// forward changes to listeners on DSP output queue
// forward changes to source GUI input queue
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
m_outputMessageQueue.push(rep);
MessageQueue *guiMessageQueue = m_deviceSampleSource->getMessageQueueToGUI();
if (guiMessageQueue) {
DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the source GUI
m_deviceSampleSource->getMessageQueueToGUI()->push(rep);
}
//m_outputMessageQueue.push(rep);
delete message;
}