2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CAUDIOSYS
|
|
|
|
#define _CAUDIOSYS
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2023-10-23 04:18:22 +00:00
|
|
|
#include "musyx/musyx.h"
|
2022-08-13 01:26:00 +00:00
|
|
|
#include "types.h"
|
|
|
|
|
2023-01-07 21:24:16 +00:00
|
|
|
#include "rstl/map.hpp"
|
|
|
|
#include "rstl/rc_ptr.hpp"
|
|
|
|
#include "rstl/string.hpp"
|
|
|
|
#include "rstl/vector.hpp"
|
|
|
|
|
2022-12-01 13:45:36 +00:00
|
|
|
#include "Kyoto/Math/CVector3f.hpp"
|
|
|
|
|
2023-01-07 21:24:16 +00:00
|
|
|
class CAudioGroupSet;
|
2024-10-17 05:02:14 +00:00
|
|
|
class CSimplePool;
|
2023-01-07 21:24:16 +00:00
|
|
|
|
2022-09-13 04:26:54 +00:00
|
|
|
enum ETRKSampleRate {
|
|
|
|
kTSR_Zero,
|
|
|
|
kTSR_One,
|
|
|
|
// TODO
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ETRKRepeatMode {
|
|
|
|
// TODO
|
|
|
|
};
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
class CAudioSys {
|
2023-01-07 21:24:16 +00:00
|
|
|
static const rstl::string mpDefaultInvalidString;
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
public:
|
2022-10-31 16:19:28 +00:00
|
|
|
enum ESurroundModes { kSM_Mono, kSM_Stereo, kSM_Surround };
|
2023-01-07 21:24:16 +00:00
|
|
|
class CEmitterData {
|
2023-01-08 01:42:15 +00:00
|
|
|
public:
|
2024-10-17 05:02:14 +00:00
|
|
|
CEmitterData() : _50(0), _51(0), _52(kEmitterMedPriority) {};
|
2023-01-08 01:42:15 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
char data[0x50];
|
|
|
|
char _50;
|
|
|
|
char _51;
|
|
|
|
uchar _52;
|
2023-01-07 21:24:16 +00:00
|
|
|
};
|
2022-10-31 16:19:28 +00:00
|
|
|
|
2022-12-01 13:45:36 +00:00
|
|
|
struct C3DEmitterParmData {
|
2023-10-23 04:18:22 +00:00
|
|
|
C3DEmitterParmData(const float maxDist = 150.f, const float distComp = 0.1f,
|
|
|
|
const uint flags = 1, const uchar maxVol = 127, const uchar minVol = 0)
|
|
|
|
: x18_maxDist(maxDist)
|
2022-12-01 13:45:36 +00:00
|
|
|
, x1c_distComp(distComp)
|
|
|
|
, x20_flags(flags)
|
2023-10-23 04:18:22 +00:00
|
|
|
, x24_sfxId(0)
|
2022-12-01 13:45:36 +00:00
|
|
|
, x26_maxVol(maxVol)
|
|
|
|
, x27_minVol(minVol)
|
2023-10-23 04:18:22 +00:00
|
|
|
, x28_important(false)
|
|
|
|
, x29_prio(127) {}
|
2022-12-01 13:45:36 +00:00
|
|
|
|
|
|
|
CVector3f x0_pos;
|
|
|
|
CVector3f xc_dir;
|
|
|
|
float x18_maxDist;
|
|
|
|
float x1c_distComp;
|
|
|
|
uint x20_flags;
|
|
|
|
ushort x24_sfxId;
|
2023-10-23 04:18:22 +00:00
|
|
|
char x26_maxVol;
|
|
|
|
char x27_minVol;
|
2022-12-01 13:45:36 +00:00
|
|
|
bool x28_important; // Can't be allocated over, regardless of priority
|
|
|
|
uchar x29_prio;
|
|
|
|
};
|
|
|
|
|
2023-01-07 21:24:16 +00:00
|
|
|
class CTrkData {};
|
|
|
|
|
|
|
|
CAudioSys(char, char, char, char, uint);
|
2022-10-01 06:19:09 +00:00
|
|
|
~CAudioSys();
|
2022-09-13 04:26:54 +00:00
|
|
|
|
2022-10-09 05:37:23 +00:00
|
|
|
static void SysSetVolume(uchar, uint, uchar);
|
2022-10-31 16:19:28 +00:00
|
|
|
static void SysSetSfxVolume(uchar, ushort, uchar, uchar);
|
2024-10-17 05:02:14 +00:00
|
|
|
static bool SysLoadGroupSet(CSimplePool*, uint);
|
|
|
|
static const rstl::string& SysGetGroupSetName(uint);
|
|
|
|
static bool SysPushGroupIntoARAM(const rstl::string& name, uchar);
|
|
|
|
static void SysPopGroupFromARAM();
|
|
|
|
static void SysUnloadGroupSet(const rstl::string& name);
|
|
|
|
static void SysUnloadSampleData(const rstl::string& name);
|
2022-10-31 16:19:28 +00:00
|
|
|
|
2022-10-09 05:37:23 +00:00
|
|
|
static void SetDefaultVolumeScale(short);
|
|
|
|
static void SetVolumeScale(short);
|
2022-10-31 16:19:28 +00:00
|
|
|
static void SetSurroundMode(ESurroundModes);
|
2022-09-13 04:26:54 +00:00
|
|
|
static void TrkSetSampleRate(ETRKSampleRate);
|
|
|
|
|
2022-10-09 05:37:23 +00:00
|
|
|
static short GetDefaultVolumeScale();
|
2023-01-08 01:42:15 +00:00
|
|
|
static bool GetVerbose();
|
2022-09-13 04:26:54 +00:00
|
|
|
|
2023-10-23 04:18:22 +00:00
|
|
|
static SND_VOICEID SfxStart(const SND_FXID, const uchar, const uchar, const uchar);
|
|
|
|
static void SfxStop(SND_VOICEID handle);
|
|
|
|
static void SfxCtrl(SND_VOICEID handle, uchar ctrl, uchar val);
|
|
|
|
static SND_VOICEID SfxCheck(SND_VOICEID handle);
|
|
|
|
static void SfxVolume(SND_VOICEID handle, u8 vol);
|
2024-10-13 02:29:07 +00:00
|
|
|
static uint S3dAddEmitterParaEx(const C3DEmitterParmData& params, ushort handle,
|
2023-10-23 04:18:22 +00:00
|
|
|
SND_PARAMETER_INFO* paraInfo);
|
|
|
|
static void S3dUpdateEmitter(uint, const CVector3f&, const CVector3f&, uchar);
|
|
|
|
static void S3dRemoveEmitter(uint handle);
|
|
|
|
static const bool S3dCheckEmitter(uint handle);
|
|
|
|
static uint S3dEmitterVoiceID(uint handle);
|
|
|
|
|
|
|
|
static void S3dAddListener(const CVector3f& pos, const CVector3f& dir, const CVector3f& vec1,
|
|
|
|
const CVector3f& vec2, const float f1, const float f2, const float f3,
|
|
|
|
const uint w1, const uchar maxVolume);
|
|
|
|
static void S3dUpdateListener(const CVector3f& pos, const CVector3f& dir, const CVector3f& vec1,
|
|
|
|
const CVector3f& vec2, const uchar maxVolume);
|
|
|
|
|
|
|
|
static void S3dAddEmitter(SND_FXID fxid, const CVector3f& pos, const CVector3f& dir,
|
|
|
|
const bool b1, const bool b2, short, int);
|
|
|
|
|
2023-10-26 19:50:31 +00:00
|
|
|
static u32 SeqPlayEx(unsigned short, unsigned short, void*, SND_PLAYPARA*, unsigned char);
|
|
|
|
static void SeqStop(u32);
|
|
|
|
static void SeqVolume(u8, u16, u32, u8);
|
2023-01-07 21:24:16 +00:00
|
|
|
static bool mInitialized;
|
2023-01-08 01:42:15 +00:00
|
|
|
static bool mIsListenerActive;
|
2023-01-07 21:24:16 +00:00
|
|
|
static bool mVerbose;
|
|
|
|
static uchar mMaxNumEmitters;
|
|
|
|
static rstl::map< rstl::string, rstl::ncrc_ptr< CAudioGroupSet > >* mpGroupSetDB;
|
|
|
|
static rstl::map< uint, rstl::string >* mpGroupSetResNameDB;
|
|
|
|
static rstl::map< rstl::string, rstl::ncrc_ptr< CTrkData > >* mpDVDTrackDB;
|
2023-01-08 01:42:15 +00:00
|
|
|
static rstl::vector< CEmitterData >* mpEmitterDB;
|
2023-01-07 21:24:16 +00:00
|
|
|
static unkptr mpListener;
|
|
|
|
|
|
|
|
/* TODO: Remaining globals */
|
|
|
|
|
|
|
|
static ESurroundModes mSurroundMode;
|
|
|
|
static uint mMaxAramUsage;
|
2023-01-08 01:42:15 +00:00
|
|
|
static uint mCurrentAramUsage;
|
2023-01-07 21:24:16 +00:00
|
|
|
static bool mProLogic2;
|
2022-10-09 05:37:23 +00:00
|
|
|
static const uchar kMaxVolume;
|
2023-01-08 01:42:15 +00:00
|
|
|
static uchar kEmitterMedPriority;
|
2022-08-13 01:26:00 +00:00
|
|
|
};
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CAUDIOSYS
|