Struct RawAudio

Struct Documentation

struct RawAudio

A single block of an audio bitstream.

Public Functions

FoxgloveError encode(uint8_t *ptr, size_t len, size_t *encoded_len)

Encoded the RawAudio as protobuf to the provided buffer.

On success, writes the serialized length to *encoded_len. If the provided buffer has insufficient capacity, writes the required capacity to *encoded_len and returns FoxgloveError::BufferTooShort. If the message cannot be encoded, writes the reason to stderr and returns FoxgloveError::EncodeError.

Parameters:
  • ptr – the destination buffer. must point to at least len valid bytes.

  • len – the length of the destination buffer.

  • encoded_len – where the serialized length or required capacity will be written to.

Public Members

std::optional<Timestamp> timestamp

Timestamp of the start of the audio block.

std::vector<std::byte> data

Audio data. The samples in the data must be interleaved and little-endian.

std::string format

Audio format. Only ‘pcm-s16’ is currently supported.

uint32_t sample_rate = 0

Sample rate in Hz.

uint32_t number_of_channels = 0

Number of channels in the audio block.

Public Static Functions

static Schema schema()

Get the RawAudio schema.

The schema data returned is statically allocated.