Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
JAISound.h
Go to the documentation of this file.
1#ifndef JAISOUND_H
2#define JAISOUND_H
3
6#include "global.h"
7
12class JAISoundID {
13public:
14 operator u32() const { return this->mId.mFullId; }
15
16 JAISoundID(u32 pId) { mId.mFullId = pId; };
17
18 JAISoundID(JAISoundID const& other) { mId = other.mId; };
19
21
22 bool isAnonymous() { return mId.mFullId == 0xffffffff; }
23 void setAnonymous() { mId.mFullId = -1; }
24
25 union {
27 struct {
33 struct {
36 } mAdvancedId; // Debug doesn't have an inline for referencing the short ID so I assume
37 // it's similar to this
38 } mId;
39};
40
41class JASTrack;
42
48 /* 802A2220 */ s32 lockWhenPrepared();
49 /* 802A2244 */ s32 unlockIfLocked();
50
51 void init() {
52 field_0x0.value = 0;
53 field_0x1.value = 0;
54 *((u16*)&state) = 0;
55 user_data = 0;
56 }
57
58 bool isAlive() { return state.unk != 6; }
59 bool isDead() { return state.unk == 6;}
60
61 inline bool isPlaying() { return state.unk == 5; }
62 bool isPrepared() { return state.unk >= 3; }
63 inline bool isMute() { return field_0x0.flags.mute; }
64 inline bool isPaused() { return field_0x0.flags.paused; }
65 void pauseWhenOut() {
66 field_0x1.flags.flag6 = 1;
67 }
68
69 /* 0x0 */ union {
71 struct {
72 u8 mute : 1;
74 u8 flag3 : 1;
75 u8 flag4 : 1;
76 u8 flag5 : 1;
77 u8 flag6 : 1;
78 u8 flag7 : 1;
79 u8 flag8 : 1;
82 /* 0x1 */ union {
83 u8 value;
84 struct {
85 u8 flag1 : 1;
86 u8 flag2 : 1;
87 u8 flag3 : 1;
88 u8 flag4 : 1;
89 u8 flag5 : 1;
90 u8 flag6 : 1;
91 u8 flag7 : 1;
92 u8 flag8 : 1;
95 /* 0x2 */ struct {
97 struct {
98 u8 flag1 : 1;
99 u8 flag2 : 1;
101 u8 flag5 : 1;
102 u8 flag6 : 1;
103 u8 flag7 : 1;
104 u8 flag8 : 1;
107 /* 0x4 */ u32 user_data;
108}; // Size: 0x8
109
115 void forceIn() {
116 mIntensity = 1.0f;
118 }
119 void forceOut() {
120 mIntensity = 0.0f;
122 }
124 if (fadeCount != 0) {
126 } else {
127 forceOut();
128 }
129 }
131 if (param_1 != 0) {
133 } else {
134 forceIn();
135 }
136 }
138 mIntensity = 0.0f;
140 }
141 bool isOut() {
142 return (mTransition.mCount == 0 && mIntensity < 0.01f);
143 }
146
147 /* 0x00 */ f32 mIntensity;
149}; // Size: 0x10
150
155template <typename A0>
157 virtual void virtual2();
158 virtual void calc(A0*);
159 virtual void virtual4(A0*, const JASSoundParams&);
160};
161
166template <typename A0>
172/* JAISoundStrategyMgr<JAISe> */
174/* JAISoundStrategyMgr<JAISeq> */
176/* JAISoundStrategyMgr<JAIStream> */
178
184public:
185 void init() { field_0x0.value = 0; }
186
187 /* 0x0 */ union {
189 struct {
200};
201
207public:
208 /* 0x00 */ f32 mTempo;
210
212 void init() { setTempo(1.0f); }
214 mTempo = param_0;
215 field_0x4.zero();
216 }
217 f32 getTempo() { return mTempo; }
219};
220
221class JAISoundHandle;
222class JAIAudible;
223class JAIAudience;
224class JAISe;
225class JAISeq;
226class JAISoundChild;
227class JAIStream;
228class JAITempoMgr;
229
234class JAISound {
235public:
236 /* 802A21A0 */ void releaseHandle();
237 /* 802A21BC */ void attachHandle(JAISoundHandle*);
238 /* 802A22F8 */ JAISound();
239 /* 802A2328 */ void start_JAISound_(JAISoundID, JGeometry::TVec3<f32> const*, JAIAudience*);
240 /* 802A244C */ bool acceptsNewAudible() const;
241 /* 802A2474 */ void newAudible(JGeometry::TVec3<f32> const&, JGeometry::TVec3<f32> const*, u32,
242 JAIAudience*);
243 /* 802A2598 */ void stop();
244 /* 802A24DC */ void stop(u32 fadeout);
245 /* 802A25F0 */ void die_JAISound_();
246 /* 802A266C */ void increasePrepareCount_JAISound_();
247 /* 802A26B8 */ bool calc_JAISound_();
248 /* 802A29DC */ void initTrack_JAISound_(JASTrack*);
249
250 virtual s32 getNumChild() const = 0;
251 virtual JAISoundChild* getChild(int) = 0;
252 virtual void releaseChild(int) = 0;
253 /* 802A25D8 */ virtual JAISe* asSe();
254 /* 802A25E0 */ virtual JAISeq* asSeq();
255 /* 802A25E8 */ virtual JAIStream* asStream();
256 virtual JASTrack* getTrack() = 0;
257 virtual JASTrack* getChildTrack(int) = 0;
258 virtual JAITempoMgr* getTempoMgr() = 0;
259 virtual bool JAISound_tryDie_() = 0;
260
261 JAISoundID getID() const { return soundID; }
263 bool isAnimated() const { return getAnimationState() != 0; }
267 u32 getUserData() const { return status_.user_data; }
269 JAIAudible* getAudible() const { return audible_; }
270 bool isHandleAttached() const { return handle_ != NULL; }
271 bool hasLifeTime() const { return status_.field_0x1.flags.flag2; }
273 bool isPrepared() { return status_.isPrepared(); }
279 }
280
281 bool isStopping() {
282 bool isStopping = false;
283 if (status_.state.flags.flag1) {
285 }
286 return isStopping;
287 }
288
289 void pause(bool param_0) {
291 }
292
294 if (param_0 > lifeTime) {
296 }
297 }
298
304
307 if (param_0) {
309 }
310 }
311
313 if (audible_ != NULL) {
315 }
316 return audible_ != NULL;
317 }
318
322
324
325 s32 getCount() const { return mCount; }
326
328
330 /* 0x08 */ JAIAudible* audible_;
332 /* 0x10 */ u32 lifeTime;
333 /* 0x14 */ s32 prepareCount;
334 /* 0x18 */ JAISoundID soundID;
337 /* 0x34 */ u32 mPriority;
338 /* 0x38 */ s32 mCount;
340}; // Size: 0x98
341
342STATIC_ASSERT(sizeof(JAISound) == 0x98);
343
344#endif /* JAISOUND_H */
STATIC_ASSERT(sizeof(JAISound)==0x98)
T cLib_calcTimer(T *value)
Definition c_lib.h:74
Definition JAIAudible.h:12
void setPos(const JGeometry::TVec3< float > &other)
Definition JAIAudible.h:19
Definition JAISe.h:13
Definition JAISeq.h:15
Definition JAISound.h:183
u8 flag3
Definition JAISound.h:192
u8 flag8
Definition JAISound.h:197
u8 value
Definition JAISound.h:188
u8 flag5
Definition JAISound.h:194
u8 flag1
Definition JAISound.h:190
u8 flag2
Definition JAISound.h:191
struct JAISoundActivity::@109::@110 flags
union JAISoundActivity::@109 field_0x0
u8 flag6
Definition JAISound.h:195
void init()
Definition JAISound.h:185
u8 flag7
Definition JAISound.h:196
u8 flag4
Definition JAISound.h:193
Definition JAISoundHandles.h:14
Definition JAISound.h:234
void increasePrepareCount_JAISound_()
Definition JAISound.cpp:171
virtual JASTrack * getTrack()=0
virtual s32 getNumChild() const =0
bool isHandleAttached() const
Definition JAISound.h:270
u32 lifeTime
Definition JAISound.h:332
bool isStopping()
Definition JAISound.h:281
virtual JASTrack * getChildTrack(int)=0
JAISoundFader fader
Definition JAISound.h:336
s32 mCount
Definition JAISound.h:338
void fadeIn(u32 i_count)
Definition JAISound.h:320
JAIAudience * audience_
Definition JAISound.h:331
void unlockIfLocked()
Definition JAISound.h:274
s32 prepareCount
Definition JAISound.h:333
bool hasLifeTime() const
Definition JAISound.h:271
void initTrack_JAISound_(JASTrack *)
Definition JAISound.cpp:221
bool isAnimated() const
Definition JAISound.h:263
JAISoundID soundID
Definition JAISound.h:334
u8 getAnimationState() const
Definition JAISound.h:262
void pause(bool param_0)
Definition JAISound.h:289
void attachHandle(JAISoundHandle *)
Definition JAISound.cpp:32
void stop_JAISound_()
Definition JAISound.h:276
void removeLifeTime_()
Definition JAISound.h:272
JAIAudible * getAudible() const
Definition JAISound.h:269
virtual JAIStream * asStream()
Definition JAISound.cpp:153
void setUserData(u32 pUserData)
Definition JAISound.h:268
void stop()
Definition JAISound.cpp:137
void setComesBack(bool param_0)
Definition JAISound.h:305
JAISoundID getID() const
Definition JAISound.h:261
virtual JAISeq * asSeq()
Definition JAISound.cpp:148
bool calc_JAISound_()
Definition JAISound.cpp:179
bool acceptsNewAudible() const
Definition JAISound.cpp:102
JAISound()
Definition JAISound.cpp:78
void start_JAISound_(JAISoundID, JGeometry::TVec3< f32 > const *, JAIAudience *)
Definition JAISound.cpp:82
virtual void releaseChild(int)=0
virtual JAISe * asSe()
Definition JAISound.cpp:143
JAISoundParamsProperty & getProperty()
Definition JAISound.h:323
virtual JAITempoMgr * getTempoMgr()=0
void releaseHandle()
Definition JAISound.cpp:23
bool isPrepared()
Definition JAISound.h:273
void fadeOut(u32 i_count)
Definition JAISound.h:321
JAIAudible * audible_
Definition JAISound.h:330
s32 getCount() const
Definition JAISound.h:325
void lockWhenPrepared()
Definition JAISound.h:275
void updateLifeTime(u32 param_0)
Definition JAISound.h:293
JAISoundParams params
Definition JAISound.h:339
bool setPos(const JGeometry::TVec3< f32 > &param_1)
Definition JAISound.h:312
virtual JAISoundChild * getChild(int)=0
void die_JAISound_()
Definition JAISound.cpp:158
void setLifeTime(u32 param_0, bool param_1)
Definition JAISound.h:299
JAISoundFader & getFader()
Definition JAISound.h:319
JAISoundHandle * handle_
Definition JAISound.h:329
void newAudible(JGeometry::TVec3< f32 > const &, JGeometry::TVec3< f32 > const *, u32, JAIAudience *)
Definition JAISound.cpp:112
void setAnimationState(u8 pState)
Definition JAISound.h:264
virtual bool JAISound_tryDie_()=0
u32 mPriority
Definition JAISound.h:337
JAISoundStatus_ status_
Definition JAISound.h:335
u32 getUserData() const
Definition JAISound.h:267
JAISoundParamsMove & getAuxiliary()
Definition JAISound.h:327
Definition JAIStream.h:14
Definition JAISound.h:206
f32 mTempo
Definition JAISound.h:208
void setTempo(f32 param_0)
Definition JAISound.h:213
JAITempoMgr()
Definition JAISound.h:211
void init()
Definition JAISound.h:212
f32 getTempo()
Definition JAISound.h:217
JAISoundParamsTransition::TTransition field_0x4
Definition JAISound.h:209
void calc()
Definition JAISound.h:218
Definition JAIAudience.h:14
Definition JAISoundChild.h:13
Definition JAISound.h:114
void forceIn()
Definition JAISound.h:115
f32 getIntensity()
Definition JAISound.h:145
void fadeOut(u32 fadeCount)
Definition JAISound.h:123
void calc()
Definition JAISound.h:144
f32 mIntensity
Definition JAISound.h:147
JAISoundParamsTransition::TTransition mTransition
Definition JAISound.h:148
bool isOut()
Definition JAISound.h:141
void forceOut()
Definition JAISound.h:119
void fadeInFromOut(u32 param_1)
Definition JAISound.h:137
void fadeIn(u32 param_1)
Definition JAISound.h:130
Definition d_a_obj_sekizoa.cpp:447
JAISoundID(u32 pId)
Definition JAISound.h:16
u16 mSoundType
Definition JAISound.h:34
u8 b2
Definition JAISound.h:30
bool isAnonymous()
Definition JAISound.h:22
JAISoundID()
Definition JAISound.h:20
u16 mShortId
Definition JAISound.h:35
u8 b3
Definition JAISound.h:31
struct JAISoundID::@100::@102 mAdvancedId
union JAISoundID::@100 mId
u8 b0
Definition JAISound.h:28
u32 mFullId
Definition JAISound.h:26
void setAnonymous()
Definition JAISound.h:23
struct JAISoundID::@100::@101 mBytes
u8 b1
Definition JAISound.h:29
JAISoundID(JAISoundID const &other)
Definition JAISound.h:18
Definition JAISoundParams.h:85
Definition JAISoundParams.h:10
Definition JAISoundParams.h:27
u32 mCount
Definition JAISoundParams.h:55
void zero()
Definition JAISoundParams.h:28
void set(f32 newValue, f32 intensity, u32 fadeCount)
Definition JAISoundParams.h:34
f32 apply(f32 param_0)
Definition JAISoundParams.h:40
Definition JAISoundParams.h:109
JAISoundParamsMove mMove
Definition JAISoundParams.h:119
JAISoundParamsProperty mProperty
Definition JAISoundParams.h:118
Definition JAISound.h:47
bool isDead()
Definition JAISound.h:59
u8 flag1
Definition JAISound.h:85
u8 flag2
Definition JAISound.h:86
u8 flag4
Definition JAISound.h:75
u8 flag3
Definition JAISound.h:74
u8 unk
Definition JAISound.h:96
s32 unlockIfLocked()
Definition JAISound.cpp:54
u8 flag8
Definition JAISound.h:79
u8 flag6
Definition JAISound.h:77
bool isPaused()
Definition JAISound.h:64
union JAISoundStatus_::@104 field_0x1
u8 value
Definition JAISound.h:70
s32 lockWhenPrepared()
Definition JAISound.cpp:44
u32 user_data
Definition JAISound.h:107
bool isPrepared()
Definition JAISound.h:62
bool isMute()
Definition JAISound.h:63
bool isAlive()
Definition JAISound.h:58
u8 paused
Definition JAISound.h:73
u8 mute
Definition JAISound.h:72
void init()
Definition JAISound.h:51
u8 flag5
Definition JAISound.h:76
u8 animationState
Definition JAISound.h:100
struct JAISoundStatus_::@103::@106 flags
struct JAISoundStatus_::@105 state
union JAISoundStatus_::@103 field_0x0
u8 flag7
Definition JAISound.h:78
void pauseWhenOut()
Definition JAISound.h:65
bool isPlaying()
Definition JAISound.h:61
Definition JAISound.h:173
Definition JAISound.h:175
Definition JAISound.h:177
Definition JAISound.h:156
virtual void virtual4(A0 *, const JASSoundParams &)
virtual void calc(A0 *)
Definition JAISound.h:167
virtual void virtual2()
virtual void virtual4(JAISoundStrategyMgr__unknown< A0 > *)
virtual JAISoundStrategyMgr__unknown< A0 > * calc(JAISoundID)
Definition JASSoundParams.h:10
Definition JASTrack.h:23
Definition JGeometry.h:55
unsigned long u32
Definition types.h:10
float f32
Definition types.h:22
unsigned short u16
Definition types.h:9
signed long s32
Definition types.h:6
unsigned char u8
Definition types.h:8