aboutsummaryrefslogtreecommitdiff
path: root/src/crepe/system/AudioSystem.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/crepe/system/AudioSystem.h')
-rw-r--r--src/crepe/system/AudioSystem.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/crepe/system/AudioSystem.h b/src/crepe/system/AudioSystem.h
new file mode 100644
index 0000000..a004c60
--- /dev/null
+++ b/src/crepe/system/AudioSystem.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "../facade/SoundContext.h"
+#include "../facade/Sound.h"
+#include "../api/AudioSource.h"
+
+#include "System.h"
+
+namespace crepe {
+
+class AudioSystem : public System {
+public:
+ using System::System;
+ void update() override;
+
+private:
+ /**
+ * \brief Private data stored by AudioSystem on AudioSource component
+ */
+ struct ComponentPrivate {
+ //! This sample's voice handle
+ Sound::Handle handle;
+
+ /**
+ * \name State diffing variables
+ * \{
+ */
+ typeof(AudioSource::active) last_active;
+ typeof(AudioSource::volume) last_volume;
+ typeof(AudioSource::loop) last_loop;
+ //! \}
+ };
+
+ void update_last(const AudioSource & component, ComponentPrivate & data);
+
+ void diff_update(AudioSource & component, ComponentPrivate & data, Sound & resource);
+
+protected:
+ virtual SoundContext & get_context();
+private:
+ Private context;
+};
+
+} // namespace crepe
+