NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_BasicPlayer.h
1#ifndef NW4R_SND_BASIC_PLAYER_H
2#define NW4R_SND_BASIC_PLAYER_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include <types.h>
9
10#include "nw4r/snd/snd_global.h"
11
12/*******************************************************************************
13 * types
14 */
15
16namespace nw4r { namespace snd { namespace detail
17{
18 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27db8
19 // NOTE: different from ketteiban: no remote fields
20 struct PlayerParamSet
21 {
22 // methods
23 public:
24 // cdtors
25 PlayerParamSet() { Init(); }
26
27 // methods
28 void Init();
29
30 // members
31 public:
32 f32 volume; // size 0x04, offset 0x00
33 f32 pitch; // size 0x04, offset 0x04
34 f32 pan; // size 0x04, offset 0x08
35 f32 surroundPan; // size 0x04, offset 0x0c
36 f32 lpfFreq; // size 0x04, offset 0x10
37 f32 biquadValue; // size 0x04, offset 0x14
38 u8 biquadType; // size 0x01, offset 0x18
39 u8 remoteFilter; // size 0x01, offset 0x19
40 /* 2 bytes padding */
41 int outputLineFlag; // size 0x04, offset 0x1c
42 f32 mainOutVolume; // size 0x04, offset 0x20
43 f32 mainSend; // size 0x04, offset 0x24
44 PanMode panMode; // size 0x04, offset 0x28
45 PanCurve panCurve; // size 0x04, offset 0x2c
46 f32 fxSend[AUX_BUS_NUM]; // size 0x0c, offset 0x30
47 f32 remoteOutVolume[4]; // size 0x04, offset 0x3c
48 VoiceOutParam voiceOutParam[4]; // size 0x60, offset 0x5c
49 }; // size 0x9c
50}}} // namespace nw4r::snd::detail
51
52/*******************************************************************************
53 * classes and functions
54 */
55
56namespace nw4r { namespace snd { namespace detail
57{
58 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x280d8
59 // NOTE: different from ketteiban due to PlayerParamSet being different
60 class BasicPlayer
61 {
62 // methods
63 public:
64 // cdtors
65 BasicPlayer();
66 virtual ~BasicPlayer() {}
67
68 // virtual function ordering
69 // vtable BasicPlayer
70 virtual bool Start() = 0;
71 virtual void Stop() = 0;
72 virtual void Pause(bool flag) = 0;
73 virtual bool IsActive() const = 0;
74 virtual bool IsStarted() const = 0;
75 virtual bool IsPause() const = 0;
76
77 // methods
78 void InitParam();
79 void SetRemoteOutVolume(int remote, f32 volume);
80 f32 GetRemoteOutVolume(int remote) const;
81
82 f32 GetVolume() const { return mPlayerParamSet.volume; }
83 f32 GetPitch() const { return mPlayerParamSet.pitch; }
84 f32 GetPan() const { return mPlayerParamSet.pan; }
85 f32 GetSurroundPan() const { return mPlayerParamSet.surroundPan; }
86 f32 GetLpfFreq() const { return mPlayerParamSet.lpfFreq; }
87 f32 GetBiquadValue() const { return mPlayerParamSet.biquadValue; }
88 int GetBiquadType() const { return mPlayerParamSet.biquadType; }
89 int GetRemoteFilter() const { return mPlayerParamSet.remoteFilter; }
90 int GetOutputLine() const { return mPlayerParamSet.outputLineFlag; }
91 f32 GetMainOutVolume() const { return mPlayerParamSet.mainOutVolume; }
92 f32 GetMainSend() const { return mPlayerParamSet.mainSend; }
93 PanMode GetPanMode() const { return mPlayerParamSet.panMode; }
94 PanCurve GetPanCurve() const { return mPlayerParamSet.panCurve; }
95 f32 GetFxSend(AuxBus bus) const;
96 VoiceOutParam const &GetVoiceOutParam(int index) const
97 {
98 return mPlayerParamSet.voiceOutParam[index];
99 }
100 ulong GetId() const { return mId; }
101
102 void SetVolume(f32 volume) { mPlayerParamSet.volume = volume; }
103 void SetPitch(f32 pitch) { mPlayerParamSet.pitch = pitch; }
104 void SetPan(f32 pan) { mPlayerParamSet.pan = pan; }
105 void SetSurroundPan(f32 surroundPan) { mPlayerParamSet.surroundPan = surroundPan; }
106 void SetLpfFreq(f32 lpfFreq) { mPlayerParamSet.lpfFreq = lpfFreq; }
107 void SetBiquadFilter(int type, f32 value);
108 void SetRemoteFilter(int filter);
109 void SetOutputLine(int lineFlag) { mPlayerParamSet.outputLineFlag = lineFlag; }
110 void SetMainOutVolume(f32 volume) { mPlayerParamSet.mainOutVolume = volume; }
111 void SetMainSend(f32 send) { mPlayerParamSet.mainSend = send; }
112 void SetPanMode(PanMode panMode) { mPlayerParamSet.panMode = panMode; }
113 void SetPanCurve(PanCurve panCurve) { mPlayerParamSet.panCurve = panCurve; }
114 void SetFxSend(AuxBus bus, f32 send);
115 void SetVoiceOutParam(int index, VoiceOutParam const &param)
116 {
117 mPlayerParamSet.voiceOutParam[index] = param;
118 }
119 void SetId(ulong id) { mId = id; }
120
121 // members
122 private:
123 /* vtable */ // size 0x04, offset 0x00
124 PlayerParamSet mPlayerParamSet; // size 0x9c, offset 0x04
125 ulong mId; // size 0x04, offset 0xa0
126 }; // size 0xa4
127}}} // namespace nw4r::snd::detail
128
129#endif // NW4R_SND_BASIC_PLAYER_H