diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-30 15:08:57 +0100 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-11-30 15:08:57 +0100 |
commit | 30e2b2b0cbb503d83a087d8d326940c3c4bc8fff (patch) | |
tree | e7332b214587a336a130b01e83ad368388fca516 /src/crepe/api | |
parent | e4be73051a68b552c44280bbe9836dd4f02972d8 (diff) |
fix audio system implementation
Diffstat (limited to 'src/crepe/api')
-rw-r--r-- | src/crepe/api/AudioSource.cpp | 4 | ||||
-rw-r--r-- | src/crepe/api/AudioSource.h | 15 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/crepe/api/AudioSource.cpp b/src/crepe/api/AudioSource.cpp index c646aeb..cc70801 100644 --- a/src/crepe/api/AudioSource.cpp +++ b/src/crepe/api/AudioSource.cpp @@ -10,10 +10,10 @@ AudioSource::AudioSource(game_object_id_t id, const Asset & src) : void AudioSource::play(bool looping) { this->loop = looping; - this->playing = true; + this->oneshot_play = true; } void AudioSource::stop() { - this->playing = false; + this->oneshot_stop = true; } diff --git a/src/crepe/api/AudioSource.h b/src/crepe/api/AudioSource.h index 8dc1645..1899c22 100644 --- a/src/crepe/api/AudioSource.h +++ b/src/crepe/api/AudioSource.h @@ -42,8 +42,19 @@ private: //! This audio source's clip const Asset source; - //! If this source is playing audio - bool playing = false; + /** + * \name One-shot state variables + * + * These variables trigger function calls when set to true, and are unconditionally reset on + * every system update. + * + * \{ + */ + //! Play this sample + bool oneshot_play = false; + //! Stop this sample + bool oneshot_stop = false; + //! \} private: //! AudioSystem::ComponentPrivate |