utility 2026.1.9
A comprehensive C++ utilities library tailored for the development of modern desktop and extended reality (XR) applications.
Loading...
Searching...
No Matches
utility::sound::AudioBuffer Class Reference

Wrapper around an OpenAL audio buffer. More...

#include <headers/utility/sound/audio_buffer.hpp>

Public Member Functions

 AudioBuffer ()
 Creates an empty audio buffer.
 
 ~AudioBuffer ()
 Destroys the audio buffer and releases its OpenAL resource.
 
ALuint bufferID () const
 Retrieves the underlying OpenAL buffer identifier.
 
void upload (const DecodedAudio &decodedAudio)
 Uploads decoded audio data to the OpenAL buffer.
 

Detailed Description

Wrapper around an OpenAL audio buffer.

AudioBuffer manages the lifetime of an OpenAL buffer object and provides a simple interface for uploading decoded PCM audio data.

The buffer is automatically released when the instance is destroyed.

Definition at line 39 of file audio_buffer.hpp.

Constructor & Destructor Documentation

◆ AudioBuffer()

utility::sound::AudioBuffer::AudioBuffer ( )

Creates an empty audio buffer.

No OpenAL resource is allocated until upload() is called.

Definition at line 24 of file audio_buffer.cpp.

◆ ~AudioBuffer()

utility::sound::AudioBuffer::~AudioBuffer ( )

Destroys the audio buffer and releases its OpenAL resource.

Definition at line 28 of file audio_buffer.cpp.

Member Function Documentation

◆ bufferID()

ALuint utility::sound::AudioBuffer::bufferID ( ) const

Retrieves the underlying OpenAL buffer identifier.

Returns
The OpenAL buffer handle, or 0 if no buffer has been created.

Definition at line 33 of file audio_buffer.cpp.

◆ upload()

void utility::sound::AudioBuffer::upload ( const DecodedAudio decodedAudio)

Uploads decoded audio data to the OpenAL buffer.

If a buffer already exists, it is deleted and recreated before uploading the new data.

Parameters
decodedAudioDecoded PCM audio data and associated format information.

Definition at line 38 of file audio_buffer.cpp.


The documentation for this class was generated from the following files: