Owns the miniaudio engine and provides the playback API.
More...
#include <AudioEngine.h>
Owns the miniaudio engine and provides the playback API.
Initialized once during engine startup. Audio assets are registered via onAudioLoaded() and can then be played by path.
Definition at line 32 of file AudioEngine.h.
◆ AudioEngine() [1/2]
| Engine::Core::AudioEngine::AudioEngine |
( |
| ) |
|
◆ ~AudioEngine()
| Engine::Core::AudioEngine::~AudioEngine |
( |
| ) |
|
◆ AudioEngine() [2/2]
| Engine::Core::AudioEngine::AudioEngine |
( |
const AudioEngine & | | ) |
|
|
delete |
◆ cleanup()
| void Engine::Core::AudioEngine::cleanup |
( |
| ) |
|
Shut down the audio engine and free all resources.
◆ cleanupFinishedSounds()
| void Engine::Core::AudioEngine::cleanupFinishedSounds |
( |
| ) |
|
|
private |
◆ init()
| bool Engine::Core::AudioEngine::init |
( |
| ) |
|
Initialize the miniaudio engine with AudioConfig settings.
- Returns
- true on success
◆ isInitialized()
| bool Engine::Core::AudioEngine::isInitialized |
( |
| ) |
const |
|
inlinenodiscard |
◆ isPlaying()
| bool Engine::Core::AudioEngine::isPlaying |
( |
AudioHandle | handle | ) |
const |
|
nodiscard |
Check if a sound is currently playing.
- Parameters
-
| handle | Handle returned by play() |
- Returns
- true if the sound is still playing
◆ onAudioLoaded()
| void Engine::Core::AudioEngine::onAudioLoaded |
( |
Assets::Audio * | asset, |
|
|
const std::filesystem::path & | path ) |
Called by AudioAssetPipeline when an asset finishes loading. Registers the asset for playback.
- Parameters
-
| asset | The loaded audio asset |
| path | The asset path (used as lookup key) |
◆ operator=()
◆ play()
| AudioHandle Engine::Core::AudioEngine::play |
( |
const std::filesystem::path & | path, |
|
|
float | volume = 1.0f, |
|
|
bool | loop = false ) |
Play a loaded audio clip.
- Parameters
-
| path | Asset path of the clip to play |
| volume | Volume multiplier (0.0 - 1.0) |
| loop | Whether to loop the sound |
- Returns
- Handle to the playing sound, or INVALID_AUDIO_HANDLE on failure
◆ setMasterVolume()
| void Engine::Core::AudioEngine::setMasterVolume |
( |
float | volume | ) |
|
Set the master volume.
- Parameters
-
| volume | Volume multiplier (0.0 - 1.0) |
◆ stop()
| void Engine::Core::AudioEngine::stop |
( |
AudioHandle | handle | ) |
|
Stop a playing sound.
- Parameters
-
| handle | Handle returned by play() |
◆ stopAll()
| void Engine::Core::AudioEngine::stopAll |
( |
| ) |
|
Stop all currently playing sounds.
◆ engine_
| ma_engine* Engine::Core::AudioEngine::engine_ = nullptr |
|
private |
◆ initialized_
| bool Engine::Core::AudioEngine::initialized_ = false |
|
private |
◆ nextHandle_
◆ playingSounds_
◆ registeredAudio_
| std::unordered_map<std::string, RegisteredAudio> Engine::Core::AudioEngine::registeredAudio_ |
|
private |
The documentation for this class was generated from the following file:
- /home/magerbeton/Documents/gl3-vulkan/Engine/include/Engine/Audio/AudioEngine.h