2014-11-16 16:51:45 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <queue>
|
|
|
|
#include <vector>
|
|
|
|
|
2014-11-22 22:17:33 -05:00
|
|
|
#include "CubicSDRDefs.h"
|
2014-12-11 19:07:21 -05:00
|
|
|
#include "DemodDefs.h"
|
2014-12-16 18:27:02 -05:00
|
|
|
#include "DemodulatorWorkerThread.h"
|
2014-11-22 22:17:33 -05:00
|
|
|
|
2015-07-29 20:57:02 -04:00
|
|
|
class DemodulatorPreThread : public IOThread {
|
2014-11-16 16:51:45 -05:00
|
|
|
public:
|
2014-11-17 22:58:56 -05:00
|
|
|
|
2015-07-29 22:52:54 -04:00
|
|
|
DemodulatorPreThread();
|
2014-12-16 21:30:03 -05:00
|
|
|
~DemodulatorPreThread();
|
2014-12-01 18:59:07 -05:00
|
|
|
|
2015-07-29 20:57:02 -04:00
|
|
|
void run();
|
2014-11-16 16:51:45 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
DemodulatorThreadParameters &getParams() {
|
|
|
|
return params;
|
|
|
|
}
|
2014-11-30 17:11:29 -05:00
|
|
|
|
2015-01-08 21:12:49 -05:00
|
|
|
void setParams(DemodulatorThreadParameters ¶ms_in) {
|
|
|
|
params = params_in;
|
|
|
|
}
|
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
void initialize();
|
|
|
|
void terminate();
|
2014-11-26 21:05:19 -05:00
|
|
|
|
2014-12-01 18:59:07 -05:00
|
|
|
#ifdef __APPLE__
|
2014-12-16 21:30:03 -05:00
|
|
|
static void *pthread_helper(void *context) {
|
|
|
|
return ((DemodulatorPreThread *) context)->threadMain();
|
|
|
|
}
|
2014-12-01 18:59:07 -05:00
|
|
|
#endif
|
2014-11-23 19:39:27 -05:00
|
|
|
|
2014-11-16 16:51:45 -05:00
|
|
|
protected:
|
2015-01-03 17:07:39 -05:00
|
|
|
msresamp_crcf iqResampler;
|
|
|
|
double iqResampleRatio;
|
2015-01-04 13:20:31 -05:00
|
|
|
std::vector<liquid_float_complex> resampledData;
|
2014-11-16 16:51:45 -05:00
|
|
|
|
2015-11-17 18:57:42 -05:00
|
|
|
// msresamp_rrrf audioResampler;
|
|
|
|
// msresamp_rrrf stereoResampler;
|
|
|
|
// double audioResampleRatio;
|
2014-11-16 16:51:45 -05:00
|
|
|
|
2015-11-17 18:57:42 -05:00
|
|
|
// firfilt_rrrf firStereoLeft;
|
|
|
|
// firfilt_rrrf firStereoRight;
|
|
|
|
// iirfilt_crcf iirStereoPilot;
|
2015-03-15 21:02:26 -04:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
DemodulatorThreadParameters params;
|
2015-01-03 17:07:39 -05:00
|
|
|
DemodulatorThreadParameters lastParams;
|
2014-11-26 22:29:23 -05:00
|
|
|
|
2015-01-03 17:07:39 -05:00
|
|
|
nco_crcf freqShifter;
|
|
|
|
int shiftFrequency;
|
2014-11-27 22:13:21 -05:00
|
|
|
|
2015-07-19 23:19:10 -04:00
|
|
|
std::atomic_bool initialized;
|
2014-11-30 23:33:55 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
DemodulatorWorkerThread *workerThread;
|
|
|
|
std::thread *t_Worker;
|
2014-11-30 23:33:55 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
DemodulatorThreadWorkerCommandQueue *workerQueue;
|
|
|
|
DemodulatorThreadWorkerResultQueue *workerResults;
|
2015-07-30 00:28:53 -04:00
|
|
|
|
|
|
|
DemodulatorThreadInputQueue* iqInputQueue;
|
|
|
|
DemodulatorThreadPostInputQueue* iqOutputQueue;
|
|
|
|
DemodulatorThreadCommandQueue* threadQueueNotify;
|
|
|
|
DemodulatorThreadCommandQueue* commandQueue;
|
2014-11-16 16:51:45 -05:00
|
|
|
};
|