diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 16:28:37 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-11 16:28:37 +0100 |
commit | a108f7360e03cc7826ad4ed0cee464b1196fa456 (patch) | |
tree | 2de89843620b8ec65b99a56bd3c2428bef733852 /src/crepe/system/AudioSystem.cpp | |
parent | d80c98ee03e59e0c38e025a7fe83ab4c39115fb8 (diff) | |
parent | 78c4a8772526f40c531b5402b56932b0a41e22e8 (diff) |
Merge branch 'master' of https://github.com/lonkaars/crepe into wouter/text-component
Diffstat (limited to 'src/crepe/system/AudioSystem.cpp')
-rw-r--r-- | src/crepe/system/AudioSystem.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/crepe/system/AudioSystem.cpp b/src/crepe/system/AudioSystem.cpp index c1cde8b..b1aa0f8 100644 --- a/src/crepe/system/AudioSystem.cpp +++ b/src/crepe/system/AudioSystem.cpp @@ -26,12 +26,11 @@ void AudioSystem::diff_update(AudioSource & component, Sound & resource) { SoundContext & context = this->get_context(); if (component.active != component.last_active) { - if (component.active) { - component.oneshot_play = component.play_on_awake; - } else { + if (!component.active) { context.stop(component.voice); return; } + if (component.play_on_awake) component.oneshot_play = true; } if (!component.active) return; @@ -58,8 +57,6 @@ void AudioSystem::update_last(AudioSource & component) { } SoundContext & AudioSystem::get_context() { - if (this->context == nullptr) - this->context = make_unique<SoundContext>(); + if (this->context == nullptr) this->context = make_unique<SoundContext>(); return *this->context.get(); } - |