mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2026-06-03 06:24:49 -04:00
SDR->Demod->Audio chain all using std::thread
2% CPU usage drop on 3.2G i7 desktop
This commit is contained in:
@@ -170,11 +170,15 @@ void SDRThread::threadMain() {
|
||||
}
|
||||
|
||||
if (demodulators.size()) {
|
||||
DemodulatorThreadIQData demodDataOut;
|
||||
demodDataOut.frequency = frequency;
|
||||
demodDataOut.bandwidth = bandwidth;
|
||||
demodDataOut.data = new_buffer;
|
||||
|
||||
for (int i = 0, iMax = demodulators.size(); i < iMax; i++) {
|
||||
DemodulatorThreadQueue *demodQueue = demodulators[i];
|
||||
DemodulatorThreadTask demod_task = DemodulatorThreadTask(DemodulatorThreadTask::DEMOD_THREAD_DATA);
|
||||
demod_task.data = new DemodulatorThreadIQData(bandwidth, frequency, new_buffer);
|
||||
demodQueue->addTask(demod_task, DemodulatorThreadQueue::DEMOD_PRIORITY_HIGHEST);
|
||||
DemodulatorInstance *demod = demodulators[i];
|
||||
DemodulatorThreadInputQueue *demodQueue = demod->threadQueueDemod;
|
||||
demodQueue->push(demodDataOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+4
-5
@@ -9,9 +9,8 @@
|
||||
|
||||
#include "wx/thread.h"
|
||||
|
||||
#include "DemodulatorThreadQueue.h"
|
||||
#include "DemodulatorMgr.h"
|
||||
#include "ThreadQueue.h"
|
||||
#include "DemodulatorMgr.h"
|
||||
|
||||
class SDRThreadCommand {
|
||||
public:
|
||||
@@ -65,8 +64,8 @@ public:
|
||||
|
||||
int enumerate_rtl();
|
||||
|
||||
void bindDemodulator(DemodulatorInstance &demod) {
|
||||
demodulators.push_back(demod.threadQueueDemod);
|
||||
void bindDemodulator(DemodulatorInstance *demod) {
|
||||
demodulators.push_back(demod);
|
||||
}
|
||||
|
||||
void threadMain();
|
||||
@@ -85,5 +84,5 @@ protected:
|
||||
SDRThreadIQDataQueue* iqDataOutQueue;
|
||||
SDRThreadIQDataQueue* iqVisualQueue;
|
||||
|
||||
std::vector<DemodulatorThreadQueue *> demodulators;
|
||||
std::vector<DemodulatorInstance *> demodulators;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user