2014-12-16 18:27:32 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <queue>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "DemodDefs.h"
|
|
|
|
#include "AudioThread.h"
|
|
|
|
|
2014-12-23 01:59:03 -05:00
|
|
|
typedef ThreadQueue<AudioThreadInput *> DemodulatorThreadOutputQueue;
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-21 16:08:32 -05:00
|
|
|
#define DEMOD_VIS_SIZE 2048
|
|
|
|
|
2014-12-16 18:27:32 -05:00
|
|
|
class DemodulatorThread {
|
|
|
|
public:
|
|
|
|
|
2014-12-24 01:28:33 -05:00
|
|
|
DemodulatorThread(DemodulatorThreadPostInputQueue* pQueueIn, DemodulatorThreadControlCommandQueue *threadQueueControl,
|
|
|
|
DemodulatorThreadCommandQueue* threadQueueNotify);
|
2014-12-16 21:30:03 -05:00
|
|
|
~DemodulatorThread();
|
2014-12-16 18:27:32 -05:00
|
|
|
|
|
|
|
#ifdef __APPLE__
|
2014-12-16 21:30:03 -05:00
|
|
|
void *threadMain();
|
2014-12-16 18:27:32 -05:00
|
|
|
#else
|
2014-12-16 21:30:03 -05:00
|
|
|
void threadMain();
|
2014-12-16 18:27:32 -05:00
|
|
|
#endif
|
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
void setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) {
|
|
|
|
visOutQueue = tQueue;
|
|
|
|
}
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
void setAudioInputQueue(AudioThreadInputQueue *tQueue) {
|
|
|
|
audioInputQueue = tQueue;
|
|
|
|
}
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
void initialize();
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
void terminate();
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-26 20:58:42 -05:00
|
|
|
void setStereo(bool state);
|
|
|
|
bool isStereo();
|
|
|
|
|
2014-12-16 18:27:32 -05:00
|
|
|
#ifdef __APPLE__
|
2014-12-16 21:30:03 -05:00
|
|
|
static void *pthread_helper(void *context) {
|
|
|
|
return ((DemodulatorThread *) context)->threadMain();
|
|
|
|
}
|
2014-12-16 18:27:32 -05:00
|
|
|
#endif
|
|
|
|
|
|
|
|
protected:
|
2014-12-16 21:30:03 -05:00
|
|
|
DemodulatorThreadPostInputQueue* postInputQueue;
|
|
|
|
DemodulatorThreadOutputQueue* visOutQueue;
|
|
|
|
AudioThreadInputQueue *audioInputQueue;
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
freqdem fdem;
|
2014-12-21 16:08:32 -05:00
|
|
|
agc_crcf agc;
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-26 20:58:42 -05:00
|
|
|
std::atomic<bool> stereo;
|
2014-12-16 21:30:03 -05:00
|
|
|
std::atomic<bool> terminated;
|
2014-12-16 18:27:32 -05:00
|
|
|
|
2014-12-16 21:30:03 -05:00
|
|
|
DemodulatorThreadCommandQueue* threadQueueNotify;
|
2014-12-21 16:08:32 -05:00
|
|
|
DemodulatorThreadControlCommandQueue *threadQueueControl;
|
|
|
|
float squelch_level;
|
2014-12-24 01:28:33 -05:00
|
|
|
float squelch_tolerance;bool squelch_enabled;
|
2014-12-16 18:27:32 -05:00
|
|
|
};
|