blob: 80685ee08e339c7c984d5254eb8a78bfd17b00c9 (
plain)
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
|
#ifndef NW4HBM_SND_EXTERNAL_SOUND_PLAYER_H
#define NW4HBM_SND_EXTERNAL_SOUND_PLAYER_H
#include <revolution/types.h>
#include "BasicSound.h"
namespace nw4hbm {
namespace snd {
namespace detail {
class ExternalSoundPlayer {
public:
ExternalSoundPlayer();
~ExternalSoundPlayer();
int GetPlayableSoundCount() const { return mPlayableCount; }
void SetPlayableSoundCount(int count);
int GetPlayingSoundCount() const { return mSoundList.GetSize(); }
f32 detail_GetVolume() const { return mVolume; }
BasicSound* GetLowestPrioritySound();
void InsertSoundList(BasicSound* sound);
void RemoveSoundList(BasicSound* sound);
template <typename TForEachFunc>
TForEachFunc ForEachSound(TForEachFunc func, bool reverse) {
if (reverse) {
BasicSoundExtPlayList::RevIterator it = mSoundList.GetBeginReverseIter();
while (it != mSoundList.GetEndReverseIter()) {
BasicSoundExtPlayList::RevIterator curr = it;
SoundHandle handle;
handle.detail_AttachSoundAsTempHandle(&*curr);
func(handle);
if (handle.IsAttachedSound()) {
it++;
}
}
} else {
for (BasicSoundExtPlayList::Iterator itr = mSoundList.GetBeginIter();
itr != mSoundList.GetEndIter();)
{
BasicSoundExtPlayList::Iterator curr = itr++;
SoundHandle handle;
handle.detail_AttachSoundAsTempHandle(&*curr);
func(handle);
}
}
return func;
}
private:
/* 0x00 */ BasicSoundExtPlayList mSoundList;
/* 0x0C */ u16 mPlayableCount;
/* 0x10 */ f32 mVolume;
};
} // namespace detail
} // namespace snd
} // namespace nw4hbm
#endif
|