From bebc6e955114a0907c43df9a9c00f22b1f743446 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 30 Sep 2019 15:29:49 -0400 Subject: created Audio component --- src/audio.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/audio.cpp') diff --git a/src/audio.cpp b/src/audio.cpp index 7dec4c3..975cfce 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -27,12 +27,16 @@ AudioSystem::AudioSystem(void) : AudioSystem::~AudioSystem(void) { // Delete context before device - context.get_deleter()(context.get()); + context.reset(); + device.reset(); } void AudioSystem::configure([[maybe_unused]] entityx::EntityManager& entities, - [[maybe_unused]] entityx::EventManager& events) + entityx::EventManager& events) { + events.subscribe>(*this); + events.subscribe>(*this); + // Access device device.reset(alcOpenDevice(nullptr)); if (!device) @@ -49,3 +53,13 @@ void AudioSystem::update([[maybe_unused]] entityx::EntityManager& entities, [[maybe_unused]] entityx::TimeDelta dt) {} +void AudioSystem::receive(const entityx::ComponentAddedEvent