vsdk 12.0.0
 
Loading...
Searching...
No Matches
Vsdk::Audio::Pipeline

Route audio from a ProducerModule to ConsumerModule, with ModifierModule in the middle. More...

#include <Pipeline.hpp>

Public Types

using ModifierIterator = Vsdk::Utils::Iterator< std::list< ModifierPtr > >
 
using ConsumerIterator = Vsdk::Utils::Iterator< std::list< ConsumerPtr > >
 

Public Member Functions

 Pipeline ()
 
 Pipeline (std::string const &id)
 
 Pipeline (Pipeline const &other) noexcept=delete
 Cannot copy because Modifiers & Consumers cannot be shared nor cloned.
 
Pipeline & operator= (Pipeline const &other) noexcept=delete
 
 Pipeline (Pipeline &&other)
 Move constructor & assignment.
 
Pipeline & operator= (Pipeline &&)
 
 ~Pipeline ()
 Stops the pipeline if running and unsubscribe from the producer.
 
void run ()
 Synchronously runs the pipeline (if supported by the provider).
 
void start ()
 Asynchronously starts the pipeline (if supported by the provider).
 
void pause ()
 Attempts to pause an already started pipeline.
 
void resume ()
 Attempts to resume a paused pipeline.
 
void stop ()
 Stops a pipeline that's been start()-ed.
 
auto id () const noexcept -> std::string const &
 Returns the pipeline's id.
 
void setProducer (ProducerPtr prod)
 Sets a new producer that's already been constructed outside.
 
template<class T , typename... Args>
auto setProducer (Args &&... args) -> std::shared_ptr< T >
 Sets a new producer by constructing it with args.
 
template<class T , typename... Args>
auto pushBackModifier (Args &&... args) -> ModifierIterator
 
template<class T , typename... Args>
auto pushFrontModifier (Args &&... args) -> ModifierIterator
 
template<class T , typename... Args>
auto pushBackConsumer (Args &&... args) -> ConsumerIterator
 
template<class T , typename... Args>
auto pushFrontConsumer (Args &&... args) -> ConsumerIterator
 
template<class T , typename... Args>
auto insertModifier (ModifierIterator pos, Args &&... args) -> ModifierIterator
 
template<class T , typename... Args>
auto insertConsumer (ConsumerIterator pos, Args &&... args) -> ConsumerIterator
 
auto pushBackModifier (ModifierPtr ptr) -> ModifierIterator
 
auto pushBackConsumer (ConsumerPtr ptr) -> ConsumerIterator
 
auto pushFrontModifier (ModifierPtr ptr) -> ModifierIterator
 
auto pushFrontConsumer (ConsumerPtr ptr) -> ConsumerIterator
 
auto insertModifier (ModifierIterator pos, ModifierPtr ptr) -> ModifierIterator
 
auto insertConsumer (ConsumerIterator pos, ConsumerPtr ptr) -> ConsumerIterator
 
void eraseModifier (ModifierIterator it)
 
void eraseConsumer (ConsumerIterator it)
 
void clearModifiers ()
 
void clearConsumers ()
 
auto producer () const -> ProducerPtr
 Gets this pipeline's producer in a generic form.
 
template<typename T >
auto producer () const -> std::shared_ptr< T >
 Gets this pipeline's producer statically casted to T.
 

Detailed Description

Route audio from a ProducerModule to ConsumerModule, with ModifierModule in the middle.

Member Typedef Documentation

◆ ModifierIterator

◆ ConsumerIterator

Constructor & Destructor Documentation

◆ Pipeline() [1/4]

Pipeline::Pipeline ( )

◆ Pipeline() [2/4]

Pipeline::Pipeline ( std::string const &  id)
explicit

◆ Pipeline() [3/4]

Vsdk::Audio::Pipeline::Pipeline ( Pipeline const &  other)
deletenoexcept

Cannot copy because Modifiers & Consumers cannot be shared nor cloned.

◆ Pipeline() [4/4]

Pipeline::Pipeline ( Pipeline &&  other)

Move constructor & assignment.

◆ ~Pipeline()

Pipeline::~Pipeline ( )

Stops the pipeline if running and unsubscribe from the producer.

Member Function Documentation

◆ operator=() [1/2]

Pipeline & Vsdk::Audio::Pipeline::operator= ( Pipeline const &  other)
deletenoexcept

◆ operator=() [2/2]

Pipeline & Pipeline::operator= ( Pipeline &&  other)

◆ run()

void Pipeline::run ( )

Synchronously runs the pipeline (if supported by the provider).

Effectively calls:

producer.open();
producer.run();
producer.close();
auto producer() const -> ProducerPtr
Gets this pipeline's producer in a generic form.
Definition Pipeline.cpp:227
Exceptions
Vsdk::Exceptionif error occurs

◆ start()

void Pipeline::start ( )

Asynchronously starts the pipeline (if supported by the provider).

Effectively calls:

producer.open();
producer.start();
Exceptions
Vsdk::Exceptionif error occurs

◆ pause()

void Pipeline::pause ( )

Attempts to pause an already started pipeline.

Note
This will send an empty "last" buffer into the pipeline if pausing succeeds
Exceptions
Vsdk::Exceptionif error occurs

◆ resume()

void Pipeline::resume ( )

Attempts to resume a paused pipeline.

Exceptions
Vsdk::Exceptionif error occurs

◆ stop()

void Pipeline::stop ( )

Stops a pipeline that's been start()-ed.

Effectively calls:

producer.stop();
producer.close();
Exceptions
Vsdk::Exceptionif error occurs

◆ id()

auto Pipeline::id ( ) const -> std::string const &
noexcept

Returns the pipeline's id.

◆ setProducer() [1/2]

void Pipeline::setProducer ( ProducerPtr  prod)

Sets a new producer that's already been constructed outside.

Note
If the pipeline is running it will first be stopped before setting the producer.

◆ setProducer() [2/2]

template<class T , typename... Args>
auto Vsdk::Audio::Pipeline::setProducer ( Args &&...  args) -> std::shared_ptr<T>

Sets a new producer by constructing it with args.

◆ pushBackModifier() [1/2]

template<class T , typename... Args>
auto Vsdk::Audio::Pipeline::pushBackModifier ( Args &&...  args) -> ModifierIterator

◆ pushFrontModifier() [1/2]

template<class T , typename... Args>
auto Vsdk::Audio::Pipeline::pushFrontModifier ( Args &&...  args) -> ModifierIterator

◆ pushBackConsumer() [1/2]

template<class T , typename... Args>
auto Vsdk::Audio::Pipeline::pushBackConsumer ( Args &&...  args) -> ConsumerIterator

◆ pushFrontConsumer() [1/2]

template<class T , typename... Args>
auto Vsdk::Audio::Pipeline::pushFrontConsumer ( Args &&...  args) -> ConsumerIterator

◆ insertModifier() [1/2]

template<class T , typename... Args>
auto Vsdk::Audio::Pipeline::insertModifier ( ModifierIterator  pos,
Args &&...  args 
) -> ModifierIterator

◆ insertConsumer() [1/2]

template<class T , typename... Args>
auto Vsdk::Audio::Pipeline::insertConsumer ( ConsumerIterator  pos,
Args &&...  args 
) -> ConsumerIterator

◆ pushBackModifier() [2/2]

auto Pipeline::pushBackModifier ( ModifierPtr  ptr) -> ModifierIterator

◆ pushBackConsumer() [2/2]

auto Pipeline::pushBackConsumer ( ConsumerPtr  ptr) -> ConsumerIterator

◆ pushFrontModifier() [2/2]

auto Pipeline::pushFrontModifier ( ModifierPtr  ptr) -> ModifierIterator

◆ pushFrontConsumer() [2/2]

auto Pipeline::pushFrontConsumer ( ConsumerPtr  ptr) -> ConsumerIterator

◆ insertModifier() [2/2]

auto Pipeline::insertModifier ( ModifierIterator  pos,
ModifierPtr  ptr 
) -> ModifierIterator

◆ insertConsumer() [2/2]

auto Pipeline::insertConsumer ( ConsumerIterator  pos,
ConsumerPtr  ptr 
) -> ConsumerIterator

◆ eraseModifier()

void Pipeline::eraseModifier ( ModifierIterator  it)

◆ eraseConsumer()

void Pipeline::eraseConsumer ( ConsumerIterator  it)

◆ clearModifiers()

void Pipeline::clearModifiers ( )

◆ clearConsumers()

void Pipeline::clearConsumers ( )

◆ producer() [1/2]

auto Pipeline::producer ( ) const -> ProducerPtr

Gets this pipeline's producer in a generic form.

◆ producer() [2/2]

template<typename T >
auto Vsdk::Audio::Pipeline::producer ( ) const -> std::shared_ptr<T>

Gets this pipeline's producer statically casted to T.

Note
Use the non-templated overload if you need to perform a type check