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

#include <ttauri/audio/audio_block.hpp>

Public Member Functions

ssize_t number_of_samples () const noexcept
 Number of samples in this audio block.
 
std::span< float > samples_for_channel (ssize_t index) noexcept
 Sample data for a channel.
 

Data Fields

ssize_t number_of_vectors
 Number of vector of samples in this audio block.
 
ssize_t number_of_channels
 Number of channels in this audio block.
 
std::span< float > samples
 Sample data.
 
uint64_t sample_position
 The sample position of the first sample in this block since the start of the capture/render session.
 
hires_utc_clock::time_point timestamp
 Timestamp when the sample first sample in this block was captured at the audio device input or when the first sample in this block will appear at the audio device output.
 
double word_clock_sample_rate
 Sample rate of the word clock attached to the audio interface For example in some situation on film sets the audio interface sample rate is overdriven to 48048 Hz.
 
double device_sample_rate
 Sample rate to what the audio device is configured to.
 
bool corrupt
 The sample data in this block was corrupted Examples of how corruption could happen:
 
bool silent
 This block of audio is silent.
 

Static Public Attributes

static constexpr ssize_t samples_per_vector = 16
 The number of samples in a vector.
 

Detailed Description

A block of audio data.

This represents a block of audio data received from, or to be send to, an audio device.

The samples in this block are always in native floating point format for easy processing. The samples are stored continues for each channel so that processing can be done at a per-channel basis using SSE instructions, for this reason the samples are aligned and in a multiple of the largest vector instructions.

Member Function Documentation

◆ number_of_samples()

ssize_t tt::audio_block::number_of_samples ( ) const
inlinenoexcept

Number of samples in this audio block.

The number of samples is always a multiple of samples_per_vector.

◆ samples_for_channel()

std::span< float > tt::audio_block::samples_for_channel ( ssize_t index)
inlinenoexcept

Sample data for a channel.

The samples are aligned to samples_per_vector * sizeof(float) bytes.

Returns
The samples for the selected channel. Or empty when this block is silent or corrupt.

Field Documentation

◆ corrupt

bool tt::audio_block::corrupt

The sample data in this block was corrupted Examples of how corruption could happen:

  • CRC error caused by a bad USB/Firewire/Ethernet cable.
  • Sample rate of the word clock or digital audio input and the sample rate of the audio device are too far off.

If true data is nullptr.

◆ device_sample_rate

double tt::audio_block::device_sample_rate

Sample rate to what the audio device is configured to.

◆ number_of_channels

ssize_t tt::audio_block::number_of_channels

Number of channels in this audio block.

◆ number_of_vectors

ssize_t tt::audio_block::number_of_vectors

Number of vector of samples in this audio block.

◆ sample_position

uint64_t tt::audio_block::sample_position

The sample position of the first sample in this block since the start of the capture/render session.

◆ samples

std::span<float> tt::audio_block::samples

Sample data.

The samples are organized non-interleaved; continues samples of a single channel followed by continues samples of the next channel.

The samples are aligned to samples_per_vector * sizeof(float) bytes.

Samples is empty when silent or corrupt.

◆ samples_per_vector

constexpr ssize_t tt::audio_block::samples_per_vector = 16
staticconstexpr

The number of samples in a vector.

◆ silent

bool tt::audio_block::silent

This block of audio is silent.

If true data is nullptr.

◆ timestamp

hires_utc_clock::time_point tt::audio_block::timestamp

Timestamp when the sample first sample in this block was captured at the audio device input or when the first sample in this block will appear at the audio device output.

hires_utc_clock::time_point::max() when the timestamp is invalid.

◆ word_clock_sample_rate

double tt::audio_block::word_clock_sample_rate

Sample rate of the word clock attached to the audio interface For example in some situation on film sets the audio interface sample rate is overdriven to 48048 Hz.


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