2014-12-11 23:35:06 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include <map>
|
|
|
|
#include <thread>
|
|
|
|
|
|
|
|
#include "DemodulatorThread.h"
|
2014-12-16 18:27:02 -05:00
|
|
|
#include "DemodulatorPreThread.h"
|
2014-12-11 23:35:06 -05:00
|
|
|
|
|
|
|
class DemodulatorInstance {
|
|
|
|
public:
|
|
|
|
|
|
|
|
DemodulatorThreadInputQueue* threadQueueDemod;
|
2014-12-16 18:27:02 -05:00
|
|
|
DemodulatorThreadPostInputQueue* threadQueuePostDemod;
|
2014-12-11 23:35:06 -05:00
|
|
|
DemodulatorThreadCommandQueue* threadQueueCommand;
|
|
|
|
DemodulatorThreadCommandQueue* threadQueueNotify;
|
2014-12-16 18:27:02 -05:00
|
|
|
DemodulatorPreThread *demodulatorPreThread;
|
2014-12-11 23:35:06 -05:00
|
|
|
DemodulatorThread *demodulatorThread;
|
2014-12-21 16:08:32 -05:00
|
|
|
DemodulatorThreadControlCommandQueue *threadQueueControl;
|
|
|
|
|
2014-12-11 23:35:06 -05:00
|
|
|
#ifdef __APPLE__
|
2014-12-16 18:27:02 -05:00
|
|
|
pthread_t t_PreDemod;
|
2014-12-11 23:35:06 -05:00
|
|
|
pthread_t t_Demod;
|
|
|
|
#else
|
2014-12-16 18:27:02 -05:00
|
|
|
std::thread *t_PreDemod;
|
2014-12-11 23:35:06 -05:00
|
|
|
std::thread *t_Demod;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
AudioThreadInputQueue *audioInputQueue;
|
|
|
|
AudioThread *audioThread;
|
|
|
|
std::thread *t_Audio;
|
|
|
|
|
|
|
|
DemodulatorInstance();
|
|
|
|
~DemodulatorInstance();
|
|
|
|
|
|
|
|
void setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue);
|
|
|
|
|
|
|
|
DemodulatorThreadCommandQueue *getCommandQueue();
|
|
|
|
DemodulatorThreadParameters &getParams();
|
|
|
|
|
|
|
|
void run();
|
|
|
|
void terminate();
|
|
|
|
std::string getLabel();
|
|
|
|
void setLabel(std::string labelStr);
|
|
|
|
|
|
|
|
bool isTerminated();
|
|
|
|
void updateLabel(int freq);
|
|
|
|
|
2014-12-18 20:11:25 -05:00
|
|
|
bool isActive();
|
|
|
|
void setActive(bool state);
|
|
|
|
|
2014-12-26 20:58:42 -05:00
|
|
|
bool isStereo();
|
|
|
|
void setStereo(bool state);
|
|
|
|
|
2014-12-31 19:45:01 -05:00
|
|
|
void squelchAuto();
|
|
|
|
bool isSquelchEnabled();
|
2014-12-21 16:08:32 -05:00
|
|
|
void setSquelchEnabled(bool state);
|
|
|
|
|
2014-12-31 19:45:01 -05:00
|
|
|
float getSignalLevel();
|
|
|
|
void setSquelchLevel(float signal_level_in);
|
|
|
|
float getSquelchLevel();
|
|
|
|
|
2014-12-31 21:31:37 -05:00
|
|
|
void setOutputDevice(int device_id);
|
|
|
|
int getOutputDevice();
|
|
|
|
|
2015-01-01 18:08:54 -05:00
|
|
|
void setDemodulatorType(int demod_type_in);
|
|
|
|
int getDemodulatorType();
|
2015-01-01 03:48:32 -05:00
|
|
|
|
2014-12-11 23:35:06 -05:00
|
|
|
private:
|
2014-12-31 19:45:01 -05:00
|
|
|
std::atomic<std::string *> label; //
|
|
|
|
bool terminated; //
|
|
|
|
bool demodTerminated; //
|
|
|
|
bool audioTerminated; //
|
|
|
|
bool preDemodTerminated;
|
2014-12-18 20:11:25 -05:00
|
|
|
std::atomic<bool> active;
|
2014-12-21 16:08:32 -05:00
|
|
|
std::atomic<bool> squelch;
|
2014-12-26 20:58:42 -05:00
|
|
|
std::atomic<bool> stereo;
|
2015-01-01 18:08:54 -05:00
|
|
|
|
|
|
|
int currentDemodType;
|
2014-12-11 23:35:06 -05:00
|
|
|
};
|
|
|
|
|