vsdk  9.1.0
Vsdk::Audio::Pipeline

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

Public Types

using ModifierIterator = details::Iterator< decltype(_modifiers)>
 
using ConsumerIterator = details::Iterator< decltype(_consumers)>
 

Public Member Functions

 Pipeline ()=default
 
 Pipeline (Pipeline const &other) noexcept=delete
 Cannot copy because Modifiers & Consumers cannot be shared nor cloned. More...
 
Pipelineoperator= (Pipeline const &other) noexcept=delete
 Cannot copy because Modifiers & Consumers cannot be shared nor cloned. More...
 
 Pipeline (Pipeline &&other)
 
Pipelineoperator= (Pipeline &&)
 
 ~Pipeline ()
 Stops the pipeline if running and unsubscribe from the producer. More...
 
bool run () noexcept
 Synchronously runs the pipeline (if supported by the provider). More...
 
bool start () noexcept
 Asynchronously starts the pipeline (if supported by the provider). More...
 
bool pause () noexcept
 Attempts to pause an already started pipeline. More...
 
bool resume () noexcept
 Attempts to resume a paused pipeline. More...
 
bool stop () noexcept
 Stops a pipeline that's been start()-ed. More...
 
void setProducer (ProducerPtr prod)
 Sets a new producer that's already been constructed outside. More...
 
template<class T , typename... Args>
auto setProducer (Args &&... args) -> std::shared_ptr< T >
 Sets a new producer by constructing it with args. More...
 
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)
 
auto lastError () const -> std::string
 Produces a string formatted from the last generated ExceptionStack. More...
 
auto producer () const -> ProducerPtr
 Gets this pipeline's producer in a generic form. More...
 
template<typename T >
auto producer () const -> std::shared_ptr< T >
 Gets this pipeline's producer statically casted to T. More...
 

Detailed Description

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

Member Typedef Documentation

◆ ModifierIterator

using Vsdk::Audio::Pipeline::ModifierIterator = details::Iterator<decltype(_modifiers)>

◆ ConsumerIterator

using Vsdk::Audio::Pipeline::ConsumerIterator = details::Iterator<decltype(_consumers)>

Constructor & Destructor Documentation

◆ Pipeline() [1/3]

Vsdk::Audio::Pipeline::Pipeline ( )
default

◆ Pipeline() [2/3]

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

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

◆ Pipeline() [3/3]

Pipeline::Pipeline ( Pipeline &&  other)

◆ ~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

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

◆ operator=() [2/2]

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

◆ run()

bool Pipeline::run ( )
noexcept

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

Effectively calls:

producer.open();
producer.run();
producer.close();

◆ start()

bool Pipeline::start ( )
noexcept

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

Effectively calls:

producer.open();
producer.start();

◆ pause()

bool Pipeline::pause ( )
noexcept

Attempts to pause an already started pipeline.

Note
This will send an empty "last" buffer into the pipeline if pausing succeeds

◆ resume()

bool Pipeline::resume ( )
noexcept

Attempts to resume a paused pipeline.

◆ stop()

bool Pipeline::stop ( )
noexcept

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

Effectively calls:

producer.stop();
producer.close();

◆ 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)

◆ lastError()

auto Pipeline::lastError ( ) const -> std::string

Produces a string formatted from the last generated ExceptionStack.

This is akin to calling Vsdk::printExceptionStack() with default parameters

◆ 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
Vsdk::Audio::Pipeline::producer
auto producer() const -> ProducerPtr
Gets this pipeline's producer in a generic form.
Definition: Pipeline.cpp:537