2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CSFXMANAGER
|
|
|
|
#define _CSFXMANAGER
|
2022-04-10 00:17:06 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-11-07 00:20:46 +00:00
|
|
|
#include "Kyoto/Audio/CAudioSys.hpp"
|
2022-08-15 04:51:06 +00:00
|
|
|
#include "Kyoto/Audio/CSfxHandle.hpp"
|
|
|
|
|
2022-11-04 14:58:34 +00:00
|
|
|
struct _SND_REVSTD_DELAYLINE {
|
|
|
|
int inPoint;
|
|
|
|
int outPoint;
|
|
|
|
int length;
|
|
|
|
float* inputs;
|
|
|
|
float lastOutput;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct _SND_REVSTD_WORK {
|
|
|
|
struct _SND_REVSTD_DELAYLINE AP[6];
|
|
|
|
struct _SND_REVSTD_DELAYLINE C[6];
|
|
|
|
float allPassCoef;
|
|
|
|
float combCoef[6];
|
|
|
|
float lpLastout[3];
|
|
|
|
float level;
|
|
|
|
float damping;
|
|
|
|
int preDelayTime;
|
|
|
|
float* preDelayLine[3];
|
|
|
|
float* preDelayPtr[3];
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SND_AUX_REVERBHI {
|
|
|
|
uchar pad0[0x1c4];
|
|
|
|
bool hiDis;
|
|
|
|
float damping;
|
|
|
|
float crosstalk;
|
|
|
|
float coloration;
|
|
|
|
float time;
|
|
|
|
float mix;
|
|
|
|
float preDelay;
|
|
|
|
};
|
|
|
|
struct SND_AUX_CHORUS {
|
|
|
|
uchar pad[144];
|
|
|
|
uint baseDelay;
|
|
|
|
uint variation;
|
|
|
|
uint period;
|
|
|
|
};
|
|
|
|
struct SND_AUX_REVERBSTD {
|
|
|
|
_SND_REVSTD_WORK rv;
|
|
|
|
bool tempDisableFX;
|
|
|
|
float damping;
|
|
|
|
float preDelay;
|
|
|
|
float coloration;
|
|
|
|
float time;
|
|
|
|
float mix;
|
|
|
|
};
|
|
|
|
struct SND_AUX_DELAY {
|
|
|
|
uint currentSize[3];
|
|
|
|
uint currentPos[3];
|
|
|
|
uint currentFeedback[3];
|
|
|
|
uint currentOutput[3];
|
|
|
|
uint* left;
|
|
|
|
uint* right;
|
|
|
|
uint* sur;
|
|
|
|
uint delay[3]; // delay buffer length in ms per channel
|
|
|
|
uint feedback[3]; // feedback volume in % per channel
|
|
|
|
uint output[3]; // output volume in % per channel
|
|
|
|
};
|
|
|
|
|
2022-10-05 23:34:32 +00:00
|
|
|
class CVector3f;
|
2022-04-10 00:17:06 +00:00
|
|
|
class CSfxManager {
|
|
|
|
public:
|
2022-10-13 23:31:53 +00:00
|
|
|
enum ESfxChannels { kSC_Invalid = -1, kSC_Default = 0, kSC_Game, kSC_PauseScreen };
|
|
|
|
|
2022-10-09 05:37:23 +00:00
|
|
|
static void Update(float dt);
|
2022-08-15 04:51:06 +00:00
|
|
|
static void RemoveEmitter(CSfxHandle handle);
|
2022-10-03 16:23:22 +00:00
|
|
|
static void UpdateEmitter(CSfxHandle handle, const CVector3f& pos, const CVector3f& dir,
|
2022-10-02 10:13:35 +00:00
|
|
|
uchar maxVol);
|
2022-10-05 00:16:03 +00:00
|
|
|
|
2022-10-09 05:37:23 +00:00
|
|
|
static const short kMaxPriority; // 0xFF
|
|
|
|
static const short kMedPriority; // 0x7F
|
|
|
|
static const ushort kInternalInvalidSfxId; // 0xFFFF
|
|
|
|
static const int kAllAreas; // 0xFFFFFFFF
|
|
|
|
static CSfxHandle AddEmitter(ushort id, const CVector3f& pos, const CVector3f& dir,
|
|
|
|
bool useAcoustics, bool looped, short prio = kMedPriority,
|
2022-10-05 00:16:03 +00:00
|
|
|
int areaId = kAllAreas);
|
2022-10-09 05:37:23 +00:00
|
|
|
static CSfxHandle AddEmitter(ushort id, const CVector3f& pos, const CVector3f& dir, uchar vol,
|
|
|
|
bool useAcoustics, bool looped, short prio = kMedPriority,
|
2022-10-05 00:16:03 +00:00
|
|
|
int areaId = kAllAreas);
|
2022-11-07 00:20:46 +00:00
|
|
|
|
|
|
|
static void AddListener(ESfxChannels channel, const CVector3f& pos, const CVector3f& dir,
|
|
|
|
const CVector3f& vec1, const CVector3f& vec2, float f1, float f2,
|
2022-11-07 00:47:16 +00:00
|
|
|
float f3, uint w1, const uchar maxVolume);
|
2022-10-01 06:19:09 +00:00
|
|
|
static void Shutdown();
|
2022-10-09 05:37:23 +00:00
|
|
|
static ushort TranslateSFXID(ushort);
|
2022-10-02 10:13:35 +00:00
|
|
|
|
2022-10-03 16:04:56 +00:00
|
|
|
static void PitchBend(CSfxHandle handle, int pitch);
|
2022-10-06 14:24:38 +00:00
|
|
|
|
2022-10-09 05:37:23 +00:00
|
|
|
static CSfxHandle SfxStart(ushort id, uchar vol, uchar pan, bool useAcoustics, short prio,
|
|
|
|
bool looped, int areaId);
|
2022-10-06 19:38:21 +00:00
|
|
|
static bool IsPlaying(const CSfxHandle& handle);
|
2022-10-13 23:31:53 +00:00
|
|
|
|
|
|
|
static void SetChannel(ESfxChannels);
|
|
|
|
static void KillAll(ESfxChannels);
|
|
|
|
static void TurnOnChannel(ESfxChannels);
|
|
|
|
static void TurnOffChannel(ESfxChannels);
|
2022-11-04 14:58:34 +00:00
|
|
|
|
|
|
|
static void DisableAuxCallback();
|
|
|
|
static void EnableAuxCallback();
|
|
|
|
static void PrepareDelayCallback(const SND_AUX_DELAY& info);
|
|
|
|
static void PrepareReverbStdCallback(const SND_AUX_REVERBSTD& info);
|
|
|
|
static void PrepareChorusCallback(const SND_AUX_CHORUS& info);
|
|
|
|
static void PrepareReverbHiCallback(const SND_AUX_REVERBHI& info);
|
|
|
|
static void DisableAuxProcessing();
|
2022-04-10 00:17:06 +00:00
|
|
|
};
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CSFXMANAGER
|