Engine::Audio::AudioBuffer #
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:
- Some random note
- Some second random 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.
Public Classes #
Name | |
---|---|
struct | TypedAudioData Use this to populate the buffer. |
Public Types #
Member Types | Definition |
---|---|
Type | Different type of audio formats. (enum) |
AudioData | [Utils::ArrayView](/doxybook/hugo-book/classes/classengine_1_1utils_1_1arrayview/)< T > (using) |
AudioData8U | [AudioData](/doxybook/hugo-book/classes/classengine_1_1audio_1_1audiobuffer/#using-audiodata)< uint8_t > (typedef) |
Public Functions #
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) |
Protected Functions #
Member Protected Functions | Description |
---|---|
getData | (function) |
Protected Attributes #
Member Protected Attributes | Description |
---|---|
playing | bool (protected variable) |
Friends #
Friends | Description |
---|---|
AudioManager | (public friend class) |
Audio::doSomething | (public friend void) |
Public Types #
enum Type #
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.
using AudioData #
Defined in header <src/Audio/AudioBuffer.hpp>
template <typename T>
using AudioData = Utils::ArrayView< T >;
typedef AudioData8U #
Defined in header <src/Audio/AudioBuffer.hpp>
typedef AudioData<uint8_t> Engine::Audio::AudioBuffer::AudioData8U;
Public Functions #
function AudioBuffer #
Defined in header <src/Audio/AudioBuffer.hpp>
explicit AudioBuffer(const std::string & filename);
Constructor for Audio::AudioBuffer.
Exception Safety
Basic exception guarantee.
function ~AudioBuffer #
Defined in header <src/Audio/AudioBuffer.hpp>
virtual ~AudioBuffer() = default;
Audio::AudioBuffer destructor.
Exception Safety
Basic exception guarantee.
function play #
Defined in header <src/Audio/AudioBuffer.hpp>
void
play(AudioManager & manager) const;
Play this buffer.
Parameters
- manager - Which manager to play the sound with
Exception Safety
Basic exception guarantee.
function stop #
Defined in header <src/Audio/AudioBuffer.hpp>
void
stop(AudioManager & manager) const;
Stop this buffer playing.
Parameters
- manager - Which manager to stop the sound with
Exception Safety
Basic exception guarantee.
function loop #
Defined in header <src/Audio/AudioBuffer.hpp>
void
loop(AudioManager & manager) const;
Loop this buffer forever.
Parameters
- manager - Which manager to loop the sound with
Notes
This will loop forever until you call stop
Exception Safety
Basic exception guarantee.
function setData #
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.
function setDataMultiple #
Defined in header <src/Audio/AudioBuffer.hpp>
template <size_t Size>
void
setDataMultiple(const TypedAudioData data[Size]);
Exception Safety
Basic exception guarantee.
function setCallback #
Defined in header <src/Audio/AudioBuffer.hpp>
void
setCallback(Callback callback);
Set the callback function.
Parameters
- callback - The callback function pointer
Exception Safety
Basic exception guarantee.
See Also
function setCallback2 #
Defined in header <src/Audio/AudioBuffer.hpp>
void
setCallback2(Callback2 callback, void * user);
Set the callback function.
Parameters
- callback - The callback function pointer
Exception Safety
Basic exception guarantee.
See Also
Protected Functions #
function getData #
Defined in header <src/Audio/AudioBuffer.hpp>
float *
getData();
Exception Safety
Basic exception guarantee.
Protected Attributes #
variable playing #
Defined in header <src/Audio/AudioBuffer.hpp>
bool playing {false};
Friends #
friend AudioManager #
Defined in header <src/Audio/AudioBuffer.hpp>
friend
class AudioManager(AudioManager);
friend Audio::doSomething #
Defined in header <src/Audio/AudioBuffer.hpp>
friend
void Audio::doSomething(AudioBuffer & buffer);
Updated on 2023-04-03