NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_SoundStartable.h
1#ifndef NW4R_SND_SOUND_STARTABLE_H
2#define NW4R_SND_SOUND_STARTABLE_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include <types.h>
9#include "nw4r/snd/snd_BasicSound.h"
10#include "nw4r/snd/snd_ExternalSoundPlayer.h"
11
12/*******************************************************************************
13 * types
14 */
15
16// forward declarations
17namespace nw4r { namespace snd { class SoundHandle; }}
18
19/*******************************************************************************
20 * classes and functions
21 */
22
23namespace nw4r { namespace snd
24{
25 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x289cb
27 {
28 // enums
29 public:
30 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x267f0
31 enum StartResult
32 {
33 START_SUCCESS,
34
35 START_ERR_LOW_PRIORITY,
36 START_ERR_INVALID_LABEL_STRING,
37 START_ERR_INVALID_SOUNDID,
38 START_ERR_NOT_DATA_LOADED,
39 START_ERR_NOT_ENOUGH_PLAYER_HEAP,
40 START_ERR_CANNOT_OPEN_FILE,
41 START_ERR_NOT_AVAILABLE,
42 START_ERR_CANNOT_ALLOCATE_TRACK,
43 START_ERR_NOT_ENOUGH_INSTANCE,
44 START_ERR_INVALID_PARAMETER,
45 START_ERR_INVALID_SEQ_START_LOCATION_LABEL,
46
47 START_ERR_USER = 128,
48
49 START_ERR_UNKNOWN = 255,
50 };
51
52 // nested types
53 public:
54 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27291
55 struct StartInfo
56 {
57 StartInfo() : enableFlag(0) {}
58 // enums
59 public:
60 enum EnableFlag
61 {
62 ENABLE_START_OFFSET = 1 << 0,
63 ENABLE_PLAYER_ID = 1 << 1,
64 ENABLE_PLAYER_PRIORITY = 1 << 2,
65 ENABLE_ACTOR_PLAYER_ID = 1 << 3,
66 ENABLE_SEQ_SOUND_INFO = 1 << 4,
67 };
68
69 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27187
70 enum StartOffsetType
71 {
72 START_OFFSET_TYPE_MILLISEC,
73 START_OFFSET_TYPE_TICK,
74 START_OFFSET_TYPE_SAMPLE,
75 };
76
77 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27208
78 struct SeqSoundInfo
79 {
80 SeqSoundInfo() : seqDataAddress(NULL), startLocationLabel(NULL) {}
81 void *seqDataAddress; // size 0x04, offset 0x00
82 char const *startLocationLabel; // size 0x04, offset 0x04
83 }; // size 0x08
84
85 // members
86 public:
87 ulong enableFlag; // size 0x04, offset 0x00
88 StartOffsetType startOffsetType; // size 0x04, offset 0x04
89 int startOffset; // size 0x04, offset 0x08
90 ulong playerId; // size 0x04, offset 0x0c
91 int playerPriority; // size 0x04, offset 0x10
92 int actorPlayerId; // size 0x04, offset 0x14
93 SeqSoundInfo seqSoundInfo; // size 0x08, offset 0x18
94 }; // size 0x20
95
96 // methods
97 public:
98 // cdtors
99 virtual ~SoundStartable() {}
100
101 // virtual function ordering
102 // vtable SoundStartable
103 virtual StartResult detail_SetupSound(SoundHandle *handle, ulong soundId,
104 bool holdFlag,
105 StartInfo const *startInfo) = 0;
106 virtual ulong detail_ConvertLabelStringToSoundId(char const *label) = 0;
107
108 // methods
109 StartResult detail_StartSound(
110 SoundHandle *pHandle, ulong id, const StartInfo *pStartInfo
111 );
112 StartResult detail_StartSound(
113 SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo
114 );
115
116 StartResult detail_HoldSound(
117 SoundHandle *pHandle, ulong id, const StartInfo *pStartInfo
118 );
119 StartResult detail_HoldSound(
120 SoundHandle *pHandle, const char *label, const StartInfo *pStartInfo
121 );
122
123 StartResult detail_PrepareSound(
124 SoundHandle *pHandle, ulong id, const StartInfo *pStartInfo
125 );
126 StartResult detail_PrepareSound(
127 SoundHandle *pHandle, const char *label,
128 const StartInfo *pStartInfo
129 );
130
131 bool StartSound(SoundHandle *pHandle, ulong id) {
132 return detail_StartSound(pHandle, id, NULL) == START_SUCCESS;
133 }
134 bool StartSound(SoundHandle *pHandle, const char *label) {
135 return detail_StartSound(pHandle, label, NULL) == START_SUCCESS;
136 }
137 bool StartSound(SoundHandle *pHandle, unsigned int id) {
138 return detail_StartSound(pHandle, id, NULL) == START_SUCCESS;
139 }
140 bool StartSound(SoundHandle *pHandle, int id) {
141 return detail_StartSound(pHandle, id, NULL) == START_SUCCESS;
142 }
143
144 bool HoldSound(SoundHandle *pHandle, ulong id) {
145 return detail_HoldSound(pHandle, id, NULL) == START_SUCCESS;
146 }
147 bool HoldSound(SoundHandle *pHandle, const char *label) {
148 return detail_HoldSound(pHandle, label, NULL) == START_SUCCESS;
149 }
150 bool HoldSound(SoundHandle *pHandle, unsigned int id) {
151 return detail_HoldSound(pHandle, id, NULL) == START_SUCCESS;
152 }
153 bool HoldSound(SoundHandle *pHandle, int id) {
154 return detail_HoldSound(pHandle, id, NULL) == START_SUCCESS;
155 }
156
157 bool PrepareSound(SoundHandle *pHandle, ulong id) {
158 return detail_PrepareSound(pHandle, id, NULL) == START_SUCCESS;
159 }
160 bool PrepareSound(SoundHandle *pHandle, unsigned int id) {
161 return detail_PrepareSound(pHandle, id, NULL) == START_SUCCESS;
162 }
163 bool PrepareSound(SoundHandle *pHandle, int id) {
164 return detail_PrepareSound(pHandle, id, NULL) == START_SUCCESS;
165 }
166
167 // members
168 private:
169 /* vtable */ // size 0x04, offset 0x00
170 }; // size 0x04
171}} // namespace nw4r::snd
172
173#endif // NW4R_SND_SOUND_STARTABLE_H