CubicSDR/src/demod/DemodulatorInstance.h

119 lines
2.9 KiB
C
Raw Normal View History

#pragma once
#include <vector>
#include <map>
#include <thread>
#include "DemodulatorThread.h"
#include "DemodulatorPreThread.h"
#include "ModemDigital.h"
#include "ModemAnalog.h"
class DemodulatorInstance {
public:
#ifdef __APPLE__
pthread_t t_PreDemod;
pthread_t t_Demod;
#else
std::thread *t_PreDemod;
std::thread *t_Demod;
#endif
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-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();
void setDemodulatorType(std::string demod_type_in);
std::string getDemodulatorType();
2015-06-05 03:51:46 -04:00
void setDemodulatorLock(bool demod_lock_in);
int getDemodulatorLock();
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);
bool isMuted();
void setMuted(bool muted);
DemodulatorThreadInputQueue *getIQInputDataPipe();
2015-11-23 22:16:09 -05:00
ModemArgInfoList getModemArgs();
std::string readModemSetting(std::string setting);
ModemSettings readModemSettings();
2015-11-23 22:16:09 -05:00
void writeModemSetting(std::string setting, std::string value);
void writeModemSettings(ModemSettings settings);
2015-11-23 22:16:09 -05:00
bool isModemInitialized();
ModemSettings getLastModemSettings(std::string demodType);
protected:
DemodulatorThreadInputQueue* pipeIQInputData;
DemodulatorThreadPostInputQueue* pipeIQDemodData;
2015-08-01 11:03:00 -04:00
AudioThreadInputQueue *pipeAudioData;
DemodulatorThreadCommandQueue* pipeDemodNotify;
DemodulatorPreThread *demodulatorPreThread;
DemodulatorThread *demodulatorThread;
DemodulatorThreadControlCommandQueue *threadQueueControl;
private:
2014-12-31 19:45:01 -05:00
std::atomic<std::string *> label; //
2015-07-19 15:34:06 -04:00
std::atomic_bool terminated; //
std::atomic_bool demodTerminated; //
std::atomic_bool audioTerminated; //
std::atomic_bool preDemodTerminated;
std::atomic_bool active;
std::atomic_bool squelch;
std::atomic_bool muted;
2015-07-19 15:34:06 -04:00
std::atomic_int currentOutputDevice;
std::atomic<float> currentAudioGain;
std::atomic_bool follow, tracking;
std::map<std::string, ModemSettings> lastModemSettings;
};