64 lines
1.5 KiB
C++
64 lines
1.5 KiB
C++
#pragma once
|
|
|
|
#include <vector>
|
|
#include <map>
|
|
#include <thread>
|
|
|
|
#include "DemodulatorThread.h"
|
|
|
|
class DemodulatorInstance {
|
|
public:
|
|
|
|
DemodulatorThreadInputQueue* threadQueueDemod;
|
|
DemodulatorThreadCommandQueue* threadQueueCommand;
|
|
DemodulatorThread *demodulatorThread;
|
|
#ifdef __APPLE__
|
|
pthread_t t_Demod;
|
|
#else
|
|
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);
|
|
|
|
private:
|
|
std::string label;
|
|
};
|
|
|
|
class DemodulatorMgr {
|
|
public:
|
|
DemodulatorMgr();
|
|
~DemodulatorMgr();
|
|
|
|
DemodulatorInstance *newThread();
|
|
std::vector<DemodulatorInstance *> &getDemodulators();
|
|
std::vector<DemodulatorInstance *> *getDemodulatorsAt(int freq, int bandwidth);
|
|
void deleteThread(DemodulatorInstance *);
|
|
|
|
void terminateAll();
|
|
|
|
void setActiveDemodulator(DemodulatorInstance *demod, bool temporary = true);
|
|
DemodulatorInstance *getActiveDemodulator();
|
|
DemodulatorInstance *getLastActiveDemodulator();
|
|
|
|
private:
|
|
std::vector<DemodulatorInstance *> demods;
|
|
DemodulatorInstance *activeDemodulator;
|
|
DemodulatorInstance *lastActiveDemodulator;
|
|
DemodulatorInstance *activeVisualDemodulator;
|
|
};
|