Magnum::Audio::Buffer class

Sample buffer.

Public types

using Format = BufferFormat deprecated
Buffer sample format.

Constructors, destructors, conversion operators

Buffer() explicit
Constructor.
~Buffer()
Destructor.
Buffer(const Buffer&) deleted
Copying is not allowed.
Buffer(Buffer&& other)
Move constructor.

Public functions

auto operator=(const Buffer&) -> Buffer& deleted
Copying is not allowed.
auto operator=(Buffer&& other) -> Buffer&
Move assignment.
auto id() const -> ALuint
OpenAL buffer ID.
auto setData(BufferFormat format, Containers::ArrayView<const void> data, ALsizei frequency) -> Buffer&
Set buffer data.
auto size() const -> Int
Buffer size in bytes.
auto channels() const -> Int
Buffer channel count.
auto bitDepth() const -> Int
Buffer bit depth.
auto sampleCount() const -> Int
Buffer sample count.
auto loopPoints() const -> std::pair<Int, Int>
Get buffer loop points.
auto setLoopPoints(Int loopStart, Int loopEnd) -> Buffer&
Set buffer loop points.
auto setLoopUntil(Int loopEnd) -> Buffer&
Set buffer to loop from the beginning until a certain point.
auto setLoopSince(Int loopStart) -> Buffer&
Set buffer to loop from the a certain point until the end.
auto resetLoopPoints() -> Buffer&
Resets the loop points.

Typedef documentation

typedef BufferFormat Magnum::Audio::Buffer::Format

Buffer sample format.

Function documentation

Magnum::Audio::Buffer::Buffer() explicit

Constructor.

Creates OpenAL buffer object.

Magnum::Audio::Buffer::~Buffer()

Destructor.

Deletes OpenAL buffer object.

Buffer& Magnum::Audio::Buffer::setData(BufferFormat format, Containers::ArrayView<const void> data, ALsizei frequency)

Set buffer data.

Parameters
format Sample format
data Data
frequency Frequency
Returns Reference to self (for method chaining)

Int Magnum::Audio::Buffer::size() const

Buffer size in bytes.

Int Magnum::Audio::Buffer::channels() const

Buffer channel count.

Int Magnum::Audio::Buffer::bitDepth() const

Buffer bit depth.

Int Magnum::Audio::Buffer::sampleCount() const

Buffer sample count.

Calculated from size(), channels() and bitDepth().

std::pair<Int, Int> Magnum::Audio::Buffer::loopPoints() const

Get buffer loop points.

Returns A std::pair containing the start and end loop points

Buffer& Magnum::Audio::Buffer::setLoopPoints(Int loopStart, Int loopEnd)

Set buffer loop points.

Parameters
loopStart The loop's start point in samples
loopEnd The loop's end point in samples
Returns Reference to self (for method chaining)

The buffer needs to not be attached to a source for this operation to succeed.

Buffer& Magnum::Audio::Buffer::setLoopUntil(Int loopEnd)

Set buffer to loop from the beginning until a certain point.

Parameters
loopEnd The loop's end point in samples
Returns Reference to self (for method chaining)

Equivalent to calling setLoopPoints() with loopStart equal to 0.

Buffer& Magnum::Audio::Buffer::setLoopSince(Int loopStart)

Set buffer to loop from the a certain point until the end.

Parameters
loopStart The loop's start point in samples
Returns Reference to self (for method chaining)

Equivalent to calling setLoopPoints() with loopEnd equal to INT_MAX.

Buffer& Magnum::Audio::Buffer::resetLoopPoints()

Resets the loop points.

Returns Reference to self (for method chaining)

Equivalent to calling setLoopPoints() with loopStart equal to 0, and loopEnd equal to INT_MAX.