Magnum::Audio::Buffer class

Sample buffer.

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 new in 2019.10
Buffer size in bytes.
auto channels() const -> Int new in 2019.10
Buffer channel count.
auto frequency() const -> Int new in 2020.06
Buffer frequency.
auto bitDepth() const -> Int new in 2019.10
Buffer bit depth.
auto sampleCount() const -> Int new in 2019.10
Buffer sample count.
auto loopPoints() const -> std::pair<Int, Int> new in 2019.10
Get buffer loop points.
auto setLoopPoints(Int loopStart, Int loopEnd) -> Buffer& new in 2019.10
Set buffer loop points.
auto setLoopUntil(Int loopEnd) -> Buffer& new in 2019.10
Set buffer to loop from the beginning until a certain point.
auto setLoopSince(Int loopStart) -> Buffer& new in 2019.10
Set buffer to loop from the a certain point until the end.
auto resetLoopPoints() -> Buffer& new in 2019.10
Resets the loop points.

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 new in 2019.10

Buffer size in bytes.

Int Magnum::Audio::Buffer::channels() const new in 2019.10

Buffer channel count.

Int Magnum::Audio::Buffer::frequency() const new in 2020.06

Buffer frequency.

Int Magnum::Audio::Buffer::bitDepth() const new in 2019.10

Buffer bit depth.

Int Magnum::Audio::Buffer::sampleCount() const new in 2019.10

Buffer sample count.

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

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

Get buffer loop points.

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

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

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) new in 2019.10

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) new in 2019.10

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() new in 2019.10

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.