CubicSDR/src/demod/DemodulatorInstance.h

105 lines
2.4 KiB
C
Raw Normal View History

#pragma once
#include <vector>
#include <map>
#include <thread>
#include "DemodulatorThread.h"
#include "DemodulatorPreThread.h"
class DemodulatorInstance {
public:
DemodulatorThreadInputQueue* threadQueueDemod;
DemodulatorThreadPostInputQueue* threadQueuePostDemod;
DemodulatorThreadCommandQueue* threadQueueCommand;
DemodulatorThreadCommandQueue* threadQueueNotify;
DemodulatorPreThread *demodulatorPreThread;
DemodulatorThread *demodulatorThread;
DemodulatorThreadControlCommandQueue *threadQueueControl;
#ifdef __APPLE__
pthread_t t_PreDemod;
pthread_t t_Demod;
#else
std::thread *t_PreDemod;
std::thread *t_Demod;
#endif
AudioThreadInputQueue *audioInputQueue;
AudioThread *audioThread;
std::thread *t_Audio;
DemodulatorInstance();
~DemodulatorInstance();
void setVisualOutputQueue(DemodulatorThreadOutputQueue *tQueue);
DemodulatorThreadCommandQueue *getCommandQueue();
void run();
void terminate();
std::string getLabel();
void setLabel(std::string labelStr);
bool isTerminated();
void updateLabel(long long freq);
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();
void setSquelchEnabled(bool state);
2014-12-31 19:45:01 -05:00
float getSignalLevel();
void setSquelchLevel(float signal_level_in);
float getSquelchLevel();
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
void setBandwidth(int bw);
int getBandwidth();
2015-01-10 20:33:30 -05:00
void setGain(float gain_in);
float getGain();
void setFrequency(long long freq);
long long getFrequency();
void setAudioSampleRate(int sampleRate);
int getAudioSampleRate();
2015-03-26 22:45:52 -04:00
bool isFollow();
void setFollow(bool follow);
bool isTracking();
void setTracking(bool tracking);
private:
void checkBandwidth();
2014-12-31 19:45:01 -05:00
std::atomic<std::string *> label; //
bool terminated; //
bool demodTerminated; //
bool audioTerminated; //
bool preDemodTerminated;
std::atomic<bool> active;
std::atomic<bool> squelch;
2014-12-26 20:58:42 -05:00
std::atomic<bool> stereo;
2015-01-01 18:08:54 -05:00
long long currentFrequency;
int currentBandwidth;
int currentDemodType;
int currentOutputDevice;
int currentAudioSampleRate;
bool follow, tracking;
};