Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
BasicSound.h
Go to the documentation of this file.
1#ifndef NW4HBM_SND_BASIC_SOUND_H
2#define NW4HBM_SND_BASIC_SOUND_H
3
4#include <revolution/types.h>
5#include <revolution/wpad.h>
6
7#include "MoveValue.h"
8#include "snd_global.h"
9#include "snd_types.h"
10
11#include "../ut/LinkList.h"
13#include "../ut/inlines.h"
14
15namespace nw4hbm {
16 namespace snd {
17
18 class SoundHandle;
19 class SoundPlayer;
20
21 namespace detail {
22 namespace {
23 class BasicPlayer;
24 }
25 class ExternalSoundPlayer;
26 class PlayerHeap;
27 } // namespace detail
28
29 namespace detail {
30 class BasicSound {
31 public:
33 typedef enum ParamUpdateFlags {
34 /* 1 */ PARAM_UPDATE_VOLUME = (1 << 0),
35 /* 2 */ PARAM_UPDATE_PAN = (1 << 1),
36 /* 4 */ PARAM_UPDATE_SURROUND_PAN = (1 << 2),
37 /* 8 */ PARAM_UPDATE_PRIORITY = (1 << 3),
39
40 /* 0x0C */ virtual void detail_Update(SoundParam* param, u32 id,
41 BasicSound* sound, const void* arg,
42 u32 flags) = 0;
44
45 typedef struct AmbientArgUpdateCallback {
46 /* 0x0C */ virtual void detail_Update(void* arg, const BasicSound* sound) = 0;
48
50 /* 0x0C */ virtual void* detail_AllocAmbientArg(u32 size) = 0;
51 /* 0x10 */ virtual void detail_FreeAmbientArg(void* arg,
52 const BasicSound* sound) = 0;
54
62
63 static const u32 INVALID_ID = 0xFFFFFFFF;
64 static const int PRIORITY_MAX = 127;
65
66 public:
68
70 /* 0x0C */ virtual ~BasicSound() {}
71 /* 0x10 */ virtual void Update();
72 /* 0x14 */ virtual void StartPrepared();
73 /* 0x18 */ virtual void Stop(int frames = 0);
74 /* 0x1C */ virtual void Pause(bool flag, int frames);
75 /* 0x20 */ virtual void SetAutoStopCounter(int count);
76 /* 0x24 */ virtual void FadeIn(int frames);
77 /* 0x28 */ virtual void Shutdown();
78 /* 0x2C */ virtual bool IsPrepared() const;
79 /* 0x30 */ virtual bool IsPause() const;
80 /* 0x34 */ virtual void SetInitialVolume(f32 volume);
81 /* 0x38 */ virtual void SetVolume(f32 volume, int frames);
82 /* 0x3C */ virtual void SetPitch(f32 pitch);
83 /* 0x40 */ virtual void SetPan(f32 pan);
84 /* 0x44 */ virtual void SetSurroundPan(f32 pan);
85 /* 0x48 */ virtual void SetLpfFreq(f32 freq);
86 /* 0x4C */ virtual void SetPlayerPriority(int priority);
87 /* 0x50 */ virtual bool IsAttachedTempSpecialHandle() = 0;
88 /* 0x54 */ virtual void DetachTempSpecialHandle() = 0;
89 /* 0x58 */ virtual void InitParam();
90 /* 0x5C */ virtual BasicPlayer& GetBasicPlayer() = 0;
91 /* 0x60 */ virtual const BasicPlayer& GetBasicPlayer() const = 0;
92
94 void SetPlayerHeap(PlayerHeap* heap) { mHeap = heap; }
95
98
101
103 void SetSoundPlayer(SoundPlayer* player) { mSoundPlayer = player; }
104
107 mExtSoundPlayer = extPlayer;
108 }
109
117
121
122 void* GetAmbientArg() { return mAmbientArg; }
124
126 AmbientArgUpdateCallback* argUpdateCallback,
127 AmbientArgAllocaterCallback* argAllocaterCallback,
128 void* callbackArg);
129
130 void SetPriority(int priority) { mPriority = priority; }
131
132 u32 GetId() const { return mId; }
133 void SetId(u32 id);
134
136
138 f32 GetPan() const;
140 f32 GetPitch() const;
141 f32 GetVolume() const;
142
145 int GetOutputLine() const;
146
148 void SetMainOutVolume(f32 volume);
149
150 f32 GetRemoteOutVolume(int remote) const;
151 void SetRemoteOutVolume(int remote, f32 volume);
152
153 void SetFxSend(AuxBus bus, f32 send);
154
158
159 private:
160 /* 0x04 */ PlayerHeap* mHeap;
168 /* 0x24 */ void* mAmbientArg;
172 /* 0x64 */ bool mStartFlag;
173 /* 0x65 */ bool mStartedFlag;
174 /* 0x66 */ bool mAutoStopFlag;
175 /* 0x67 */ bool mPauseFlag;
176 /* 0x68 */ bool mPauseFadeFlag;
177 /* 0x69 */ bool mFadeOutFlag;
178 /* 0x6C */ int mAutoStopCounter;
179 /* 0x70 */ u32 mUpdateCounter;
180 /* 0x74 */ u8 mPriority;
181 /* 0x78 */ u32 mId;
183 /* 0x8C */ f32 mInitVolume;
184 /* 0x90 */ f32 mExtPan;
186 /* 0x98 */ f32 mExtPitch;
187 /* 0x9C */ bool mOutputLineFlagEnable;
188 /* 0xA0 */ int mOutputLineFlag;
189 /* 0xA4 */ f32 mMainOutVolume;
190 /* 0xA8 */ f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS];
191
192 public:
197
198 friend class SoundHandle;
199 };
200
201 typedef ut::LinkList<BasicSound, offsetof(BasicSound, mPriorityLink)>
203 typedef ut::LinkList<BasicSound, offsetof(BasicSound, mSoundPlayerPlayLink)>
205 typedef ut::LinkList<BasicSound, offsetof(BasicSound, mSoundPlayerPriorityLink)>
207 typedef ut::LinkList<BasicSound, offsetof(BasicSound, mExtSoundPlayerPlayLink)>
209
210 } // namespace detail
211 } // namespace snd
212} // namespace nw4hbm
213
214#endif
static BOOL flag
Definition DEMOAVX.c:20
Definition SoundHandle.h:12
Definition SoundPlayer.h:21
Definition BasicSound.h:30
void SetPriority(int priority)
Definition BasicSound.h:130
u32 mId
Definition BasicSound.h:181
struct nw4hbm::snd::detail::BasicSound::AmbientArgAllocaterCallback AmbientArgAllocaterCallback
void SetMainOutVolume(f32 volume)
void SetPlayerHeap(PlayerHeap *heap)
Definition BasicSound.h:94
SoundHandle * mTempGeneralHandle
Definition BasicSound.h:162
bool mPauseFlag
Definition BasicSound.h:175
struct nw4hbm::snd::detail::BasicSound::AmbientParamUpdateCallback AmbientParamUpdateCallback
void SetAmbientParamCallback(AmbientParamUpdateCallback *paramUpdateCallback, AmbientArgUpdateCallback *argUpdateCallback, AmbientArgAllocaterCallback *argAllocaterCallback, void *callbackArg)
ut::LinkListNode mSoundPlayerPlayLink
Definition BasicSound.h:194
virtual void SetAutoStopCounter(int count)
u32 GetId() const
Definition BasicSound.h:132
int mAutoStopCounter
Definition BasicSound.h:178
virtual void SetPan(f32 pan)
f32 mExtPitch
Definition BasicSound.h:186
virtual void SetVolume(f32 volume, int frames)
virtual void Pause(bool flag, int frames)
virtual void SetLpfFreq(f32 freq)
struct nw4hbm::snd::detail::BasicSound::AmbientArgUpdateCallback AmbientArgUpdateCallback
ut::LinkListNode mPriorityLink
Definition BasicSound.h:193
MoveValue< f32, int > mExtMoveVolume
Definition BasicSound.h:182
bool mFadeOutFlag
Definition BasicSound.h:177
f32 mInitVolume
Definition BasicSound.h:183
virtual void SetInitialVolume(f32 volume)
MoveValue< f32, int > mFadeVolume
Definition BasicSound.h:170
virtual void SetPlayerPriority(int priority)
virtual void Stop(int frames=0)
AmbientArgUpdateCallback * mAmbientArgUpdateCallback
Definition BasicSound.h:166
void * mAmbientArg
Definition BasicSound.h:168
ExternalSoundPlayer * mExtSoundPlayer
Definition BasicSound.h:164
u8 mPriority
Definition BasicSound.h:180
PlayerHeap * GetPlayerHeap()
Definition BasicSound.h:93
bool mPauseFadeFlag
Definition BasicSound.h:176
f32 GetMoveVolume()
Definition BasicSound.h:135
virtual const BasicPlayer & GetBasicPlayer() const =0
ut::LinkListNode mExtSoundPlayerPlayLink
Definition BasicSound.h:196
SoundPlayer * mSoundPlayer
Definition BasicSound.h:163
f32 mMainOutVolume
Definition BasicSound.h:189
bool mStartedFlag
Definition BasicSound.h:173
SoundParam mAmbientParam
Definition BasicSound.h:169
bool mOutputLineFlagEnable
Definition BasicSound.h:187
virtual bool IsPrepared() const
ut::LinkListNode mSoundPlayerPriorityLink
Definition BasicSound.h:195
void SetExternalSoundPlayer(ExternalSoundPlayer *extPlayer)
Definition BasicSound.h:106
static const u32 INVALID_ID
Definition BasicSound.h:63
AmbientArgUpdateCallback * GetAmbientArgUpdateCallback()
Definition BasicSound.h:113
f32 mExtSurroundPan
Definition BasicSound.h:185
NW4HBM_UT_RUNTIME_TYPEINFO
Definition BasicSound.h:69
virtual void FadeIn(int frames)
ExternalSoundPlayer * GetExternalSoundPlayer()
Definition BasicSound.h:105
virtual void SetPitch(f32 pitch)
AmbientParamUpdateCallback * mAmbientParamUpdateCallback
Definition BasicSound.h:165
f32 mExtPan
Definition BasicSound.h:184
PlayerHeap * mHeap
Definition BasicSound.h:160
virtual bool IsPause() const
AmbientParamUpdateCallback * GetAmbientParamUpdateCallback()
Definition BasicSound.h:110
virtual ~BasicSound()
Definition BasicSound.h:70
void SetSoundPlayer(SoundPlayer *player)
Definition BasicSound.h:103
struct nw4hbm::snd::detail::BasicSound::AmbientArgInfo AmbientArgInfo
SoundParam & GetAmbientParam()
Definition BasicSound.h:123
virtual bool IsAttachedTempSpecialHandle()=0
f32 mRemoteOutVolume[WPAD_MAX_CONTROLLERS]
Definition BasicSound.h:190
int CalcCurrentPlayerPriority() const
Definition BasicSound.h:155
void SetFxSend(AuxBus bus, f32 send)
virtual void SetSurroundPan(f32 pan)
f32 GetRemoteOutVolume(int remote) const
bool mAutoStopFlag
Definition BasicSound.h:174
AmbientArgAllocaterCallback * GetAmbientArgAllocaterCallback()
Definition BasicSound.h:118
void * GetAmbientArg()
Definition BasicSound.h:122
SoundPlayer * GetSoundPlayer()
Definition BasicSound.h:102
SoundHandle * mGeneralHandle
Definition BasicSound.h:161
int mOutputLineFlag
Definition BasicSound.h:188
MoveValue< f32, int > mPauseFadeVolume
Definition BasicSound.h:171
void ClearAmbientArgUpdateCallback()
Definition BasicSound.h:116
void SetRemoteOutVolume(int remote, f32 volume)
static const int PRIORITY_MAX
Definition BasicSound.h:64
bool mStartFlag
Definition BasicSound.h:172
virtual void DetachTempSpecialHandle()=0
u32 mUpdateCounter
Definition BasicSound.h:179
AmbientArgAllocaterCallback * mAmbientArgAllocaterCallback
Definition BasicSound.h:167
virtual BasicPlayer & GetBasicPlayer()=0
Definition ExternalSoundPlayer.h:11
Definition MoveValue.h:11
TValue GetValue() const
Definition MoveValue.h:25
Definition PlayerHeap.h:23
Definition LinkList.h:23
unsigned int size
Definition __os.h:106
unsigned long u32
Definition types.h:12
float f32
Definition types.h:25
signed long s32
Definition types.h:11
unsigned char u8
Definition types.h:8
ut::LinkList< BasicSound, offsetof(BasicSound, mSoundPlayerPriorityLink)> BasicSoundPlayerPrioList
Definition BasicSound.h:206
ut::LinkList< BasicSound, offsetof(BasicSound, mSoundPlayerPlayLink)> BasicSoundPlayerPlayList
Definition BasicSound.h:204
ut::LinkList< BasicSound, offsetof(BasicSound, mExtSoundPlayerPlayLink)> BasicSoundExtPlayList
Definition BasicSound.h:208
ut::LinkList< BasicSound, offsetof(BasicSound, mPriorityLink)> BasicSoundPrioList
Definition BasicSound.h:202
AuxBus
Definition snd_types.h:73
T Clamp(T x, T low, T high)
Definition inlines.h:28
Definition HBMAnmController.h:6
Definition snd_types.h:82
s32 priority
Definition snd_types.h:89
virtual void detail_FreeAmbientArg(void *arg, const BasicSound *sound)=0
AmbientArgUpdateCallback * argUpdateCallback
Definition BasicSound.h:57
AmbientArgAllocaterCallback * argAllocaterCallback
Definition BasicSound.h:58
void * arg
Definition BasicSound.h:59
AmbientParamUpdateCallback * paramUpdateCallback
Definition BasicSound.h:56
virtual void detail_Update(void *arg, const BasicSound *sound)=0
virtual void detail_Update(SoundParam *param, u32 id, BasicSound *sound, const void *arg, u32 flags)=0