NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_SoundActor.h
1#ifndef NW4R_SND_SOUND_ACTOR_H
2#define NW4R_SND_SOUND_ACTOR_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include <types.h>
9
10#include "nw4r/snd/snd_BasicSound.h"
11#include "nw4r/snd/snd_ExternalSoundPlayer.h"
12#include "nw4r/snd/snd_SoundStartable.h"
13
14/*******************************************************************************
15 * types
16 */
17
18// forward declarations
19namespace nw4r { namespace snd { class SoundArchivePlayer; }}
20
21/*******************************************************************************
22 * classes and functions
23 */
24
25namespace nw4r { namespace snd
26{
27 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x278fa
28 class SoundActor : public SoundStartable
29 {
30 // methods
31 public:
32 // cdtors
33 SoundActor(SoundArchivePlayer &player);
34 virtual ~SoundActor();
35
36 virtual ulong detail_ConvertLabelStringToSoundId(const char* label) override;
37 virtual StartResult detail_SetupSound(SoundHandle *pHandle, ulong soundId, bool holdFlag, const StartInfo *pStartInfo) override;
38
39
40 virtual StartResult SetupSound(SoundHandle *pHandle, ulong soundId, const StartInfo *pStartInfo, void*);
41 virtual StartResult detail_SetupSoundWithAmbientInfo(SoundHandle*, ulong, const StartInfo*, detail::BasicSound::AmbientInfo*, void*);
42
43
44 // methods
45 detail::ExternalSoundPlayer *detail_GetActorPlayer(int actorPlayerId)
46 {
47 if (actorPlayerId < 0 || ACTOR_PLAYER_COUNT <= actorPlayerId)
48 return nullptr;
49
50 return &mActorPlayer[actorPlayerId];
51 }
52
53
54 template <typename TForEachFunc>
55 TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
56 for (int i = 0; i < ACTOR_PLAYER_COUNT; i++) {
57 mActorPlayer[i].ForEachSound(pFunc, reverse);
58 }
59
60 return pFunc;
61 }
62
63 detail::SoundActorParam const &detail_GetActorParam() const
64 {
65 return mActorParam;
66 }
67
68 void StopAllSound(int fadeFrames);
69 void PauseAllSound(bool flag, int fadeFrames);
70 int GetPlayingSoundCount(int playerId) const;
71
72 // static members
73 public:
74 static int const ACTOR_PLAYER_COUNT = 4;
75
76 // members
77 private:
78 /* base SoundStartable */ // size 0x04, offset 0x00
79 SoundArchivePlayer &mSoundArchivePlayer; // size 0x04, offset 0x04
80 detail::ExternalSoundPlayer mActorPlayer[ACTOR_PLAYER_COUNT]; // size 0x40, offset 0x08
81 detail::SoundActorParam mActorParam; // size 0x0c, offset 0x48
82 }; // size 0x54
83}} // namespace nw4r::snd
84
85#endif // NW4R_SND_SOUND_ACTOR_H