mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-20 07:12:43 +00:00
More work on the sink interface
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <dsp/routing.h>
|
||||
#include <mutex>
|
||||
#include <event.h>
|
||||
#include <vector>
|
||||
|
||||
class SinkManager {
|
||||
public:
|
||||
@@ -13,6 +14,8 @@ public:
|
||||
|
||||
class Sink {
|
||||
public:
|
||||
virtual void start() = 0;
|
||||
virtual void stop() = 0;
|
||||
virtual void menuHandler() = 0;
|
||||
};
|
||||
|
||||
@@ -20,6 +23,9 @@ public:
|
||||
public:
|
||||
Stream(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate);
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
void setInput(dsp::stream<dsp::stereo_t>* in);
|
||||
|
||||
dsp::stream<dsp::stereo_t>* bindStream();
|
||||
@@ -29,13 +35,14 @@ public:
|
||||
friend SinkManager::Sink;
|
||||
|
||||
Event<float> srChange;
|
||||
SinkManager::Sink* sink;
|
||||
int providerId = 0;
|
||||
|
||||
private:
|
||||
void setSampleRate(float sampleRate);
|
||||
|
||||
dsp::stream<dsp::stereo_t>* _in;
|
||||
dsp::Splitter<dsp::stereo_t> splitter;
|
||||
SinkManager::Sink* sink;
|
||||
std::mutex ctrlMtx;
|
||||
float _sampleRate;
|
||||
|
||||
@@ -51,15 +58,19 @@ public:
|
||||
void registerStream(std::string name, Stream* stream);
|
||||
void unregisterStream(std::string name);
|
||||
|
||||
void startStream(std::string name);
|
||||
void stopStream(std::string name);
|
||||
|
||||
void setStreamSink(std::string name, std::string providerName);
|
||||
|
||||
dsp::stream<dsp::stereo_t>* bindStream(std::string name);
|
||||
void unbindStream(std::string name, dsp::stream<dsp::stereo_t>* stream);
|
||||
|
||||
void showMenu();
|
||||
|
||||
private:
|
||||
// TODO: Replace with std::unordered_map
|
||||
std::map<std::string, SinkProvider> providers;
|
||||
std::map<std::string, Stream*> streams;
|
||||
|
||||
std::vector<std::string> providerNames;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user