Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
AudioManager.h
Go to the documentation of this file.
1/**
2 * @file AudioManager.h
3 * @ingroup mnd_audio
4 * @brief Owns the global miniaudio engine and 3D listener position.
5 *
6 * One instance lives inside mnd::Engine; reach it with
7 * `Engine::GetInstance().GetAudio()`. Every mnd::Audio clip plays
8 * through the underlying `ma_engine` it returns. Update the listener
9 * once per frame (typically from mnd::AudioListenerComponent::Update)
10 * so 3D-positioned sounds pan and attenuate correctly.
11 */
12
13#pragma once
14
15#include <memory>
16
17#include "Common.h"
18#include "Types.h"
19
20struct ma_engine;
21
22namespace mnd
23{
24/**
25 * @ingroup mnd_audio
26 * @brief Global audio backend wrapper.
27 */
29{
30public:
33
34 /**
35 * @brief Initialise the underlying miniaudio engine.
36 * @return true if the audio device opened successfully.
37 */
38 bool Init();
39
40 /// Underlying miniaudio engine handle (passed to clip Play()).
41 ma_engine *GetEngine();
42
43 /// Move the 3D listener; affects panning/attenuation of every clip.
44 void SetListenerPosition(const vec3 &pos);
45
46private:
47 std::unique_ptr<ma_engine> m_engine;
48};
49} // namespace mnd
Engine-wide primitive type aliases and GLM math imports.
Global audio backend wrapper.
bool Init()
Initialise the underlying miniaudio engine.
void SetListenerPosition(const vec3 &pos)
Move the 3D listener; affects panning/attenuation of every clip.
ma_engine * GetEngine()
Underlying miniaudio engine handle (passed to clip Play()).
glm::vec3 vec3
3-component float vector (e.g. world position, RGB colour, normals).
Definition Types.h:51