aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/system')
-rw-r--r--src/crepe/system/AudioSystem.cpp4
-rw-r--r--src/crepe/system/AudioSystem.h29
2 files changed, 28 insertions, 5 deletions
diff --git a/src/crepe/system/AudioSystem.cpp b/src/crepe/system/AudioSystem.cpp
index 0696b34..26913c0 100644
--- a/src/crepe/system/AudioSystem.cpp
+++ b/src/crepe/system/AudioSystem.cpp
@@ -52,10 +52,10 @@ void AudioSystem::diff_update(AudioSource & component, ComponentPrivate & data,
component.oneshot_stop = false;
}
if (component.volume != data.last_volume) {
- context.set_volume(resource, data.handle, component.volume);
+ context.set_volume(data.handle, component.volume);
}
if (component.loop != data.last_loop) {
- context.set_loop(resource, data.handle, component.loop);
+ context.set_loop(data.handle, component.loop);
}
}
diff --git a/src/crepe/system/AudioSystem.h b/src/crepe/system/AudioSystem.h
index c941470..4d21883 100644
--- a/src/crepe/system/AudioSystem.h
+++ b/src/crepe/system/AudioSystem.h
@@ -14,9 +14,7 @@ public:
void update() override;
private:
- /**
- * \brief Private data stored by AudioSystem on AudioSource component
- */
+ //! Private data stored by AudioSystem on AudioSource component
struct ComponentPrivate {
//! This sample's voice handle
Sound::Handle handle;
@@ -31,14 +29,39 @@ private:
//! \}
};
+ /**
+ * \brief Update `last_*` members of \c data
+ *
+ * Copies all component properties stored for comparison between AudioSystem::update() calls
+ *
+ * \param component Source properties
+ * \param data Destination properties
+ */
void update_last(const AudioSource & component, ComponentPrivate & data);
+ /**
+ * \brief Compare update component
+ *
+ * Compares properties of \c component and \c data, and calls SoundContext functions where
+ * applicable.
+ *
+ * \param component AudioSource component to update
+ * \param data AudioSource's private data
+ * \param resource Sound instance for AudioSource's Asset
+ */
void diff_update(AudioSource & component, ComponentPrivate & data, Sound & resource);
protected:
+ /**
+ * \brief Get SoundContext
+ *
+ * SoundContext is retrieved through this function instead of being a direct member of
+ * AudioSystem to aid with testability.
+ */
virtual SoundContext & get_context();
private:
+ //! Actually stores SoundContext if the base AudioSystem::get_context implementation is used
Private context;
};