pcm_buffer
| Type | Class |
| Namespace | conjure::audio |
| Include File Path | engine/include/conjure/audio/clip.h |
| Source File Path | engine/src/audio/clip.cpp |
| API ↗ | Clips and decoding |
Syntax
Constructors
| Access | Signature | Description |
|---|---|---|
| public | pcm_buffer(); | |
| public | pcm_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. |
| public | pcm_buffer(
const pcm_buffer &) = default; | |
| public | pcm_buffer(
pcm_buffer &&) noexcept = default; |
Destructors
| Access | Signature | Description |
|---|---|---|
| public | ~pcm_buffer(); |
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| private | mFormat | audio_format | {} | |
| private | mFrameCount | u64 | 0 | |
| private | mSamples | std::vector<f32> | {} |
Functions
Public
duration_seconds
duration_seconds[[nodiscard]] f64 duration_seconds() const noexcept;frame_count() / sampleRate; 0 for an empty buffer or a zero rate.
format
format[[nodiscard]] const audio_format &format() const noexcept;Sample rate, channel count and sample format of the samples.
frame_count
frame_count[[nodiscard]] u64 frame_count() const noexcept;Number of frames (one sample per channel each).
samples
samples[[nodiscard]] std::span<const f32> samples() const noexcept;Every sample, interleaved by channel.
Operator Overloads
Public
operator=
operator=pcm_buffer &operator=(
const pcm_buffer &) = default;pcm_buffer &operator=(
pcm_buffer &&) noexcept = default;