2022-12-20 22:12:44 +00:00
|
|
|
#pragma once
|
|
|
|
#ifdef _WIN32
|
|
|
|
#define WIN32 // make fmod use stdcall
|
|
|
|
#endif
|
|
|
|
#include "3rdParty/fmod/fmod.hpp"
|
|
|
|
#include "cdcSound.h"
|
|
|
|
#include "cdcSys/SList.h"
|
|
|
|
#include "Sample.h"
|
|
|
|
|
|
|
|
namespace cdc {
|
|
|
|
|
|
|
|
class Voice;
|
|
|
|
class VoiceImpl;
|
|
|
|
|
2022-12-25 16:07:40 +00:00
|
|
|
class VoiceCollection : protected SoundTypes { // line 28
|
2022-12-20 22:12:44 +00:00
|
|
|
void Add(VoiceImpl *voice);
|
|
|
|
|
|
|
|
public:
|
|
|
|
FMOD::ChannelGroup *m_groupMaster = nullptr; // 0, assigned in SND_Init
|
|
|
|
uint8_t byte4 = 1; // 4
|
|
|
|
SList<VoiceImpl*> m_voices; // 8
|
|
|
|
FMOD::Channel *m_arrayChannelsToSyncStart[1024]; // C
|
|
|
|
uint32_t m_nVoices = 0; // 100C
|
|
|
|
|
|
|
|
Voice *Create(Sample *sample);
|
2022-12-22 18:47:25 +00:00
|
|
|
void Remove(VoiceImpl *voice);
|
2022-12-20 22:12:44 +00:00
|
|
|
void Update(float seconds);
|
2022-12-25 16:07:40 +00:00
|
|
|
inline bool IsOutOfMemory() { // line 42
|
|
|
|
return !byte4 || m_nVoices >= 0x200;
|
|
|
|
}
|
2022-12-20 22:12:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class Voice { // 74
|
|
|
|
public:
|
|
|
|
enum UpdateCode { // 127
|
|
|
|
kNormal = 0,
|
|
|
|
kSyncReady = 1,
|
|
|
|
kSyncStalled = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
static VoiceCollection s_voiceCollection;
|
|
|
|
};
|
|
|
|
|
|
|
|
class VoiceImpl : public Voice {
|
|
|
|
public:
|
2023-07-31 23:55:40 +00:00
|
|
|
void SetControls(
|
|
|
|
SoundTypes::Controls *controls,
|
|
|
|
SoundTypes::Controls3d *controls3d);
|
2022-12-20 22:12:44 +00:00
|
|
|
UpdateCode Update();
|
2023-07-31 23:55:40 +00:00
|
|
|
float Update3D(float& directOcclusion, float& reverbOcclusion);
|
2022-12-22 22:39:22 +00:00
|
|
|
FMOD_RESULT EndCallback();
|
|
|
|
FMOD_RESULT VirtualCallback(bool);
|
2022-12-22 18:47:25 +00:00
|
|
|
~VoiceImpl();
|
2022-12-20 22:12:44 +00:00
|
|
|
|
2022-12-22 18:47:25 +00:00
|
|
|
cdc::SList<VoiceImpl*>::iterator it; // 4
|
2022-12-20 22:12:44 +00:00
|
|
|
FMOD::Channel *m_channel; // 8
|
|
|
|
Sample *m_sample; // C
|
2023-07-31 23:55:40 +00:00
|
|
|
SoundTypes::Controls3d *m_controls3d = nullptr; // 20
|
2022-12-22 22:39:22 +00:00
|
|
|
bool m_bPreventVol0Virtual = false; // 25
|
|
|
|
bool m_bStoppedFMOD = false; // 26
|
2022-12-20 22:12:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|