aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/Sound.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/Sound.cpp')
-rw-r--r--src/crepe/Sound.cpp17
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);
}