diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-09-29 16:15:49 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-09-29 16:15:49 +0200 |
commit | feea4cbb648d67e46b413880ddbf203c88c2a2b1 (patch) | |
tree | 7c3b6bfddfef49e42b7f64256e3c027c43744f8e /src/crepe/Sound.cpp | |
parent | 3cb7227c3c9678141ff74915331b706265c380cb (diff) |
implement debug logging functions and fix sound system segfault
Diffstat (limited to 'src/crepe/Sound.cpp')
-rw-r--r-- | src/crepe/Sound.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/crepe/Sound.cpp b/src/crepe/Sound.cpp index d48393c..94f97af 100644 --- a/src/crepe/Sound.cpp +++ b/src/crepe/Sound.cpp @@ -1,24 +1,29 @@ +#include "util/log.h" + #include "Sound.h" #include "SoundSystem.h" using namespace crepe; -Sound::Sound(std::unique_ptr<api::Resource> res, SoundSystem & system) : system(system) { +Sound::Sound(std::unique_ptr<api::Resource> res) { + dbg_trace(); this->res = std::move(res); } void Sound::play() { - if (this->system.engine.getPause(this->handle)) { + SoundSystem & system = SoundSystem::instance(); + if (system.engine.getPause(this->handle)) { // resume if paused - this->system.engine.setPause(this->handle, false); + system.engine.setPause(this->handle, false); } else { // or start new sound - this->handle = this->system.engine.play(this->sample); + this->handle = system.engine.play(this->sample); } } void Sound::pause() { - if (this->system.engine.getPause(this->handle)) return; - this->system.engine.setPause(this->handle, true); + SoundSystem & system = SoundSystem::instance(); + if (system.engine.getPause(this->handle)) return; + system.engine.setPause(this->handle, true); } |