aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/facade/SoundContext.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-02 16:13:08 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-02 16:13:08 +0100
commit7a8657dfe019104aced61a5b63e63f61ad919f7a (patch)
treefd8e7aa148aac0a4f50fca8fe05e5016dfd16e47 /src/crepe/facade/SoundContext.cpp
parentb8194e02679dc88f5c0a240da83a4700ec5200cf (diff)
remove `Private`
Diffstat (limited to 'src/crepe/facade/SoundContext.cpp')
-rw-r--r--src/crepe/facade/SoundContext.cpp23
1 files changed, 14 insertions, 9 deletions
diff --git a/src/crepe/facade/SoundContext.cpp b/src/crepe/facade/SoundContext.cpp
index 8bd7e74..d18afc6 100644
--- a/src/crepe/facade/SoundContext.cpp
+++ b/src/crepe/facade/SoundContext.cpp
@@ -15,18 +15,23 @@ SoundContext::~SoundContext() {
this->engine.deinit();
}
-Sound::Handle SoundContext::play(Sound & resource) {
- return {
- .handle = this->engine.play(resource.sample, 1.0f),
- };
+SoundHandle SoundContext::play(Sound & resource) {
+ SoLoud::handle real_handle = this->engine.play(resource.sample, 1.0f);
+ SoundHandle handle = this->next_handle;
+ this->registry[handle] = real_handle;
+ this->next_handle++;
+ return handle;
}
-void SoundContext::stop(Sound::Handle & handle) { this->engine.stop(handle.handle); }
+void SoundContext::stop(const SoundHandle & handle) {
+ this->engine.stop(this->registry[handle]);
+}
-void SoundContext::set_volume(Sound::Handle & handle, float volume) {
- this->engine.setVolume(handle.handle, volume);
+void SoundContext::set_volume(const SoundHandle & handle, float volume) {
+ this->engine.setVolume(this->registry[handle], volume);
}
-void SoundContext::set_loop(Sound::Handle & handle, bool loop) {
- this->engine.setLooping(handle.handle, loop);
+void SoundContext::set_loop(const SoundHandle & handle, bool loop) {
+ this->engine.setLooping(this->registry[handle], loop);
}
+