CubicSDR/src/demod/DemodulatorPreThread.h

74 lines
1.6 KiB
C
Raw Normal View History

2014-11-16 16:51:45 -05:00
#pragma once
#include <queue>
#include <vector>
#include "CubicSDRDefs.h"
2014-12-11 19:07:21 -05:00
#include "DemodDefs.h"
#include "DemodulatorWorkerThread.h"
class DemodulatorPreThread {
2014-11-16 16:51:45 -05:00
public:
DemodulatorPreThread(DemodulatorThreadInputQueue* pQueueIn, DemodulatorThreadPostInputQueue* pQueueOut, DemodulatorThreadCommandQueue* threadQueueNotify);
~DemodulatorPreThread();
#ifdef __APPLE__
void *threadMain();
#else
void threadMain();
#endif
2014-11-16 16:51:45 -05:00
void setCommandQueue(DemodulatorThreadCommandQueue *tQueue) {
commandQueue = tQueue;
}
void setAudioInputQueue(AudioThreadInputQueue *tQueue) {
audioInputQueue = tQueue;
}
DemodulatorThreadParameters &getParams() {
return params;
}
void initialize();
void terminate();
#ifdef __APPLE__
static void *pthread_helper(void *context) {
return ((DemodulatorPreThread *) context)->threadMain();
}
#endif
2014-11-16 16:51:45 -05:00
protected:
DemodulatorThreadInputQueue* inputQueue;
DemodulatorThreadPostInputQueue* postInputQueue;
DemodulatorThreadCommandQueue* commandQueue;
AudioThreadInputQueue *audioInputQueue;
2014-11-16 16:51:45 -05:00
firfilt_crcf fir_filter;
msresamp_crcf resampler;
float resample_ratio;
2014-11-16 16:51:45 -05:00
msresamp_crcf audio_resampler;
float audio_resample_ratio;
2014-11-16 16:51:45 -05:00
DemodulatorThreadParameters params;
DemodulatorThreadParameters last_params;
freqdem fdem;
nco_crcf nco_shift;
int shift_freq;
std::atomic<bool> terminated;
std::atomic<bool> initialized;
2014-11-30 23:33:55 -05:00
DemodulatorWorkerThread *workerThread;
std::thread *t_Worker;
2014-11-30 23:33:55 -05:00
DemodulatorThreadWorkerCommandQueue *workerQueue;
DemodulatorThreadWorkerResultQueue *workerResults;
2014-12-11 19:07:21 -05:00
DemodulatorThreadCommandQueue* threadQueueNotify;
2014-11-16 16:51:45 -05:00
};