Files
ss/include/nw4r/snd/snd_VoiceManager.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

58 lines
1.3 KiB
C++

#ifndef NW4R_SND_VOICE_MANAGER_H
#define NW4R_SND_VOICE_MANAGER_H
#include "nw4r/snd/snd_Voice.h"
#include "nw4r/types_nw4r.h"
namespace nw4r {
namespace snd {
namespace detail {
class VoiceManager {
public:
static const int VOICE_MAX = AX_VOICE_MAX;
static const int WORK_SIZE_MAX = VOICE_MAX * sizeof(Voice);
public:
static VoiceManager &GetInstance();
u32 GetRequiredMemSize();
void Setup(void *pBuffer, u32 size);
void Shutdown();
void StopAllVoices();
Voice *AllocVoice(int channels, int voices, int priority, Voice::VoiceCallback pCallback, void *pCallbackArg);
void FreeVoice(Voice *pVoice);
void UpdateAllVoices();
void NotifyVoiceUpdate();
void ChangeVoicePriority(Voice *pVoice);
void UpdateAllVoicesSync(u32 syncFlag);
const VoiceList &GetVoiceList() const {
return mPrioVoiceList;
}
private:
VoiceManager();
void AppendVoiceList(Voice *pVoice);
void RemoveVoiceList(Voice *pVoice);
void UpdateEachVoicePriority(const VoiceList::Iterator &rBegin, const VoiceList::Iterator &rEnd);
int DropLowestPriorityVoice(int priority);
private:
bool mInitialized; // at 0x0
VoiceList mPrioVoiceList; // at 0x4
VoiceList mFreeVoiceList; // at 0x10
};
} // namespace detail
} // namespace snd
} // namespace nw4r
#endif