Engine::Audio::AudioBuffer Class Reference An example game engine / Audio buffers and devices / AudioBuffer
Defined in header <src/Audio/AudioBuffer.hpp>
class AudioBuffer;
A simple audio buffer to hold PCM samples
Description
Lorem ipsum donor
// Some random code
using namespace Engine;
Audio::AudioBuffer buffer("path/to/file.wav");
buffer.play(audioManager);
More detailed description!
// Another code sample
#include <iostream>
using namespace Engine;
Audio::AudioBuffer buffer("path/to/file.wav");
std::cout << buffer.play(...) << std::endl;
Author: Matus Novak
Date: 2017-2019
Note:
Bug: Some random bug
Some other random bug
Test: Some random test description
Todo: Some random todo
Warning: Some random warning
Precondition: First initialize the system.
| Name | |
|---|---|
| struct | TypedAudioData Use this to populate the buffer. |
| Member Types | Definition |
|---|---|
| Type | Different type of audio formats. (enum) |
| AudioData | [Utils::ArrayView](/doxybook/hugo-learn/classes/classengine_1_1utils_1_1arrayview/)< T > (using) |
| AudioData8U | [AudioData](/doxybook/hugo-learn/classes/classengine_1_1audio_1_1audiobuffer/#using-audiodata)< uint8_t > (typedef) |
| Member Functions | Description |
|---|---|
| (constructor) | Constructor for Audio::AudioBuffer. (function) |
| (destructor) = default | Audio::AudioBuffer destructor. (virtual function) |
| play const | Play this buffer. (function) |
| stop const | Stop this buffer playing. (function) |
| loop const | Loop this buffer forever. (function) |
| setData | (function) |
| setDataMultiple | (function template) |
| setCallback | Set the callback function. (function) |
| setCallback2 | Set the callback function. (function) |
| Member Protected Functions | Description |
|---|---|
| getData | (function) |
| Member Protected Attributes | Description |
|---|---|
| playing | bool (protected variable) |
| Friends | Description |
|---|---|
| AudioManager | (public friend class) |
| Audio::doSomething | (public friend void) |
Defined in header <src/Audio/AudioBuffer.hpp>
enum class Type;
| Enumerator | Value | Description |
|---|---|---|
| UNKNOWN | 0 | Dont use this |
| INT_8 | 1 « 1 | 8-bit signed integer |
| INT_16 | 1 « 2 | 16-bit signed integer |
| INT_24 | 1 « 3 | 24-bit signed integer |
| INT_32 | 1 « 4 | 32-bit signed integer |
| FLOAT_32 | 1 « 5 | 32-bit float |
Different type of audio formats.
Defined in header <src/Audio/AudioBuffer.hpp>
template <typename T>
using AudioData = Utils::ArrayView< T >;
Defined in header <src/Audio/AudioBuffer.hpp>
typedef AudioData<uint8_t> Engine::Audio::AudioBuffer::AudioData8U;
Defined in header <src/Audio/AudioBuffer.hpp>
explicit AudioBuffer(const std::string & filename);
Constructor for Audio::AudioBuffer.
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
virtual ~AudioBuffer() = default;
Audio::AudioBuffer destructor.
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
void
play(AudioManager & manager) const;
Play this buffer.
Parameters
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
void
stop(AudioManager & manager) const;
Stop this buffer playing.
Parameters
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
void
loop(AudioManager & manager) const;
Loop this buffer forever.
Parameters
Notes
This will loop forever until you call stop
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
void
setData(const TypedAudioData & data);
void
setData(const TypedAudioData data[], size_t size);
Some deprecated function.
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
template <size_t Size>
void
setDataMultiple(const TypedAudioData data[Size]);
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
void
setCallback(Callback callback);
Set the callback function.
Parameters
Exception Safety
Basic exception guarantee.
See Also
Defined in header <src/Audio/AudioBuffer.hpp>
void
setCallback2(Callback2 callback, void * user);
Set the callback function.
Parameters
Exception Safety
Basic exception guarantee.
See Also
Defined in header <src/Audio/AudioBuffer.hpp>
float *
getData();
Exception Safety
Basic exception guarantee.
Defined in header <src/Audio/AudioBuffer.hpp>
bool playing {false};
Defined in header <src/Audio/AudioBuffer.hpp>
friend
class AudioManager(AudioManager);
Defined in header <src/Audio/AudioBuffer.hpp>
friend
void Audio::doSomething(AudioBuffer & buffer);
Updated on 2023-04-03