NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_VoiceManager.h
1#ifndef NW4R_SND_VOICE_MANAGER_H
2#define NW4R_SND_VOICE_MANAGER_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include <types.h>
9
10#include "nw4r/snd/snd_Voice.h"
11
12/*******************************************************************************
13 * classes and functions
14 */
15
16namespace nw4r { namespace snd { namespace detail
17{
18 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2ffb36
19 class VoiceManager
20 {
21 public:
22 static const int VOICE_MAX = AX_VOICE_MAX;
23 static const int WORK_SIZE_MAX = VOICE_MAX * sizeof(Voice);
24 // methods
25 public:
26 // instance accessors
27 static VoiceManager &GetInstance();
28
29 // methods
30 void Setup(void *mem, ulong memSize);
31 void Shutdown();
32
33 Voice::LinkList const &GetVoiceList() const { return mPrioVoiceList; }
34 ulong GetRequiredMemSize(int voiceCount);
35
36 Voice *AllocVoice(int voiceChannelCount, int voiceOutCount,
37 int priority, Voice::Callback *callback,
38 void *callbackData);
39 void FreeVoice(Voice *voice);
40
41 void StopAllVoices();
42
43 void ChangeVoicePriority(Voice *voice);
44
45 void UpdateAllVoices();
46 void UpdateAllVoicesSync(ulong syncFlag);
47
48 void NotifyVoiceUpdate();
49
50 private:
51 // cdtors
52 VoiceManager();
53
54 // methods
55 void AppendVoiceList(Voice *voice);
56 void RemoveVoiceList(Voice *voice);
57
58 void UpdateEachVoicePriority(Voice::LinkList::Iterator const &beginItr,
59 Voice::LinkList::Iterator const &endItr);
60
61 int DropLowestPriorityVoice(int priority);
62
63 // members
64 private:
65 bool mInitialized; // size 0x01, offset 0x00
66 /* 3 bytes padding */
67 Voice::LinkList mPrioVoiceList; // size 0x0c, offset 0x04
68 Voice::LinkList mFreeVoiceList; // size 0x0c, offset 0x10
69 }; // size 0x1c
70}}} // namespace nw4r::snd::detail
71
72#endif // NW4R_SND_VOICE_MANAGER_H