69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
#pragma once
|
|
|
|
#include <queue>
|
|
#include <vector>
|
|
|
|
#include "DemodDefs.h"
|
|
#include "AudioThread.h"
|
|
|
|
typedef ThreadQueue<AudioThreadInput *> DemodulatorThreadOutputQueue;
|
|
|
|
#define DEMOD_VIS_SIZE 1024
|
|
|
|
class DemodulatorThread {
|
|
public:
|
|
|
|
DemodulatorThread(DemodulatorThreadPostInputQueue* pQueueIn, DemodulatorThreadControlCommandQueue *threadQueueControl,
|
|
DemodulatorThreadCommandQueue* threadQueueNotify);
|
|
~DemodulatorThread();
|
|
|
|
#ifdef __APPLE__
|
|
void *threadMain();
|
|
#else
|
|
void threadMain();
|
|
#endif
|
|
|
|
void setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue) {
|
|
visOutQueue = tQueue;
|
|
}
|
|
|
|
void setAudioInputQueue(AudioThreadInputQueue *tQueue) {
|
|
audioInputQueue = tQueue;
|
|
}
|
|
|
|
void initialize();
|
|
void terminate();
|
|
|
|
void setStereo(bool state);
|
|
bool isStereo();
|
|
|
|
float getSignalLevel();
|
|
void setSquelchLevel(float signal_level_in);
|
|
float getSquelchLevel();
|
|
|
|
|
|
#ifdef __APPLE__
|
|
static void *pthread_helper(void *context) {
|
|
return ((DemodulatorThread *) context)->threadMain();
|
|
}
|
|
#endif
|
|
|
|
protected:
|
|
DemodulatorThreadPostInputQueue* postInputQueue;
|
|
DemodulatorThreadOutputQueue* visOutQueue;
|
|
AudioThreadInputQueue *audioInputQueue;
|
|
|
|
freqdem fdem;
|
|
agc_crcf agc;
|
|
|
|
std::atomic<bool> stereo;
|
|
std::atomic<bool> terminated;
|
|
|
|
DemodulatorThreadCommandQueue* threadQueueNotify;
|
|
DemodulatorThreadControlCommandQueue *threadQueueControl;
|
|
std::atomic<float> squelch_level;
|
|
float squelch_tolerance;
|
|
std::atomic<float> signal_level;
|
|
bool squelch_enabled;
|
|
};
|