libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
AudioBlock Class Reference

Base class for an audio processing block This object defines an interface for composing an audio processing chain. More...

#include <audioblock.h>

Inheritance diagram for AudioBlock:
Collaboration diagram for AudioBlock:

Classes

class  Config
 Config used by the derived class to configure AudioBlock This config is passed in by the derived class to configure the audio block on instantiation. More...
 

Public Member Functions

 AudioBlock (const Config &config, ObjectBase *parent=nullptr)
 Constructs an AudioBlock with a given configuration.
 
virtual ~AudioBlock ()
 Virtual destructor.
 
bool isSource () const
 Returns true if the audio block is a source.
 
bool isSourceValid (size_t val) const
 Returns true if the given source index is valid.
 
size_t sourceChannels () const
 Returns the number of channels this object can source.
 
virtual AudioDesc sourceDesc (size_t channel) const
 Returns the audio description for a given source channel.
 
virtual bool setSourceDesc (size_t channel, const AudioDesc &val)
 Sets the audio description for a given source channel.
 
virtual String sourceName (size_t channel) const
 Returns the name of a given source channel.
 
virtual bool setSourceName (size_t channel, const String &val)
 Sets the name of a given source channel.
 
virtual ssize_t sourceSamplesAvailable (size_t channel) const
 Returns the number of samples available on a source channel.
 
 PROMEKI_SIGNAL (sourceHasSamples, AudioBlock *, size_t)
 Signal emitted when a source has samples available.
 
bool isSink () const
 Returns true if the object is an audio sink.
 
bool isSinkValid (size_t val) const
 Returns true if the given sink channel index is valid.
 
size_t sinkChannels () const
 Returns the number of sink channels.
 
virtual AudioDesc sinkDesc (size_t channel) const
 Returns the audio description of a given sink channel.
 
virtual bool setSinkDesc (size_t channel, const AudioDesc &val)
 Sets the audio description of a given sink channel.
 
virtual String sinkName (size_t channel) const
 Returns the name of a given sink channel.
 
virtual bool setSinkName (size_t channel, const String &val)
 Sets the name of a given sink channel.
 
virtual ssize_t sinkSamplesAllowed (size_t channel) const
 Returns the number of samples a sink channel can currently accept.
 
 PROMEKI_SIGNAL (sinkReadyForSamples, AudioBlock *, size_t)
 Signal emitted whenever a sink channel can accept more samples.
 
- Public Member Functions inherited from ObjectBase
 ObjectBase (ObjectBase *p=nullptr)
 Default ObjectBase constructor.
 
virtual ~ObjectBase ()
 Destructor. Emits aboutToDestroy, detaches from parent, and destroys children.
 
ObjectBaseparent () const
 Returns the parent object, if one. nullptr if none.
 
void setParent (ObjectBase *p)
 Sets the parent of this object. If the object already has a parent, it will be removed as a child from the old parent and added as a child to the new one.
 
const ObjectBaseListchildList () const
 Returns a list of children of this object.
 
template<typename... Args>
int registerSlot (Slot< Args... > *slot)
 Registers a slot with this object and assigns it an ID.
 
EventLoopeventLoop () const
 Returns the EventLoop this object is affiliated with.
 
void moveToThread (EventLoop *loop)
 Changes the EventLoop affinity of this object.
 
int startTimer (unsigned int intervalMs, bool singleShot=false)
 Starts a timer on this object's EventLoop.
 
void stopTimer (int timerId)
 Stops a timer previously started with startTimer().
 
template<typename... Args>
PROMEKI_NAMESPACE_BEGIN void connect (Signal< Args... > *signal, Slot< Args... > *slot)
 

Additional Inherited Members

- Public Types inherited from ObjectBase
using SlotVariantFunc = std::function< void(const VariantList &)>
 Function type for invoking a slot with a list of Variants.
 
- Static Public Member Functions inherited from ObjectBase
static const MetaInfometaInfo ()
 Returns the MetaInfo for the ObjectBase class.
 
template<typename... Args>
static void connect (Signal< Args... > *signal, Slot< Args... > *slot)
 connects a signal and slot together. This function assumes both the signal and slot exist in a ObjectBase or derived object
 
- Public Attributes inherited from ObjectBase
Signal< ObjectBase * > aboutToDestroySignal = Signal< ObjectBase * >(this, aboutToDestroySignalName)
 
- Static Public Attributes inherited from ObjectBase
static constexpr const charaboutToDestroySignalName = PROMEKI_STRINGIFY( aboutToDestroy ) "(" PROMEKI_STRINGIFY_ARGS( ObjectBase * ) ")"
 
static SignalMeta aboutToDestroySignalMeta = SignalMeta(metaInfo(), aboutToDestroySignalName)
 
- Protected Member Functions inherited from ObjectBase
ObjectBasesignalSender ()
 Returns the ObjectBase that emitted the signal currently being handled.
 
virtual void event (Event *e)
 Called by EventLoop to deliver events to this object.
 
virtual void timerEvent (TimerEvent *e)
 Called when a timer fires for this object.
 

Detailed Description

Base class for an audio processing block This object defines an interface for composing an audio processing chain.

Constructor & Destructor Documentation

◆ AudioBlock()

AudioBlock::AudioBlock ( const Config config,
ObjectBase parent = nullptr 
)

Constructs an AudioBlock with a given configuration.

Parameters
configBlock configuration specifying source and sink channel counts.
parentOptional parent object.

Member Function Documentation

◆ isSinkValid()

bool AudioBlock::isSinkValid ( size_t  val) const
inline

Returns true if the given sink channel index is valid.

Parameters
valZero-based sink channel index to check.
Returns
true if the index is within the sink channel range.

◆ isSourceValid()

bool AudioBlock::isSourceValid ( size_t  val) const
inline

Returns true if the given source index is valid.

Parameters
valZero-based source channel index to check.
Returns
true if the index is within the source channel range.

◆ PROMEKI_SIGNAL() [1/2]

AudioBlock::PROMEKI_SIGNAL ( sinkReadyForSamples  ,
AudioBlock ,
size_t   
)

Signal emitted whenever a sink channel can accept more samples.

Signal:

◆ PROMEKI_SIGNAL() [2/2]

AudioBlock::PROMEKI_SIGNAL ( sourceHasSamples  ,
AudioBlock ,
size_t   
)

Signal emitted when a source has samples available.

Signal:

◆ setSinkDesc()

virtual bool AudioBlock::setSinkDesc ( size_t  channel,
const AudioDesc val 
)
virtual

Sets the audio description of a given sink channel.

Parameters
channelZero-based sink channel index.
valThe AudioDesc to set.
Returns
true on success, false if the channel index is invalid.

◆ setSinkName()

virtual bool AudioBlock::setSinkName ( size_t  channel,
const String val 
)
virtual

Sets the name of a given sink channel.

Parameters
channelZero-based sink channel index.
valThe name to assign.
Returns
true on success, false if the channel index is invalid.

◆ setSourceDesc()

virtual bool AudioBlock::setSourceDesc ( size_t  channel,
const AudioDesc val 
)
virtual

Sets the audio description for a given source channel.

Parameters
channelZero-based source channel index.
valThe AudioDesc to set.
Returns
true on success, false if the channel index is invalid.

◆ setSourceName()

virtual bool AudioBlock::setSourceName ( size_t  channel,
const String val 
)
virtual

Sets the name of a given source channel.

Parameters
channelZero-based source channel index.
valThe name to assign.
Returns
true on success, false if the channel index is invalid.

◆ sinkDesc()

virtual AudioDesc AudioBlock::sinkDesc ( size_t  channel) const
virtual

Returns the audio description of a given sink channel.

Parameters
channelZero-based sink channel index.
Returns
The AudioDesc for the specified channel.

◆ sinkName()

virtual String AudioBlock::sinkName ( size_t  channel) const
virtual

Returns the name of a given sink channel.

Parameters
channelZero-based sink channel index.
Returns
The channel name.

◆ sinkSamplesAllowed()

virtual ssize_t AudioBlock::sinkSamplesAllowed ( size_t  channel) const
virtual

Returns the number of samples a sink channel can currently accept.

Parameters
channelZero-based sink channel index.
Returns
Number of samples the channel can accept, or -1 if unknown.

◆ sourceDesc()

virtual AudioDesc AudioBlock::sourceDesc ( size_t  channel) const
virtual

Returns the audio description for a given source channel.

Parameters
channelZero-based source channel index.
Returns
The AudioDesc for the specified channel.

◆ sourceName()

virtual String AudioBlock::sourceName ( size_t  channel) const
virtual

Returns the name of a given source channel.

Parameters
channelZero-based source channel index.
Returns
The channel name.

◆ sourceSamplesAvailable()

virtual ssize_t AudioBlock::sourceSamplesAvailable ( size_t  channel) const
virtual

Returns the number of samples available on a source channel.

Parameters
channelZero-based source channel index.
Returns
Number of samples available, or -1 if unknown.

The documentation for this class was generated from the following file: