vsdk  7.1.1
Vsdk::Audio::ProducerModuleabstract

Base class for Pipeline modules that aquire and dispatch audio buffers (like Producer::File) More...

Inheritance diagram for Vsdk::Audio::ProducerModule:
Vsdk::Audio::ProducerModuleImpl< BufferForwarder > Vsdk::Audio::ProducerModuleImpl< BufferModule > Vsdk::Audio::ProducerModuleImpl< File > Vsdk::Audio::ProducerModuleImpl< T > Vsdk::Audio::Producer::BufferForwarder Vsdk::Audio::BufferModule Vsdk::Audio::Producer::File

Public Types

using Iterator = details::Iterator< decltype(_subscribers)>
 Iterator pointing to a subscriber of this producer. More...
 

Public Member Functions

virtual ~ProducerModule ()=0
 
auto subscribeFirst (AudioCallback c) -> Iterator
 Subscribes as first in the list of audio buffer receivers for this producer. More...
 
auto subscribeLast (AudioCallback c) -> Iterator
 Subscribes as last in the list of audio buffer receivers for this producer. More...
 
void unsubscribe (Iterator it)
 Unsubscribes from this producer audio buffer dispatch list. More...
 
virtual bool open ()
 
virtual bool run ()
 
virtual bool start ()
 
virtual bool stop ()
 
virtual bool resume ()
 Non-blocking call. More...
 
virtual bool close ()
 
auto lastError () const -> std::string const &
 

Protected Member Functions

 ProducerModule ()=default
 
template<typename... Args>
void setLastError (char const *fmt, Args &&... args)
 
void setLastError (std::string error)
 
void dispatchBuffer (Buffer buffer, bool last)
 
template<typename T >
void dispatchAudio (T &&data, int sampleRate, int channelCount, bool isLast)
 

Detailed Description

Base class for Pipeline modules that aquire and dispatch audio buffers (like Producer::File)

Member Typedef Documentation

◆ Iterator

using Vsdk::Audio::ProducerModule::Iterator = details::Iterator<decltype(_subscribers)>

Iterator pointing to a subscriber of this producer.

Constructor & Destructor Documentation

◆ ProducerModule()

Vsdk::Audio::ProducerModule::ProducerModule ( )
protecteddefault

◆ ~ProducerModule()

Vsdk::Audio::ProducerModule::~ProducerModule ( )
pure virtualdefault

Member Function Documentation

◆ subscribeFirst()

auto ProducerModule::subscribeFirst ( AudioCallback  c) -> Iterator

Subscribes as first in the list of audio buffer receivers for this producer.

◆ subscribeLast()

auto ProducerModule::subscribeLast ( AudioCallback  c) -> Iterator

Subscribes as last in the list of audio buffer receivers for this producer.

◆ unsubscribe()

void ProducerModule::unsubscribe ( Iterator  it)

Unsubscribes from this producer audio buffer dispatch list.

◆ open()

virtual bool Vsdk::Audio::ProducerModule::open ( )
virtual
Note
Does nothing by default to support devices like buffers.

Reimplemented in Vsdk::Audio::Producer::File.

◆ run()

bool ProducerModule::run ( )
virtual
Note
Blocking call
Warning
Do not override if you do not support synchronous operations!

Reimplemented in Vsdk::Audio::Producer::File, and Vsdk::Audio::BufferModule.

◆ start()

bool ProducerModule::start ( )
virtual
Note
Non-blocking call
Warning
Do not override if you do not support async operations!

Reimplemented in Vsdk::Audio::Producer::BufferForwarder, and Vsdk::Audio::BufferModule.

◆ stop()

bool ProducerModule::stop ( )
virtual
Note
Non-blocking call
Warning
Do not override if you do not support async operations!

Reimplemented in Vsdk::Audio::Producer::BufferForwarder, and Vsdk::Audio::BufferModule.

◆ resume()

bool ProducerModule::resume ( )
virtual

Non-blocking call.

Warning
Do not override if you do not support async operations!

◆ close()

virtual bool Vsdk::Audio::ProducerModule::close ( )
virtual
Note
Does nothing by default to support devices like buffers.

Reimplemented in Vsdk::Audio::Producer::File.

◆ lastError()

auto ProducerModule::lastError ( ) const -> std::string const &

◆ setLastError() [1/2]

template<typename... Args>
void Vsdk::Audio::ProducerModule::setLastError ( char const *  fmt,
Args &&...  args 
)
protected

◆ setLastError() [2/2]

void ProducerModule::setLastError ( std::string  error)
protected

◆ dispatchBuffer()

void ProducerModule::dispatchBuffer ( Buffer  buffer,
bool  last 
)
protected

◆ dispatchAudio()

template<typename T >
void Vsdk::Audio::ProducerModule::dispatchAudio ( T &&  data,
int  sampleRate,
int  channelCount,
bool  isLast 
)
protected