aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/api
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/api')
-rw-r--r--src/crepe/api/AudioSource.cpp4
-rw-r--r--src/crepe/api/AudioSource.h15
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