NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_ExternalSoundPlayer.h
1#ifndef NW4R_SND_EXTERNAL_SOUND_PLAYER_H
2#define NW4R_SND_EXTERNAL_SOUND_PLAYER_H
3
4/*******************************************************************************
5 * headers
6 */
7
8#include "nw4r/snd/snd_BasicSound.h"
9#include "nw4r/snd/snd_SoundHandle.h"
10#include "nw4r/snd/snd_global.h"
11
12/*******************************************************************************
13 * classes and functions
14 */
15
16namespace nw4r { namespace snd { class SoundActor; }}
17
18namespace nw4r { namespace snd { namespace detail
19{
20 // [R89JEL]:/bin/RVL/Debug/mainD.elf:.debug::0x27049
21 class ExternalSoundPlayer
22 {
23 // methods
24 public:
25 // methods
26 ExternalSoundPlayer();
27 ~ExternalSoundPlayer();
28 int GetPlayingSoundCount() const { return mSoundList.GetSize(); }
29 int GetPlayableSoundCount() const { return mPlayableCount; }
30 void SetPlayableSoundCount(int count);
31 void StopAllSound(int fadeFrames);
32 void PauseAllSound(bool flag, int fadeFrames);
33 void DetachSoundActorAll(SoundActor *sound);
34
35 bool AppendSound(BasicSound *sound);
36 void RemoveSound(BasicSound *sound);
37
38 bool detail_CanPlaySound(int startPriority);
39
40 template <typename TForEachFunc>
41 TForEachFunc ForEachSound(TForEachFunc pFunc, bool reverse) {
42 if (reverse) {
43 detail::BasicSound::ExtSoundPlayerPlayLinkList::ReverseIterator it = mSoundList.GetBeginReverseIter();
44
45 while (it != mSoundList.GetEndReverseIter()) {
46 detail::BasicSound::ExtSoundPlayerPlayLinkList::ReverseIterator curr = it;
47
48 SoundHandle handle;
49 handle.detail_AttachSoundAsTempHandle(&*curr);
50 pFunc(handle);
51
52 if (handle.IsAttachedSound()) {
53 ++it;
54 }
55 }
56 } else {
57 NW4R_RANGE_FOR_NO_AUTO_INC(it, mSoundList) {
58 decltype(it) curItr = it++;
59 SoundHandle handle;
60 handle.detail_AttachSoundAsTempHandle(&*curItr);
61 pFunc(handle);
62 }
63 }
64
65 return pFunc;
66 }
67
68 private:
69 BasicSound *GetLowestPrioritySound();
70
71 // members
72 private:
73 BasicSound::ExtSoundPlayerPlayLinkList mSoundList; // size 0x0c, offset 0x00
74 int mPlayableCount; // size 0x04, offset 0x0c
75 }; // size 0x10
76}}} // namespace nw4r::snd::detail
77
78#endif // NW4R_SND_EXTERNAL_SOUND_PLAYER_H