From 271a77e4ce9bd90048fdb1fd6d30c77e7645ff36 Mon Sep 17 00:00:00 2001 From: AlexandreRouma Date: Thu, 20 Apr 2023 09:35:06 +0200 Subject: [PATCH] More work on the stream system --- core/src/signal_path/stream.h | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/core/src/signal_path/stream.h b/core/src/signal_path/stream.h index 0b07bf88..c519d63f 100644 --- a/core/src/signal_path/stream.h +++ b/core/src/signal_path/stream.h @@ -48,7 +48,6 @@ private: class StreamManager; class AudioStream { - friend Sink; friend StreamManager; public: AudioStream(StreamManager* manager, const std::string& name, dsp::stream* stream, double samplerate); @@ -65,19 +64,40 @@ public: */ const std::string& getName(); + // TODO: Maybe instead we want to resample the data? void bindStream(dsp::stream* stream); void unbindStream(dsp::stream* stream); double getSamplerate(); void setSamplerate(double samplerate); + /** + * Add a sink to the stream. + * @param type Type of the sink. + * @return Index of the new sink or -1 on error. + */ int addSink(const std::string& type); + + /** + * Change the type of a sink. + * @param index Index of the sink. + * @param type New sink type. + */ void setSinkType(int index, const std::string& type); + + /** + * Remove a sink from a stream. + * @param index Index of the sink. + */ void removeSink(int index); + + /** + * Get the list of all sinks belonging to this stream. + * @return Sink list. + */ const std::vector>& getSinks(); private: - void setSinkInputSamplerate(Sink* sink, double samplerate); std::recursive_mutex mtx; StreamManager* manager; @@ -134,6 +154,7 @@ public: */ void unregisterSinkProvider(const std::string& name); + // TODO: Need a way to lock the list /** * Get a list of streams and their associated names. * @return Map of names to stream instance.