mirror of
				https://github.com/f4exb/sdrangel.git
				synced 2025-11-03 13:11:20 -05:00 
			
		
		
		
	Deep redesign: fixed RTLSDR input plugin
This commit is contained in:
		
							parent
							
								
									a68104ab65
								
							
						
					
					
						commit
						5a0668f9ec
					
				@ -42,6 +42,7 @@ public:
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
 | 
						MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; }
 | 
				
			||||||
	MessageQueue *getOutputMessageQueue() { return &m_outputMessageQueue; }
 | 
						MessageQueue *getOutputMessageQueue() { return &m_outputMessageQueue; }
 | 
				
			||||||
 | 
						MessageQueue *getOutputMessageQueueToGUI() { return &m_outputMessageQueueToGUI; }
 | 
				
			||||||
    SampleFifo* getSampleFifo() { return &m_sampleFifo; }
 | 
					    SampleFifo* getSampleFifo() { return &m_sampleFifo; }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected slots:
 | 
					protected slots:
 | 
				
			||||||
@ -49,8 +50,9 @@ protected slots:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
    SampleFifo m_sampleFifo;
 | 
					    SampleFifo m_sampleFifo;
 | 
				
			||||||
	MessageQueue m_inputMessageQueue;
 | 
						MessageQueue m_inputMessageQueue; //!< Input queue to the source
 | 
				
			||||||
	MessageQueue m_outputMessageQueue;
 | 
						MessageQueue m_outputMessageQueue; //!< Generic output queue
 | 
				
			||||||
 | 
						MessageQueue m_outputMessageQueueToGUI; //!< Output queue specialized for the source GUI
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#endif // INCLUDE_SAMPLESOURCE_H
 | 
					#endif // INCLUDE_SAMPLESOURCE_H
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@
 | 
				
			|||||||
#include <QObject>
 | 
					#include <QObject>
 | 
				
			||||||
#include "plugin/plugininterface.h"
 | 
					#include "plugin/plugininterface.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class BlderfPlugin : public QObject, PluginInterface {
 | 
					class BlderfPlugin : public QObject, public PluginInterface {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
	Q_INTERFACES(PluginInterface)
 | 
						Q_INTERFACES(PluginInterface)
 | 
				
			||||||
	Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.bladerf")
 | 
						Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.bladerf")
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@
 | 
				
			|||||||
#include <QObject>
 | 
					#include <QObject>
 | 
				
			||||||
#include "plugin/plugininterface.h"
 | 
					#include "plugin/plugininterface.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FCDPlugin : public QObject, PluginInterface {
 | 
					class FCDPlugin : public QObject, public PluginInterface {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
	Q_INTERFACES(PluginInterface)
 | 
						Q_INTERFACES(PluginInterface)
 | 
				
			||||||
	Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.fcd")
 | 
						Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.fcd")
 | 
				
			||||||
 | 
				
			|||||||
@ -109,6 +109,11 @@ void FileSourceInput::openFileStream()
 | 
				
			|||||||
	getOutputMessageQueue()->push(report);
 | 
						getOutputMessageQueue()->push(report);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool FileSourceInput::init(const Message& message)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool FileSourceInput::start(int device)
 | 
					bool FileSourceInput::start(int device)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	QMutexLocker mutexLocker(&m_mutex);
 | 
						QMutexLocker mutexLocker(&m_mutex);
 | 
				
			||||||
 | 
				
			|||||||
@ -20,7 +20,7 @@
 | 
				
			|||||||
#include <QObject>
 | 
					#include <QObject>
 | 
				
			||||||
#include "plugin/plugininterface.h"
 | 
					#include "plugin/plugininterface.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FileSourcePlugin : public QObject, PluginInterface {
 | 
					class FileSourcePlugin : public QObject, public PluginInterface {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
	Q_INTERFACES(PluginInterface)
 | 
						Q_INTERFACES(PluginInterface)
 | 
				
			||||||
	Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.filesource")
 | 
						Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.filesource")
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,4 @@
 | 
				
			|||||||
 | 
					#include <QDebug>
 | 
				
			||||||
#include "rtlsdrgui.h"
 | 
					#include "rtlsdrgui.h"
 | 
				
			||||||
#include "ui_rtlsdrgui.h"
 | 
					#include "ui_rtlsdrgui.h"
 | 
				
			||||||
#include "plugin/pluginapi.h"
 | 
					#include "plugin/pluginapi.h"
 | 
				
			||||||
@ -18,6 +19,7 @@ RTLSDRGui::RTLSDRGui(PluginAPI* pluginAPI, QWidget* parent) :
 | 
				
			|||||||
	displaySettings();
 | 
						displaySettings();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_sampleSource = new RTLSDRInput();
 | 
						m_sampleSource = new RTLSDRInput();
 | 
				
			||||||
 | 
						connect(m_sampleSource->getOutputMessageQueueToGUI(), SIGNAL(messageEnqueued()), this, SLOT(HandleSourceMessages()));
 | 
				
			||||||
	DSPEngine::instance()->setSource(m_sampleSource);
 | 
						DSPEngine::instance()->setSource(m_sampleSource);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -77,6 +79,7 @@ bool RTLSDRGui::handleMessage(const Message& message)
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
	if (RTLSDRInput::MsgReportRTLSDR::match(message))
 | 
						if (RTLSDRInput::MsgReportRTLSDR::match(message))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							qDebug() << "RTLSDRGui::handleMessage: MsgReportRTLSDR";
 | 
				
			||||||
		m_gains = ((RTLSDRInput::MsgReportRTLSDR&) message).getGains();
 | 
							m_gains = ((RTLSDRInput::MsgReportRTLSDR&) message).getGains();
 | 
				
			||||||
		displaySettings();
 | 
							displaySettings();
 | 
				
			||||||
		return true;
 | 
							return true;
 | 
				
			||||||
@ -87,6 +90,21 @@ bool RTLSDRGui::handleMessage(const Message& message)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void RTLSDRGui::HandleSourceMessages()
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						Message* message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						while ((message = m_sampleSource->getOutputMessageQueueToGUI()->pop()) != 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							qDebug("RTLSDRGui::HandleSourceMessages: message: %s", message->getIdentifier());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							if (handleMessage(*message))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								delete message;
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void RTLSDRGui::displaySettings()
 | 
					void RTLSDRGui::displaySettings()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
 | 
						ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000);
 | 
				
			||||||
@ -219,8 +237,8 @@ void RTLSDRGui::on_checkBox_stateChanged(int state)
 | 
				
			|||||||
	sendSettings();
 | 
						sendSettings();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned int RTLSDRSampleRates::m_rates[] = {288, 1024, 1536, 1152, 2048, 2500 };
 | 
					unsigned int RTLSDRSampleRates::m_rates[] = {288, 1152, 1536, 2304};
 | 
				
			||||||
unsigned int RTLSDRSampleRates::m_nb_rates = 6;
 | 
					unsigned int RTLSDRSampleRates::m_nb_rates = 4;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
unsigned int RTLSDRSampleRates::getRate(unsigned int rate_index)
 | 
					unsigned int RTLSDRSampleRates::getRate(unsigned int rate_index)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -49,6 +49,7 @@ private slots:
 | 
				
			|||||||
	void on_samplerate_valueChanged(int value);
 | 
						void on_samplerate_valueChanged(int value);
 | 
				
			||||||
	void on_checkBox_stateChanged(int state);
 | 
						void on_checkBox_stateChanged(int state);
 | 
				
			||||||
	void updateHardware();
 | 
						void updateHardware();
 | 
				
			||||||
 | 
						void HandleSourceMessages();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RTLSDRSampleRates {
 | 
					class RTLSDRSampleRates {
 | 
				
			||||||
 | 
				
			|||||||
@ -15,6 +15,7 @@
 | 
				
			|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
					// along with this program. If not, see <http://www.gnu.org/licenses/>.          //
 | 
				
			||||||
///////////////////////////////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <QDebug>
 | 
				
			||||||
#include <string.h>
 | 
					#include <string.h>
 | 
				
			||||||
#include <errno.h>
 | 
					#include <errno.h>
 | 
				
			||||||
#include "rtlsdrinput.h"
 | 
					#include "rtlsdrinput.h"
 | 
				
			||||||
@ -94,6 +95,11 @@ RTLSDRInput::~RTLSDRInput()
 | 
				
			|||||||
	stop();
 | 
						stop();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool RTLSDRInput::init(const Message& message)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool RTLSDRInput::start(int device)
 | 
					bool RTLSDRInput::start(int device)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	QMutexLocker mutexLocker(&m_mutex);
 | 
						QMutexLocker mutexLocker(&m_mutex);
 | 
				
			||||||
@ -111,13 +117,13 @@ bool RTLSDRInput::start(int device)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (!m_sampleFifo.setSize(96000 * 4))
 | 
						if (!m_sampleFifo.setSize(96000 * 4))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("Could not allocate SampleFifo");
 | 
							qCritical("RTLSDRInput::start: Could not allocate SampleFifo");
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = rtlsdr_open(&m_dev, device)) < 0)
 | 
						if ((res = rtlsdr_open(&m_dev, device)) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("could not open RTLSDR #%d: %s", device, strerror(errno));
 | 
							qCritical("RTLSDRInput::start: could not open RTLSDR #%d: %s", device, strerror(errno));
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -127,31 +133,31 @@ bool RTLSDRInput::start(int device)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if ((res = rtlsdr_get_usb_strings(m_dev, vendor, product, serial)) < 0)
 | 
						if ((res = rtlsdr_get_usb_strings(m_dev, vendor, product, serial)) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("error accessing USB device");
 | 
							qCritical("RTLSDRInput::start: error accessing USB device");
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	qWarning("RTLSDRInput open: %s %s, SN: %s", vendor, product, serial);
 | 
						qWarning("RTLSDRInput::start: open: %s %s, SN: %s", vendor, product, serial);
 | 
				
			||||||
	m_deviceDescription = QString("%1 (SN %2)").arg(product).arg(serial);
 | 
						m_deviceDescription = QString("%1 (SN %2)").arg(product).arg(serial);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = rtlsdr_set_sample_rate(m_dev, 1024000)) < 0)
 | 
						if ((res = rtlsdr_set_sample_rate(m_dev, 1152000)) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("could not set sample rate: 1024k S/s");
 | 
							qCritical("RTLSDRInput::start: could not set sample rate: 1024k S/s");
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = rtlsdr_set_tuner_gain_mode(m_dev, 1)) < 0)
 | 
						if ((res = rtlsdr_set_tuner_gain_mode(m_dev, 1)) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("error setting tuner gain mode");
 | 
							qCritical("RTLSDRInput::start: error setting tuner gain mode");
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = rtlsdr_set_agc_mode(m_dev, 0)) < 0)
 | 
						if ((res = rtlsdr_set_agc_mode(m_dev, 0)) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("error setting agc mode");
 | 
							qCritical("RTLSDRInput::start: error setting agc mode");
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -160,7 +166,7 @@ bool RTLSDRInput::start(int device)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (numberOfGains < 0)
 | 
						if (numberOfGains < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("error getting number of gain values supported");
 | 
							qCritical("RTLSDRInput::start: error getting number of gain values supported");
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -169,21 +175,27 @@ bool RTLSDRInput::start(int device)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (rtlsdr_get_tuner_gains(m_dev, &m_gains[0]) < 0)
 | 
						if (rtlsdr_get_tuner_gains(m_dev, &m_gains[0]) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("error getting gain values");
 | 
							qCritical("RTLSDRInput::start: error getting gain values");
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
 | 
							qDebug() << "RTLSDRInput::start: " << m_gains.size() << "gains";
 | 
				
			||||||
 | 
							MsgReportRTLSDR *message = MsgReportRTLSDR::create(m_gains);
 | 
				
			||||||
 | 
							getOutputMessageQueueToGUI()->push(message);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = rtlsdr_reset_buffer(m_dev)) < 0)
 | 
						if ((res = rtlsdr_reset_buffer(m_dev)) < 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qCritical("could not reset USB EP buffers: %s", strerror(errno));
 | 
							qCritical("RTLSDRInput::start: could not reset USB EP buffers: %s", strerror(errno));
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((m_rtlSDRThread = new RTLSDRThread(m_dev, &m_sampleFifo)) == NULL)
 | 
						if ((m_rtlSDRThread = new RTLSDRThread(m_dev, &m_sampleFifo)) == NULL)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qFatal("out of memory");
 | 
							qFatal("RTLSDRInput::start: out of memory");
 | 
				
			||||||
		stop();
 | 
							stop();
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@ -194,11 +206,6 @@ bool RTLSDRInput::start(int device)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	applySettings(m_settings, true);
 | 
						applySettings(m_settings, true);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	qDebug("RTLSDRInput::start");
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	MsgReportRTLSDR *message = MsgReportRTLSDR::create(m_gains);
 | 
					 | 
				
			||||||
	getOutputMessageQueue()->push(message);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return true;
 | 
						return true;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@
 | 
				
			|||||||
#include <QObject>
 | 
					#include <QObject>
 | 
				
			||||||
#include "plugin/plugininterface.h"
 | 
					#include "plugin/plugininterface.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RTLSDRPlugin : public QObject, PluginInterface {
 | 
					class RTLSDRPlugin : public QObject, public PluginInterface {
 | 
				
			||||||
	Q_OBJECT
 | 
						Q_OBJECT
 | 
				
			||||||
	Q_INTERFACES(PluginInterface)
 | 
						Q_INTERFACES(PluginInterface)
 | 
				
			||||||
	Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.rtl-sdr")
 | 
						Q_PLUGIN_METADATA(IID "org.osmocom.sdr.samplesource.rtl-sdr")
 | 
				
			||||||
 | 
				
			|||||||
@ -614,7 +614,7 @@ void DSPEngine::handleInputMessages()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	while ((message = m_inputMessageQueue.pop()) != 0)
 | 
						while ((message = m_inputMessageQueue.pop()) != 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		qDebug("  - message: %s", message->getIdentifier());
 | 
							qDebug("DSPEngine::handleInputMessages: message: %s", message->getIdentifier());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (DSPConfigureCorrection::match(*message))
 | 
							if (DSPConfigureCorrection::match(*message))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
@ -635,22 +635,24 @@ void DSPEngine::handleInputMessages()
 | 
				
			|||||||
				m_qRange = 1 << 16;
 | 
									m_qRange = 1 << 16;
 | 
				
			||||||
				m_imbalance = 65536;
 | 
									m_imbalance = 65536;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			delete message;
 | 
								delete message;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DSPEngine::handleSourceMessages()
 | 
					void DSPEngine::handleSourceMessages()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	Message *message;
 | 
						Message *message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	qDebug() << "DSPEngine::handleSourceMessages";
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	while ((message = m_sampleSource->getOutputMessageQueue()->pop()) != 0)
 | 
						while ((message = m_sampleSource->getOutputMessageQueue()->pop()) != 0)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							qDebug() << "DSPEngine::handleSourceMessages: " << message->getIdentifier();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (DSPSignalNotification::match(*message))
 | 
							if (DSPSignalNotification::match(*message))
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
 | 
								qDebug() << "DSPEngine::handleSourceMessages: process DSPSignalNotification";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			DSPSignalNotification *notif = (DSPSignalNotification *) message;
 | 
								DSPSignalNotification *notif = (DSPSignalNotification *) message;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			// update DSP values
 | 
								// update DSP values
 | 
				
			||||||
@ -678,11 +680,11 @@ void DSPEngine::handleSourceMessages()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
 | 
								DSPSignalNotification* rep = new DSPSignalNotification(*notif); // make a copy for the output queue
 | 
				
			||||||
			m_outputMessageQueue.push(rep);
 | 
								m_outputMessageQueue.push(rep);
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			delete message;
 | 
								delete message;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void DSPEngine::setAudioSampleRate(uint rate)
 | 
					void DSPEngine::setAudioSampleRate(uint rate)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -93,6 +93,8 @@ MainWindow::MainWindow(QWidget* parent) :
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	m_masterTimer.start(50);
 | 
						m_masterTimer.start(50);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						qDebug() << "MainWindow::MainWindow: m_pluginManager->loadPlugins ...";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	m_pluginManager->loadPlugins();
 | 
						m_pluginManager->loadPlugins();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	bool sampleSourceSignalsBlocked = ui->sampleSource->blockSignals(true);
 | 
						bool sampleSourceSignalsBlocked = ui->sampleSource->blockSignals(true);
 | 
				
			||||||
@ -347,11 +349,11 @@ void MainWindow::handleDSPMessages()
 | 
				
			|||||||
			updateSampleRate();
 | 
								updateSampleRate();
 | 
				
			||||||
			qDebug() << "MainWindow::handleDSPMessages: forward to file sink";
 | 
								qDebug() << "MainWindow::handleDSPMessages: forward to file sink";
 | 
				
			||||||
			m_fileSink->handleMessage(*notif);
 | 
								m_fileSink->handleMessage(*notif);
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			delete message;
 | 
								delete message;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void MainWindow::handleMessages()
 | 
					void MainWindow::handleMessages()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
				
			|||||||
@ -28,13 +28,16 @@ PluginManager::~PluginManager()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void PluginManager::loadPlugins()
 | 
					void PluginManager::loadPlugins()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
						qDebug() << "PluginManager::loadPlugins: " << qPrintable(QApplication::instance()->applicationDirPath());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	QDir pluginsDir = QDir(QApplication::instance()->applicationDirPath());
 | 
						QDir pluginsDir = QDir(QApplication::instance()->applicationDirPath());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	loadPlugins(pluginsDir);
 | 
						loadPlugins(pluginsDir);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	qSort(m_plugins);
 | 
						qSort(m_plugins);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for(Plugins::const_iterator it = m_plugins.begin(); it != m_plugins.end(); ++it) {
 | 
						for (Plugins::const_iterator it = m_plugins.begin(); it != m_plugins.end(); ++it)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		it->plugin->initPlugin(&m_pluginAPI);
 | 
							it->plugin->initPlugin(&m_pluginAPI);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -321,22 +324,38 @@ void PluginManager::loadPlugins(const QDir& dir)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	foreach (QString fileName, pluginsDir.entryList(QDir::Files))
 | 
						foreach (QString fileName, pluginsDir.entryList(QDir::Files))
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
 | 
							if (fileName.endsWith(".so"))
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								qDebug() << "PluginManager::loadPlugins: fileName: " << qPrintable(fileName);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			QPluginLoader* loader = new QPluginLoader(pluginsDir.absoluteFilePath(fileName));
 | 
								QPluginLoader* loader = new QPluginLoader(pluginsDir.absoluteFilePath(fileName));
 | 
				
			||||||
			PluginInterface* plugin = qobject_cast<PluginInterface*>(loader->instance());
 | 
								PluginInterface* plugin = qobject_cast<PluginInterface*>(loader->instance());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (loader->isLoaded()) {
 | 
								if (loader->isLoaded())
 | 
				
			||||||
			qWarning("loaded plugin %s", qPrintable(fileName));
 | 
								{
 | 
				
			||||||
 | 
									qWarning("PluginManager::loadPlugins: loaded plugin %s", qPrintable(fileName));
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
 | 
									qWarning() << "PluginManager::loadPlugins: " << qPrintable(loader->errorString());
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (plugin != NULL) {
 | 
								if (plugin != 0)
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
				m_plugins.append(Plugin(fileName, loader, plugin));
 | 
									m_plugins.append(Plugin(fileName, loader, plugin));
 | 
				
			||||||
		} else {
 | 
								}
 | 
				
			||||||
 | 
								else
 | 
				
			||||||
 | 
								{
 | 
				
			||||||
				loader->unload();
 | 
									loader->unload();
 | 
				
			||||||
				delete loader;
 | 
									delete loader;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	foreach (QString dirName, pluginsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
 | 
						// recursive calls on subdirectories
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						foreach (QString dirName, pluginsDir.entryList(QDir::Dirs | QDir::NoDotAndDotDot))
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		loadPlugins(pluginsDir.absoluteFilePath(dirName));
 | 
							loadPlugins(pluginsDir.absoluteFilePath(dirName));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user