diff --git a/plugins/samplesource/fcd/fcdinput.cpp b/plugins/samplesource/fcd/fcdinput.cpp index 04616aa18..1a9a007cf 100644 --- a/plugins/samplesource/fcd/fcdinput.cpp +++ b/plugins/samplesource/fcd/fcdinput.cpp @@ -143,8 +143,6 @@ bool FCDInput::start(int device) return false; } - m_deviceDescription = QString("Funcube Dongle"); - qDebug("FCDInput::start"); return true; } @@ -198,7 +196,7 @@ void FCDInput::applySettings(const Settings& settings, bool force) { bool signalChange = false; - if ((m_settings.centerFrequency != settings.centerFrequency)) + if ((m_settings.centerFrequency != settings.centerFrequency) || force) { qDebug() << "FCDInput::applySettings: fc: " << settings.centerFrequency; m_settings.centerFrequency = settings.centerFrequency; diff --git a/plugins/samplesource/fcdpro/fcdinput.cpp b/plugins/samplesource/fcdpro/fcdinput.cpp index b170959f5..11e857ad1 100644 --- a/plugins/samplesource/fcdpro/fcdinput.cpp +++ b/plugins/samplesource/fcdpro/fcdinput.cpp @@ -145,11 +145,14 @@ bool FCDInput::start(int device) return false; } + m_deviceDescription = QString("Funcube Dongle"); + /* Apply settings before streaming to avoid bus contention; * there is very little spare bandwidth on a full speed USB device. - * Failure is harmless if no device is found */ + * Failure is harmless if no device is found + * ... This is rubbish...*/ - applySettings(m_settings, true); + //applySettings(m_settings, true); if(!m_sampleFifo.setSize(96000*4)) { @@ -163,7 +166,10 @@ bool FCDInput::start(int device) return false; } - m_deviceDescription = QString("Funcube Dongle"); + m_FCDThread->startWork(); + + mutexLocker.unlock(); + applySettings(m_settings, true); qDebug("FCDInput::started"); return true; @@ -221,7 +227,7 @@ void FCDInput::applySettings(const Settings& settings, bool force) { bool signalChange = false; - if ((m_settings.centerFrequency != settings.centerFrequency)) + if ((m_settings.centerFrequency != settings.centerFrequency) || force) { qDebug() << "FCDInput::applySettings: fc: " << settings.centerFrequency; m_settings.centerFrequency = settings.centerFrequency; diff --git a/plugins/samplesource/fcdpro/fcdthread.cpp b/plugins/samplesource/fcdpro/fcdthread.cpp index 34e1c98de..8b25228da 100644 --- a/plugins/samplesource/fcdpro/fcdthread.cpp +++ b/plugins/samplesource/fcdpro/fcdthread.cpp @@ -36,6 +36,20 @@ FCDThread::~FCDThread() { } +void FCDThread::startWork() +{ + m_startWaitMutex.lock(); + + start(); + + while(!m_running) + { + m_startWaiter.wait(&m_startWaitMutex, 100); + } + + m_startWaitMutex.unlock(); +} + void FCDThread::stopWork() { m_running = false; diff --git a/plugins/samplesource/fcdpro/fcdthread.h b/plugins/samplesource/fcdpro/fcdthread.h index dc7e4530d..e11af0843 100644 --- a/plugins/samplesource/fcdpro/fcdthread.h +++ b/plugins/samplesource/fcdpro/fcdthread.h @@ -35,10 +35,11 @@ public: FCDThread(SampleFifo* sampleFifo, QObject* parent = NULL); ~FCDThread(); + void startWork(); void stopWork(); bool OpenSource(const char *filename); void CloseSource(); - int work(int n_items); + private: snd_pcm_format_t fcd_format; snd_pcm_t* fcd_handle; @@ -51,6 +52,6 @@ private: SampleFifo* m_sampleFifo; void run(); - + int work(int n_items); }; #endif // INCLUDE_FCDTHREAD_H