R-Type 0.1
Loading...
Searching...
No Matches
AudioSystem.hpp
1#pragma once
2
3#include "Logger/Logger.hpp"
4#include "components/SoundRequest.hpp"
5#include "systems/AudioManagerConcept.hpp"
6#include <ISystem.hpp>
7
8namespace rtk::systems {
18template <ecs::concepts::IsAudioManager AudioType>
19class AudioSystem final : public rtk::ecs::ISystem {
20private:
21 AudioType &_audioManager;
22
23public:
28 AudioSystem(AudioType &audioManager) : _audioManager(audioManager) {}
29 ~AudioSystem() override = default;
30
34 void onStart(rtk::ecs::Registry &) override { LOG_INFO("Load Audio System"); }
35
39 void update(rtk::ecs::Registry &reg, float) override {
40 _audioManager.update();
41 }
42
46 void onStop(rtk::ecs::Registry &) override {}
47};
48
50} // namespace rtk::systems
Ticks the audio backend once per frame.
Definition AudioSystem.hpp:19
void update(rtk::ecs::Registry &reg, float) override
Calls update() on the backend.
Definition AudioSystem.hpp:39
AudioSystem(AudioType &audioManager)
Creates the system.
Definition AudioSystem.hpp:28
void onStop(rtk::ecs::Registry &) override
Does nothing.
Definition AudioSystem.hpp:46
void onStart(rtk::ecs::Registry &) override
Logs that the system is loaded.
Definition AudioSystem.hpp:34