HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
Data Fields
hi::v1::audio_block Class Reference

#include <hikogui/audio/audio_block.hpp>

Data Fields

float ** samples
 A list of pointers to non-interleaved sample buffers.
 
std::size_t num_samples
 Number of samples for each channel in samples.
 
std::size_t num_channels
 Number of channels in samples.
 
int sample_rate
 The sample rate this block was taken at.
 
int64_t sample_count
 The sample count value for the first sample in the sample buffers.
 
utc_nanoseconds time_stamp
 Time point when the sample was at the input or will be at the output of the audio interface.
 
audio_block_state state
 The state of the audio block.
 

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.

Field Documentation

◆ num_channels

std::size_t hi::v1::audio_block::num_channels

Number of channels in samples.

◆ num_samples

std::size_t hi::v1::audio_block::num_samples

Number of samples for each channel in samples.

◆ sample_count

int64_t hi::v1::audio_block::sample_count

The sample count value for the first sample in the sample buffers.

◆ sample_rate

int hi::v1::audio_block::sample_rate

The sample rate this block was taken at.

This is the word-clock rate, not the sample rate the device was configured as.

◆ samples

float** hi::v1::audio_block::samples

A list of pointers to non-interleaved sample buffers.

It is undefined behavour to modify the samples on input.

Each of the sample buffers is aligned to and a multiple of 4096 bytes in size which will allow you to over-read or over-write with vector instructions beyond the num_samples of samples.

The sample buffers are NOT pre-cleared during recording.

◆ state

audio_block_state hi::v1::audio_block::state

The state of the audio block.

  • normal: The sample buffers contain normalized -1.0 to 1.0 sample data.
  • silent: The sample buffers contain 0.0.
  • corrupt: The sample buffers contain NaN.

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.

When the state is corrupt; DO NOT READ THE SAMPLE_BUFFER.

◆ time_stamp

utc_nanoseconds hi::v1::audio_block::time_stamp

Time point when the sample was at the input or will be at the output of the audio interface.


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