mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2026-04-19 23:02:43 +00:00
fix
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
#include <dsp/stream.h>
|
||||
#include <dsp/types.h>
|
||||
#include <dsp/routing.h>
|
||||
#include <dsp/processing.h>
|
||||
#include <dsp/sink.h>
|
||||
#include <mutex>
|
||||
#include <event.h>
|
||||
@@ -22,11 +23,20 @@ public:
|
||||
|
||||
class Stream {
|
||||
public:
|
||||
Stream() {}
|
||||
Stream(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate);
|
||||
|
||||
void init(dsp::stream<dsp::stereo_t>* in, const Event<float>::EventHandler& srChangeHandler, float sampleRate);
|
||||
|
||||
void start();
|
||||
void stop();
|
||||
|
||||
void setVolume(float volume);
|
||||
float getVolume();
|
||||
|
||||
void setSampleRate(float sampleRate);
|
||||
float getSampleRate();
|
||||
|
||||
void setInput(dsp::stream<dsp::stereo_t>* in);
|
||||
|
||||
dsp::stream<dsp::stereo_t>* bindStream();
|
||||
@@ -35,18 +45,22 @@ public:
|
||||
friend SinkManager;
|
||||
friend SinkManager::Sink;
|
||||
|
||||
dsp::stream<dsp::stereo_t>* sinkOut;
|
||||
|
||||
Event<float> srChange;
|
||||
|
||||
private:
|
||||
void setSampleRate(float sampleRate);
|
||||
|
||||
dsp::stream<dsp::stereo_t>* _in;
|
||||
dsp::Splitter<dsp::stereo_t> splitter;
|
||||
SinkManager::Sink* sink;
|
||||
dsp::stream<dsp::stereo_t> volumeInput;
|
||||
dsp::Volume<dsp::stereo_t> volumeAjust;
|
||||
std::mutex ctrlMtx;
|
||||
float _sampleRate;
|
||||
int providerId = 0;
|
||||
bool running = false;
|
||||
|
||||
float guiVolume = 1.0f;
|
||||
};
|
||||
|
||||
struct SinkProvider {
|
||||
@@ -56,13 +70,21 @@ public:
|
||||
|
||||
class NullSink : SinkManager::Sink {
|
||||
public:
|
||||
void start() {}
|
||||
void stop() {}
|
||||
NullSink(SinkManager::Stream* stream) {
|
||||
ns.init(stream->sinkOut);
|
||||
}
|
||||
void start() { ns.start(); }
|
||||
void stop() { ns.stop(); }
|
||||
void menuHandler() {}
|
||||
|
||||
static SinkManager::Sink* create(SinkManager::Stream* stream, std::string streamName, void* ctx) {
|
||||
return new SinkManager::NullSink;
|
||||
stream->srChange.emit(48000);
|
||||
return new SinkManager::NullSink(stream);
|
||||
}
|
||||
|
||||
private:
|
||||
dsp::NullSink<dsp::stereo_t> ns;
|
||||
|
||||
};
|
||||
|
||||
void registerSinkProvider(std::string name, SinkProvider provider);
|
||||
@@ -73,16 +95,27 @@ public:
|
||||
void startStream(std::string name);
|
||||
void stopStream(std::string name);
|
||||
|
||||
float getStreamSampleRate(std::string name);
|
||||
|
||||
void setStreamSink(std::string name, std::string providerName);
|
||||
|
||||
void showVolumeSlider(std::string name, std::string prefix, float width);
|
||||
|
||||
dsp::stream<dsp::stereo_t>* bindStream(std::string name);
|
||||
void unbindStream(std::string name, dsp::stream<dsp::stereo_t>* stream);
|
||||
|
||||
void loadSinksFromConfig();
|
||||
void showMenu();
|
||||
|
||||
std::vector<std::string> getStreamNames();
|
||||
|
||||
private:
|
||||
void loadStreamConfig(std::string name);
|
||||
void saveStreamConfig(std::string name);
|
||||
|
||||
std::map<std::string, SinkProvider> providers;
|
||||
std::map<std::string, Stream*> streams;
|
||||
std::vector<std::string> providerNames;
|
||||
std::vector<std::string> streamNames;
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user