VISR  0.11.6
Versatile Interactive Scene Renderer
visr::AudioPortBase Class Reference

#include <audio_port_base.hpp>

Inheritance diagram for visr::AudioPortBase:
visr::AudioInputBase visr::AudioOutputBase visr::AudioInputT< SampleType > visr::AudioInputT< DataType > visr::AudioOutputT< SampleType > visr::AudioOutputT< DataType >

Public Member Functions

 AudioPortBase (char const *name, Component &container, AudioSampleType::Id sampleType, PortBase::Direction direction)
 
 AudioPortBase (char const *name, Component &container, AudioSampleType::Id sampleType, PortBase::Direction direction, std::size_t width)
 
virtual ~AudioPortBase ()
 
void setWidth (std::size_t newWidth)
 
std::size_t width () const noexcept
 
std::size_t alignmentBytes () noexcept
 
std::size_t alignmentSamples () noexcept
 
std::size_t channelStrideSamples () const noexcept
 
std::size_t channelStrideBytes () const noexcept
 
AudioSampleType::Id sampleType () const noexcept
 
std::size_t sampleSize () const noexcept
 
impl::AudioPortBaseImplementationimplementation ()
 
impl::AudioPortBaseImplementation const & implementation () const
 

Protected Member Functions

void * basePointer ()
 
void const * basePointer () const
 

Detailed Description

Base class for audio ports. Audio ports can form part of the external interface of components and denote start and end points od audio signal connections. An audio port is characterised by a sample type (fundamental integral and floating-point data type as well as complex floating-point types), the width, that is, the number of elementary audio signals represented by this port.

Constructor & Destructor Documentation

◆ AudioPortBase() [1/2]

visr::AudioPortBase::AudioPortBase ( char const *  name,
Component container,
AudioSampleType::Id  sampleType,
PortBase::Direction  direction 
)
explicit

Constructor, construct a base audio port object with width zero. The width can be set later on during initialization using setWidth().

Parameters
nameZero-terminated charracter array containing the name of the port. The port name must be unique within all audio ports of the containing component
containerThe component to contain that port.
sampleTypeEnumeration value denoting the data type of the samples used by this port.
directionThe direction of the port (either input or output)

◆ AudioPortBase() [2/2]

visr::AudioPortBase::AudioPortBase ( char const *  name,
Component container,
AudioSampleType::Id  sampleType,
PortBase::Direction  direction,
std::size_t  width 
)
explicit

Constructor, construct a base audio port object with a width parameter.

Parameters
nameZero-terminated charracter array containing the name of the port. The port name must be unique within all audio ports of the containing component
containerThe component to contain that port.
sampleTypeEnumeration value denoting the data type of the samples used by this port.
directionThe direction of the port (either input or output)
widthThe width, i.e., the number of separate audio channels. This value can be changed before runtime.

◆ ~AudioPortBase()

visr::AudioPortBase::~AudioPortBase ( )
virtual

Destructor (virtual). Audio ports can possibley be created and held polymorphically, although this is not done in standard components.

Member Function Documentation

◆ alignmentBytes()

std::size_t visr::AudioPortBase::alignmentBytes ( )
noexcept

Return the alignment of the channel vectors in bytes. This method can be called at any point of the lifetime of an audio port, and the alignment is guaranteed not to change.

◆ alignmentSamples()

std::size_t visr::AudioPortBase::alignmentSamples ( )
noexcept

Return the guaranteed alignment of the channel vectors (in multiples of the sample size). This function can be called at any point of the audio port's lifetime and the alignment remains constant througout that lifetime.

◆ basePointer() [1/2]

void * visr::AudioPortBase::basePointer ( )
protected

Return the data pointer to fir first (technically zeroth) channel. The type of this pointer is char and needs to be casted in derived, typed port classes.

◆ basePointer() [2/2]

void const * visr::AudioPortBase::basePointer ( ) const
protected

Return the data pointer to fir first (technically zeroth) channel, costant versiob The type of this pointer is char and needs to be casted in derived, typed port classes.

◆ channelStrideBytes()

std::size_t visr::AudioPortBase::channelStrideBytes ( ) const
noexcept

Return the number of bytesbetween the start of consecutive audio channels.

◆ channelStrideSamples()

std::size_t visr::AudioPortBase::channelStrideSamples ( ) const
noexcept

Return the number of samples between the start of consecutive audio channels.

◆ implementation() [1/2]

impl::AudioPortBaseImplementation & visr::AudioPortBase::implementation ( )

Return apointer to the opaque implemenentation object. This method is not to be used by implementation code.

◆ implementation() [2/2]

impl::AudioPortBaseImplementation const & visr::AudioPortBase::implementation ( ) const

Return apointer to the opaque implemenentation object, const version. This method is not to be used by implementation code.

◆ sampleSize()

std::size_t visr::AudioPortBase::sampleSize ( ) const
noexcept

Return the size (in bytes) of the data type provided by this port

◆ sampleType()

AudioSampleType::Id visr::AudioPortBase::sampleType ( ) const
noexcept

Return an enumeration value denoting the type of the audio samples used by this port.

◆ setWidth()

void visr::AudioPortBase::setWidth ( std::size_t  newWidth)

Set the width (i.e., the number of individual audio signals) contained within this port. The new value overwrites any previously set values and can be called multiple times on a single port. This method must only be called in the initialisation phase of the signal flow, not during runtime.

Parameters
newWidthThe new width (number of single audio signals).
Exceptions
std::logic_errorIf the method is called during runtime.

◆ width()

std::size_t visr::AudioPortBase::width ( ) const
noexcept

Return the number of individual channels held by this port.


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