NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_AxVoiceManager.h
1#ifndef NW4R_SND_AX_VOICE_MANAGER_H
2#define NW4R_SND_AX_VOICE_MANAGER_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include <types.h>
9
10#include "nw4r/snd/snd_AxVoice.h"
11
12/*******************************************************************************
13 * classes and functions
14 */
15
16namespace nw4r { namespace snd { namespace detail
17{
18 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x2adb3b
19 class AxVoiceManager
20 {
21 // methods
22 public:
23 // instance accessors
24 static AxVoiceManager &GetInstance();
25
26 // methods
27 void Setup(void *mem, ulong memSize);
28 void Shutdown();
29
30 ulong GetRequiredMemSize(int axVoiceCount);
31
32 AxVoice *AcquireAxVoice(ulong priority, AxVoice::Callback *callback,
33 void *callbackData);
34 void ReserveForFreeAxVoice(AxVoice *voice);
35 void FreeAxVoice(AxVoice *voice);
36 void FreeAllReservedAxVoice();
37
38 private:
39 // cdtors
40 AxVoiceManager();
41
42 // methods
43 AxVoice *Alloc();
44 void ReserveForFree(AxVoice *voice);
45 void Free(AxVoice *voice);
46
47 // static members
48 public:
49 static int const VOICE_COUNT_MARGIN = 16;
50 static const int VOICE_MARGIN = 16;
51 static const int VOICE_MAX = AX_VOICE_MAX + VOICE_MARGIN;
52 static const int WORK_SIZE_MAX = VOICE_MAX * sizeof(AxVoice);
53
54 // members
55 private:
56 AxVoice::LinkList mActiveVoiceList; // size 0x0c, offset 0x00
57 AxVoice::LinkList mFreeVoiceList; // size 0x0c, offset 0x0c
58 AxVoice::LinkList mFreeReservedVoiceList; // size 0x0c, offset 0x18
59 bool mInitialized; // size 0x01, offset 0x24
60 /* 3 bytes padding */
61 int mVoiceCount; // size 0x04, offset 0x28
62 }; // size 0x2c
63}}} // namespace nw4r::snd::detail
64
65#endif // NW4R_SND_AX_VOICE_MANAGER_H