Engine::Audio::AudioBuffer Class Reference Module: An example game engine / Audio buffers and devices
A simple audio buffer to hold PCM samples More…
#include <AudioBuffer.hpp>
Name | |
---|---|
struct | TypedAudioData Use this to populate the buffer. |
Name | |
---|---|
enum class | Type { UNKNOWN = 0, INT_8 = 1 « 1, INT_16 = 1 « 2, INT_24 = 1 « 3, INT_32 = 1 « 4, FLOAT_32 = 1 « 5}Different type of audio formats. |
template <typename T > using Utils::ArrayView< T > | AudioData |
typedef AudioData< uint8_t > | AudioData8U |
Name | |
---|---|
AudioBuffer(const std::string & filename)Constructor for Audio::AudioBuffer. | |
virtual | ~AudioBuffer() =defaultAudio::AudioBuffer destructor. |
void | play(AudioManager & manager) constPlay this buffer. |
void | stop(AudioManager & manager) constStop this buffer playing. |
void | loop(AudioManager & manager) constLoop this buffer forever. |
void | setData(const TypedAudioData & data) |
template <size_t Size> void | setDataMultiple(const TypedAudioData data[Size]) |
void | setData(const TypedAudioData data[], size_t size)Some deprecated function. |
void | setCallback(Callback callback)Set the callback function. |
void | setCallback2(Callback2 callback, void * user)Set the callback function. |
Name | |
---|---|
float * | getData() |
Name | |
---|---|
bool | playing |
Name | |
---|---|
class | AudioManager |
void | Audio::doSomething(AudioBuffer & buffer) |
class Engine::Audio::AudioBuffer;
A simple audio buffer to hold PCM samples
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.
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;
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.
template <typename T >
using Engine::Audio::AudioBuffer::AudioData = Utils::ArrayView<T>;
typedef AudioData<uint8_t> Engine::Audio::AudioBuffer::AudioData8U;
explicit AudioBuffer(
const std::string & filename
)
Constructor for Audio::AudioBuffer.
virtual ~AudioBuffer() =default
Audio::AudioBuffer destructor.
void play(
AudioManager & manager
) const
Play this buffer.
Parameters:
Exceptions:
void stop(
AudioManager & manager
) const
Stop this buffer playing.
Parameters:
Exceptions:
void loop(
AudioManager & manager
) const
Loop this buffer forever.
Parameters:
Exceptions:
Note: This will loop forever until you call stop
void setData(
const TypedAudioData & data
)
template <size_t Size>
inline void setDataMultiple(
const TypedAudioData data[Size]
)
void setData(
const TypedAudioData data[],
size_t size
)
Some deprecated function.
Deprecated:
Use the AudioBuffer::setDataMultiple instead
void setCallback(
Callback callback
)
Set the callback function.
Parameters:
Deprecated:
Use the AudioBuffer::setCallback2 instead
See: Audio::Callback
void setCallback2(
Callback2 callback,
void * user
)
Set the callback function.
Parameters:
See: Audio::Callback
float * getData()
bool playing {false};
friend class AudioManager;
friend void Audio::doSomething(
AudioBuffer & buffer
);
Updated on 2022-10-19 at 22:22:02 +0000