1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
#ifndef NW4R_SND_SOUND_PLAYER_H
#define NW4R_SND_SOUND_PLAYER_H
/*******************************************************************************
* headers
*/
#include "common.h" // f32
#include "nw4r/snd/snd_BasicSound.h"
#include "nw4r/snd/snd_global.h" // AUX_BUS_NUM
#include "nw4r/snd/snd_PlayerHeap.h"
#include "nw4r/snd/snd_SoundHandle.h"
/*******************************************************************************
* classes
*/
namespace nw4r { namespace snd
{
// [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x26c0f
// NOTE: different from ketteiban: no remote fields
class SoundPlayer
{
// methods
public:
// cdtors
SoundPlayer();
~SoundPlayer();
// methods
int GetPlayableSoundCount() const { return mPlayableCount; }
f32 GetVolume() const { return mVolume; }
void SetVolume(f32 volume);
f32 GetLpfFreq() const { return mLpfFreq; }
void SetLpfFreq(f32 freq);
int GetDefaultOutputLine() const { return mOutputLineFlag; }
f32 GetMainOutVolume() const { return mMainOutVolume; }
int GetBiquadFilterType() const { return mBiquadType; }
f32 GetBiquadFilterValue() const { return mBiquadValue; }
f32 GetMainSend() const { return mMainSend; }
f32 GetFxSend(int index) const { return mFxSend[index]; }
void SetFxSend(AuxBus, f32);
void SetPlayableSoundCount(int count);
f32 GetRemoteOutVolume(int remote) const;
int GetPlayingSoundCount() const { return mSoundList.GetSize(); }
detail::BasicSound *GetLowestPrioritySound()
{
return &mPriorityList.GetFront();
}
void Update();
void PauseAllSound(bool flag, int fadeFrames);
void StopAllSound(int fadeFrames);
void RemoveSoundList(detail::BasicSound *sound);
bool detail_AppendSound(detail::BasicSound *sound);
void detail_RemoveSound(detail::BasicSound *sound);
void detail_SetPlayableSoundLimit(int limit);
bool detail_CanPlaySound(int startPriority);
void InsertPriorityList(detail::BasicSound *sound);
void RemovePriorityList(detail::BasicSound *sound);
void detail_SortPriorityList(detail::BasicSound *sound);
void detail_SortPriorityList();
detail::PlayerHeap *detail_AllocPlayerHeap(detail::BasicSound *sound);
void detail_FreePlayerHeap(detail::BasicSound *sound);
void detail_AppendPlayerHeap(detail::PlayerHeap *heap);
// Apparently exists, needed in d/snd
template <typename TForEachFunc>
TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
if (reverse) {
detail::BasicSound::SoundPlayerPlayLinkList::ReverseIterator it = mSoundList.GetBeginReverseIter();
while (it != mSoundList.GetEndReverseIter()) {
detail::BasicSound::SoundPlayerPlayLinkList::ReverseIterator curr = it;
SoundHandle handle;
handle.detail_AttachSoundAsTempHandle(&*curr);
pFunc(handle);
if (handle.IsAttachedSound()) {
++it;
}
}
} else {
NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList) {
decltype(it) curItr = it++;
SoundHandle handle;
handle.detail_AttachSoundAsTempHandle(&*curItr);
pFunc(handle);
}
}
return pFunc;
}
// members
private:
detail::BasicSound::SoundPlayerPlayLinkList mSoundList; // size 0x0c, offset 0x00
detail::BasicSound::SoundPlayerPriorityLinkList mPriorityList; // size 0x0c, offset 0x0c
detail::PlayerHeap::LinkList mHeapList; // size 0x0c, offset 0x18
int mPlayableCount; // size 0x04, offset 0x24
int mPlayableLimit; // size 0x04, offset 0x28
f32 mVolume; // size 0x04, offset 0x2c
f32 mLpfFreq; // size 0x04, offset 0x30
int mOutputLineFlag; // size 0x04, offset 0x34
f32 mMainOutVolume; // size 0x04, offset 0x38
int mBiquadType; // size 0x04, offset 0x3c
f32 mBiquadValue; // size 0x04, offset 0x40
f32 mRemoteOutVolume[4];
f32 mMainSend; // size 0x04, offset 0x44
f32 mFxSend[AUX_BUS_NUM]; // size 0x0c, offset 0x48
}; // size 0x54
}} // namespace nw4r::snd
#endif // NW4R_SND_SOUND_PLAYER_H
|