mirror of
https://github.com/cjcliffe/CubicSDR.git
synced 2024-09-27 15:56:48 -04:00
b196fbfdea
RtAudio can’t open multiple streams, so now opening a new device will start a static audio thread and all other threads will attach/detach their input queues there.
59 lines
1.3 KiB
C++
59 lines
1.3 KiB
C++
#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;
|
|
#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();
|
|
DemodulatorThreadParameters &getParams();
|
|
|
|
void run();
|
|
void terminate();
|
|
std::string getLabel();
|
|
void setLabel(std::string labelStr);
|
|
|
|
bool isTerminated();
|
|
void updateLabel(int freq);
|
|
|
|
bool isActive();
|
|
void setActive(bool state);
|
|
|
|
private:
|
|
std::atomic<std::string *> label;
|
|
bool terminated;
|
|
bool demodTerminated;
|
|
bool audioTerminated;
|
|
bool preDemodTerminated;
|
|
std::atomic<bool> active;
|
|
};
|
|
|