Files
ss/include/nw4r/snd/snd_SoundActor.h
T
Elijah Thomas 26af4db82d update from dtk-template - clangd :) (#66)
* update from dtk-template and start work towards using clangd

* include <a> -> "a"

* Update build.yml

* remove/add non-trivial class in union warning
2024-10-16 15:36:02 -04:00

63 lines
1.6 KiB
C++

#ifndef NW4R_SND_SOUND_ACTOR_H
#define NW4R_SND_SOUND_ACTOR_H
#include "limits.h"
#include "nw4r/snd/snd_ExternalSoundPlayer.h"
#include "nw4r/snd/snd_SoundStartable.h"
#include "nw4r/types_nw4r.h"
namespace nw4r {
namespace snd {
namespace detail {
class SoundActor : public SoundStartable {
public:
explicit SoundActor(SoundStartable &rStartable) : mStartable(rStartable) {
detail_GetActorSoundPlayer(0)->SetPlayableSoundCount(INT_MAX);
}
virtual StartResult detail_SetupSound(
SoundHandle *pHandle, u32 id, detail::BasicSound::AmbientArgInfo *pArgInfo,
detail::ExternalSoundPlayer *pPlayer, bool hold,
const StartInfo *pStartInfo
); // at 0xC
virtual u32 detail_ConvertLabelStringToSoundId(const char *pLabel) {
return mStartable.detail_ConvertLabelStringToSoundId(pLabel);
} // at 0x10
ExternalSoundPlayer *detail_GetActorSoundPlayer(int i) {
if (i < 0 || i >= ACTOR_PLAYER_COUNT) {
return NULL;
}
return &mActorPlayer[i];
}
template <typename TForEachFunc>
TForEachFunc ForEachSound(TForEachFunc pFunction, bool reverse) {
int i;
ExternalSoundPlayer *pPlayer = detail_GetActorSoundPlayer(0);
for (i = 0; i < ACTOR_PLAYER_COUNT; i++) {
pPlayer->ForEachSound(pFunction, reverse);
pPlayer++;
}
return pFunction;
}
private:
static const int ACTOR_PLAYER_COUNT = 8;
private:
SoundStartable &mStartable; // at 0x4
ExternalSoundPlayer mActorPlayer[ACTOR_PLAYER_COUNT]; // at 0x8
};
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif