TAudioStreamInfo

primo::avblocks::modern::TAudioStreamInfo

class TAudioStreamInfo : public primo::avblocks::modern::TStreamInfo<TAudioStreamInfo, primo::codecs::AudioStreamInfo>

Fluent wrapper for primo::codecs::AudioStreamInfo, which describes an elementary audio stream.

The properties common to all streams are inherited from TStreamInfo. The setters can be chained; on a temporary they return the object by rvalue reference so that the chain can be returned or moved:

TAudioStreamInfo audio = TAudioStreamInfo().channels(2).sampleRate(44100).bitsPerSample(16);
Owns the raw object through a primo::ref. Not copyable, movable.

Unnamed Group

TAudioStreamInfo(TAudioStreamInfo&&) = default
TAudioStreamInfo &operator=(TAudioStreamInfo&&) = default

Move construction/assignment transfers ownership of the underlying object. The moved-from object no longer wraps anything.

Unnamed Group

inline TAudioStreamInfo &channels(int32_t channels) &
inline TAudioStreamInfo &&channels(int32_t channels) &&

Sets the number of audio channels.

Parameters:

channels – Number of channels.

Returns:

This object, for chaining.

Unnamed Group

inline TAudioStreamInfo &sampleRate(int32_t sampleRate) &
inline TAudioStreamInfo &&sampleRate(int32_t sampleRate) &&

Sets the audio sample rate.

Parameters:

sampleRate – Sample rate in Hz.

Returns:

This object, for chaining.

Unnamed Group

inline TAudioStreamInfo &bitsPerSample(int32_t bits) &
inline TAudioStreamInfo &&bitsPerSample(int32_t bits) &&

Sets the number of bits per sample (sample resolution), usually 8, 16, 24 or 32.

Parameters:

bits – Bits per sample.

Returns:

This object, for chaining.

Unnamed Group

inline TAudioStreamInfo &pcmFlags(int32_t flags) &
inline TAudioStreamInfo &&pcmFlags(int32_t flags) &&

Sets the audio format flags.

Parameters:

flags – A combination of primo::codecs::PcmFlags::Enum values.

Returns:

This object, for chaining.

Unnamed Group

inline TAudioStreamInfo &channelLayout(int32_t layout) &
inline TAudioStreamInfo &&channelLayout(int32_t layout) &&

Sets the channel layout, the mapping between channels and speakers.

Parameters:

layout – A combination of primo::codecs::AudioChannelFlags::Enum values.

Returns:

This object, for chaining.

Unnamed Group

inline TAudioStreamInfo &bytesPerFrame(int32_t bytes) &
inline TAudioStreamInfo &&bytesPerFrame(int32_t bytes) &&

Sets the number of bytes occupied by an audio frame, the smallest discrete unit of an audio stream.

It is normally valid (greater than 0) for LPCM streams and 0 for compressed streams.

Parameters:

bytes – Bytes per frame.

Returns:

This object, for chaining.

Public Functions

inline TAudioStreamInfo()

Creates an audio stream info with default values.

inline explicit TAudioStreamInfo(primo::ref<primo::codecs::AudioStreamInfo> info)

Takes ownership of an existing AudioStreamInfo reference.

inline explicit TAudioStreamInfo(primo::codecs::AudioStreamInfo *info)

Wraps a non-owned AudioStreamInfo pointer, retaining it.

TAudioStreamInfo(const TAudioStreamInfo&) = delete
TAudioStreamInfo &operator=(const TAudioStreamInfo&) = delete
inline int32_t channels() const

Returns the number of audio channels.

inline int32_t sampleRate() const

Returns the audio sample rate in Hz.

inline int32_t bitsPerSample() const

Returns the number of bits per sample. Normally 0 for a compressed audio stream.

inline int32_t pcmFlags() const

Returns the audio format flags, a combination of primo::codecs::PcmFlags::Enum values.

inline int32_t channelLayout() const

Returns the channel layout, a combination of primo::codecs::AudioChannelFlags::Enum values.

inline int32_t bytesPerFrame() const

Returns the number of bytes occupied by an audio frame. Normally 0 for a compressed audio stream.

inline TAudioStreamInfo clone() const

Creates a full independent clone. The returned object is always mutable.

inline bool copyTo(TAudioStreamInfo &dst) const

Copies all fields to dst. Returns false if dst is null.