persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
MusicComponent.hpp
Go to the documentation of this file.
1
6
7#pragma once
8#include "data/audioDb.hpp"
10#include <aegis/component.hpp>
11#include <string>
12
13class MusicComponent : public ae::Component
14{
15 public:
16 static constexpr ae::ComponentTypeID TYPE_ID = static_cast<ae::ComponentTypeID>(ComponentType::Music);
17 void init() override
18 {
19 }
20
24 void destroy() override;
25
26 void update(ae::q20_12_t /*dt*/) override
27 {
28 }
29
30 ae::ComponentTypeID getType() const override
31 {
32 return TYPE_ID;
33 }
34
43 template <typename AudioID> void registerMusic(AudioType type, AudioID audioId)
44 {
45 registerMusic(type, static_cast<int>(audioId));
46 }
47
51 void playMusic();
52
56 void pauseMusic();
57
61 void stopMusic();
62
63 protected:
64 void submitToManager() override
65 {
66 }
67
68 private:
69 AudioManager& am = AudioManager::getInstance();
70
79 void registerMusic(AudioType type, int audioId);
80};
Manager for hardware specific audio functions.
AudioType
Definition audioDb.hpp:6
AudioManager & am
void registerMusic(AudioType type, AudioID audioId)
Wrapper to set up the music to play.
void init() override
static constexpr ae::ComponentTypeID TYPE_ID
void destroy() override
Automatically deregisters the currently registered music, if any.
void playMusic()
Play the registered song if currently paused.
void submitToManager() override
void pauseMusic()
Pause the registered song if currently playing.
ae::ComponentTypeID getType() const override
void stopMusic()
Deregister the currently registered music.
void update(ae::q20_12_t) override