HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Public Member Functions | Data Fields
tt::audio_sample_format Struct Reference

#include <ttauri/audio/audio_sample_format.hpp>

Public Member Functions

float pack_multiplier () const noexcept
 How much to multiply float samples to create integer samples.
 
float unpack_multiplier () const noexcept
 How much to multiply integer samples to create float samples.
 
int num_samples_per_chunk () const noexcept
 The number of packed samples that are handled in a single 128 bit load or store.
 
int chunk_stride () const noexcept
 The number of bytes to advance to the next chunk to be loaded or stored.
 
int num_chunks_per_quad () const noexcept
 The number of chunks to load or store to handle 4 samples.
 
size_t num_fast_quads (size_t num_samples) const noexcept
 Calculate the number of 4 sample-quads can be handled as chunked loads and stores.
 
i8x16 load_shuffle_indices () const noexcept
 Return a shuffle indices for loading samples into 32 bit integers.
 
i8x16 store_shuffle_indices () const noexcept
 Return a shuffle indices for storing 32 bit samples into packed samples.
 
i8x16 concat_shuffle_indices () const noexcept
 Return a shuffle indices to shift previous loaded samples for concatenation.
 
bool is_valid () const noexcept
 Is the audio sample format valid.
 

Data Fields

int num_bytes
 The number of bytes of the container.
 
int num_guard_bits
 The number of bits used for the integer part of a fixed point number.
 
int num_bits
 The number of significant bits of the sample format.
 
bool is_float
 The numeric type is floating point.
 
std::endian endian
 The endian order of the bytes in the container.
 
int stride
 The number of bytes to step to the next sample of the same channel.
 

Detailed Description

Audio sample format.

Audio samples described by this type can be in three different formats.

Sample values are aligned to the most significant bits of the container described by num_bytes. The bottom bits are set to zero.

Member Function Documentation

◆ chunk_stride()

int tt::audio_sample_format::chunk_stride ( ) const
noexcept

The number of bytes to advance to the next chunk to be loaded or stored.

◆ concat_shuffle_indices()

i8x16 tt::audio_sample_format::concat_shuffle_indices ( ) const
noexcept

Return a shuffle indices to shift previous loaded samples for concatenation.

◆ is_valid()

bool tt::audio_sample_format::is_valid ( ) const
noexcept

Is the audio sample format valid.

◆ load_shuffle_indices()

i8x16 tt::audio_sample_format::load_shuffle_indices ( ) const
noexcept

Return a shuffle indices for loading samples into 32 bit integers.

◆ num_chunks_per_quad()

int tt::audio_sample_format::num_chunks_per_quad ( ) const
noexcept

The number of chunks to load or store to handle 4 samples.

◆ num_fast_quads()

size_t tt::audio_sample_format::num_fast_quads ( size_t num_samples) const
noexcept

Calculate the number of 4 sample-quads can be handled as chunked loads and stores.

◆ num_samples_per_chunk()

int tt::audio_sample_format::num_samples_per_chunk ( ) const
noexcept

The number of packed samples that are handled in a single 128 bit load or store.

Always one of: 1, 2 or 4.

◆ pack_multiplier()

float tt::audio_sample_format::pack_multiplier ( ) const
noexcept

How much to multiply float samples to create integer samples.

◆ store_shuffle_indices()

i8x16 tt::audio_sample_format::store_shuffle_indices ( ) const
noexcept

Return a shuffle indices for storing 32 bit samples into packed samples.

◆ unpack_multiplier()

float tt::audio_sample_format::unpack_multiplier ( ) const
noexcept

How much to multiply integer samples to create float samples.

Field Documentation

◆ endian

std::endian tt::audio_sample_format::endian

The endian order of the bytes in the container.

◆ is_float

bool tt::audio_sample_format::is_float

The numeric type is floating point.

Otherwise it is a signed integer or fixed point number.

◆ num_bits

int tt::audio_sample_format::num_bits

The number of significant bits of the sample format.

This value is excluding the sign. (1 << num_bits) - 1 is the maximum sample value.

Examples:

  • 16 bit signed PCM -> num_bits=15
  • 24 bit signed PCM -> num_bits=23
  • float PCM -> num_bits=23
  • Q8.23 PCM -> num_bits=23

◆ num_bytes

int tt::audio_sample_format::num_bytes

The number of bytes of the container.

Must be either 1, 2, 3 or 4

◆ num_guard_bits

int tt::audio_sample_format::num_guard_bits

The number of bits used for the integer part of a fixed point number.

This value is zero for signed integer and float samples.

◆ stride

int tt::audio_sample_format::stride

The number of bytes to step to the next sample of the same channel.


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