Twilight Princess
Decompilation of The Legend of Zelda: Twilight Princess
Loading...
Searching...
No Matches
AxManager.h
Go to the documentation of this file.
1#ifndef NW4HBM_SND_AX_MANAGER_H
2#define NW4HBM_SND_AX_MANAGER_H
3
4#include "FxBase.h"
5
6#include "AxVoice.h"
7#include "MoveValue.h"
8
9#include <revolution/ai.h>
10#include <revolution/ax.h>
11
12#include "../db/assert.h"
13
14namespace nw4hbm {
15 namespace snd {
16 namespace detail {
17
18 class AxManager {
19 public:
24
25 typedef ut::LinkList<CallbackListNode, offsetof(CallbackListNode, link)>
27
29
30 void Init();
31 void Shutdown();
32 void Update();
33
34 bool CheckInit() { return mInitialized; }
35
36 bool IsDiskError() const { return mDiskErrorFlag; }
37 bool IsHomeButtonMenu() const { return mHomeButtonMuteFlag; }
38
39 bool IsResetReady() const { return mResetReadyCounter == 0; }
40
43
46
49
52 void UpdateAllVoicesSync(u32 syncFlag);
53
55 void SetMasterVolume(f32 volume, int frame);
56
57 bool AppendEffect(AuxBus bus, FxBase* fx);
58 void ClearEffect(AuxBus bus, int frame);
60
62 NW4R_ASSERT_MINMAX(189, bus, AUX_A, AUX_BUS_NUM);
63 return mFxList[bus];
64 }
65
68
69 AxVoice* AllocVoice(int channels, int voices, int priority,
70 AxVoice::AxVoiceCallback callback, void* callbackData);
71 void FreeVoice(AxVoice* voice);
72
76
77 int DropLowestPriorityVoice(int priority);
78
80
81 private:
82 static const u8 AUX_CALLBACK_WAIT_FRAME = 6;
83
84 static const int FX_SAMPLE_RATE = AX_SAMPLE_RATE;
86 static const int FX_BUFFER_SIZE = AX_FRAME_SIZE;
87
88 static const int ZERO_BUFFER_SIZE = 256;
89
91
92 static void AxCallbackFunc();
93 static void AuxCallbackFunc(void* chans, void* context);
94
95 /* 0x0000 */ OutputMode mOutputMode;
96 /* 0x0004 */ void* mZeroBufferAddress;
100 /* 0x002C */ AxVoice mVoices[AX_MAX_VOICES];
102 /* 0xA230 */ bool mInitialized;
103 /* 0xA231 */ bool mUpdateVoicePrioFlag;
104 /* 0xA232 */ bool mHomeButtonMuteFlag;
105 /* 0xA233 */ bool mDiskErrorFlag;
115 /* 0xA2FC */ void* mAuxCallbackContext[AUX_BUS_NUM];
117
119 };
120
121 } // namespace detail
122 } // namespace snd
123} // namespace nw4hbm
124
125#endif
Definition FxBase.h:14
Definition AxManager.h:18
FxList mFxList[AUX_BUS_NUM]
Definition AxManager.h:113
AXCallback mNextAxRegisterCallback
Definition AxManager.h:101
bool mUpdateVoicePrioFlag
Definition AxManager.h:103
static const int ZERO_BUFFER_SIZE
Definition AxManager.h:88
static const int FX_SAMPLE_RATE
Definition AxManager.h:84
MoveValue< f32, int > mMasterVolume
Definition AxManager.h:107
void * mZeroBufferAddress
Definition AxManager.h:96
void SetOutputMode(OutputMode mode)
void RemoveVoiceList(AxVoice *voice)
bool CheckInit()
Definition AxManager.h:34
void UpdateAllVoicesSync(u32 syncFlag)
AxVoiceList & GetVoiceList()
Definition AxManager.h:79
bool mInitialized
Definition AxManager.h:102
OutputMode mOutputMode
Definition AxManager.h:95
void UnregisterCallback(CallbackListNode *node)
void AppendVoiceList(AxVoice *voice)
static const SampleFormat FX_SAMPLE_FORMAT
Definition AxManager.h:85
AXCallback mAuxCallback[AUX_BUS_NUM]
Definition AxManager.h:114
void SetMasterVolume(f32 volume, int frame)
ut::LinkList< CallbackListNode, offsetof(CallbackListNode, link)> CallbackList
Definition AxManager.h:26
void * mAuxCallbackContext[AUX_BUS_NUM]
Definition AxManager.h:115
bool AppendEffect(AuxBus bus, FxBase *fx)
static const int FX_BUFFER_SIZE
Definition AxManager.h:86
FxList & GetEffectList(AuxBus bus)
Definition AxManager.h:61
AxVoiceList mFreeVoiceList
Definition AxManager.h:99
bool mDiskErrorFlag
Definition AxManager.h:105
void RegisterCallback(CallbackListNode *node, AXCallback callback)
AxVoice mVoices[AX_MAX_VOICES]
Definition AxManager.h:100
vs32 mResetReadyCounter
Definition AxManager.h:110
CallbackList mCallbackList
Definition AxManager.h:97
static const u8 AUX_CALLBACK_WAIT_FRAME
Definition AxManager.h:82
MoveValue< f32, int > mAuxUserVolume[AUX_BUS_NUM]
Definition AxManager.h:112
bool IsDiskError() const
Definition AxManager.h:36
static void AuxCallbackFunc(void *chans, void *context)
bool IsResetReady() const
Definition AxManager.h:39
MoveValue< f32, int > mHomeButtonMenuVolume
Definition AxManager.h:106
void FreeVoice(AxVoice *voice)
void ClearEffect(AuxBus bus, int frame)
static u8 sZeroBuffer[ZERO_BUFFER_SIZE]
Definition AxManager.h:118
f32 GetMasterVolume() const
Definition AxManager.h:54
static AxManager & GetInstance()
AxVoice * AllocVoice(int channels, int voices, int priority, AxVoice::AxVoiceCallback callback, void *callbackData)
void ChangeVoicePriority(AxVoice *voice)
int DropLowestPriorityVoice(int priority)
AIDCallback mOldAidCallback
Definition AxManager.h:109
void ShutdownEffect(AuxBus bus)
MoveValue< f32, int > mAuxFadeVolume[AUX_BUS_NUM]
Definition AxManager.h:111
bool IsHomeButtonMenu() const
Definition AxManager.h:37
AxVoiceList mPrioVoiceList
Definition AxManager.h:98
bool mHomeButtonMuteFlag
Definition AxManager.h:104
MoveValue< f32, int > mVolumeForReset
Definition AxManager.h:108
struct nw4hbm::snd::detail::AxManager::CallbackListNode CallbackListNode
u8 mAuxCallbackWaitCounter[AUX_BUS_NUM]
Definition AxManager.h:116
Definition AxVoice.h:123
void(*) AxVoiceCallback(AxVoice *drovoice, CallbackStatus status, void *callbackArg)
Definition AxVoice.h:162
Definition MoveValue.h:11
TValue GetValue() const
Definition MoveValue.h:25
Definition LinkList.h:23
void(* AIDCallback)()
Definition ai.h:14
void(* AXCallback)()
Definition ax.h:216
u32 mode
Definition GXTev.c:56
unsigned long u32
Definition types.h:12
float f32
Definition types.h:25
volatile s32 vs32
Definition types.h:22
unsigned char u8
Definition types.h:8
OutputMode
Definition snd_types.h:66
AuxBus
Definition snd_types.h:73
@ AUX_BUS_NUM
Definition snd_types.h:73
@ AUX_A
Definition snd_types.h:73
SampleFormat
Definition snd_types.h:75
@ SAMPLE_FORMAT_PCM_S32
Definition snd_types.h:76
Definition HBMAnmController.h:6
static void callback(u32 param_0)
Definition OSExec.c:308
AXCallback callback
Definition AxManager.h:22
ut::LinkListNode link
Definition AxManager.h:21