Monad Engine da02fba2
> Undercity Codex_
Loading...
Searching...
No Matches
AudioManager.cpp
Go to the documentation of this file.
1#include "audio/AudioManager.h"
2#define MINIAUDIO_IMPLEMENTATION
3#include <miniaudio.h>
4
5namespace mnd
6{
8{
9 m_engine = std::make_unique<ma_engine>();
10}
11
13{
14 if (m_engine)
15 {
16 ma_engine_uninit(m_engine.get());
17 }
18}
19
21{
22 auto result = ma_engine_init(nullptr, m_engine.get());
23 return result == MA_SUCCESS;
24}
25
27{
28 return m_engine.get();
29}
30
31void AudioManager::SetListenerPosition(const glm::vec3 &pos)
32{
33 if (m_engine)
34 {
35 ma_engine_listener_set_position(m_engine.get(), 0, pos.x, pos.y, pos.z);
36 }
37}
38} // namespace mnd
39
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()).