Skip to content

Engine → Audio → clip.h

pcm_buffer

Syntax

class CONJURE_API pcm_buffer

Constructors

AccessSignatureDescription
publicpcm_buffer();
publicpcm_buffer( audio_format format, std::vector<f32> samples);Takes ownership of interleaved samples. The frame count is samples.size() / channels; a sample count that is not a multiple of the channel count asserts and drops the trailing partial frame. A channel count of 0 asserts and is treated as 1.
publicpcm_buffer( const pcm_buffer &) = default;
publicpcm_buffer( pcm_buffer &&) noexcept = default;

Destructors

AccessSignatureDescription
public~pcm_buffer();

Variables

AccessNameTypeDefaultDescription
privatemFormataudio_format{}
privatemFrameCountu640
privatemSamplesstd::vector<f32>{}

Functions

Public

duration_seconds

[[nodiscard]] f64 duration_seconds() const noexcept;

frame_count() / sampleRate; 0 for an empty buffer or a zero rate.

format

[[nodiscard]] const audio_format &format() const noexcept;

Sample rate, channel count and sample format of the samples.

frame_count

[[nodiscard]] u64 frame_count() const noexcept;

Number of frames (one sample per channel each).

samples

[[nodiscard]] std::span<const f32> samples() const noexcept;

Every sample, interleaved by channel.

Operator Overloads

Public

operator=

pcm_buffer &operator=(
    const pcm_buffer &) = default;
pcm_buffer &operator=(
    pcm_buffer &&) noexcept = default;