2022-11-04 14:58:34 +00:00
|
|
|
#ifndef _CSCRIPTROOMACOUSTICS
|
|
|
|
#define _CSCRIPTROOMACOUSTICS
|
|
|
|
|
|
|
|
#include "MetroidPrime/CEntity.hpp"
|
|
|
|
|
|
|
|
#include "Kyoto/Audio/CSfxManager.hpp"
|
|
|
|
|
|
|
|
struct EffectReverbHiInfo {
|
|
|
|
float time; /**< [0.01, 10.0] time in seconds for reflection decay */
|
|
|
|
float preDelay; /**< [0.0, 0.1] time in seconds before initial reflection heard */
|
2023-10-23 04:18:22 +00:00
|
|
|
float damping; /**< [0.0, 1.0] damping factor influencing low-pass filter of reflections */
|
|
|
|
float coloration; /**< [0.0, 1.0] influences filter coefficients to define surface characteristics
|
|
|
|
of a room */
|
2022-11-04 14:58:34 +00:00
|
|
|
float crosstalk; /**< [0.0, 1.0] factor defining how much reflections are allowed to bleed to
|
|
|
|
other channels */
|
2023-10-23 04:18:22 +00:00
|
|
|
float mix; /**< [0.0, 1.0] dry/wet mix factor of reverb effect */
|
2022-11-04 14:58:34 +00:00
|
|
|
|
2023-10-23 04:18:22 +00:00
|
|
|
EffectReverbHiInfo(float time, float preDelay, float damping, float coloration, float crosstalk,
|
|
|
|
float mix)
|
|
|
|
: time(time)
|
2022-11-04 14:58:34 +00:00
|
|
|
, preDelay(preDelay)
|
2023-10-23 04:18:22 +00:00
|
|
|
, damping(damping)
|
|
|
|
, coloration(coloration)
|
|
|
|
, crosstalk(crosstalk)
|
|
|
|
, mix(mix) {}
|
2022-11-04 14:58:34 +00:00
|
|
|
};
|
|
|
|
struct EffectChorusInfo {
|
|
|
|
float baseDelay;
|
|
|
|
float variation;
|
|
|
|
float period;
|
|
|
|
|
|
|
|
EffectChorusInfo(float baseDelay, float variation, float period)
|
|
|
|
: baseDelay(baseDelay), variation(variation), period(period) {}
|
|
|
|
};
|
|
|
|
struct EffectReverbStdInfo {
|
2023-10-23 04:18:22 +00:00
|
|
|
float time; /**< [0.01, 10.0] time in seconds for reflection decay */
|
|
|
|
float preDelay; /**< [0.0, 0.1] time in seconds before initial reflection heard */
|
|
|
|
float damping; /**< [0.0, 1.0] damping factor influencing low-pass filter of reflections */
|
2022-11-04 14:58:34 +00:00
|
|
|
float coloration; /**< [0.0, 1.0] influences filter coefficients to define surface characteristics
|
|
|
|
of a room */
|
|
|
|
float mix; /**< [0.0, 1.0] dry/wet mix factor of reverb effect */
|
|
|
|
|
2023-10-23 04:18:22 +00:00
|
|
|
EffectReverbStdInfo(float time, float preDelay, float damping, float coloration, float mix)
|
|
|
|
: time(time), preDelay(preDelay), damping(damping), coloration(coloration), mix(mix) {}
|
2022-11-04 14:58:34 +00:00
|
|
|
};
|
|
|
|
struct EffectDelayInfo {
|
|
|
|
int delayL;
|
|
|
|
int delayR;
|
|
|
|
int delayS;
|
|
|
|
int feedbackL;
|
|
|
|
int feedbackR;
|
|
|
|
int feedbackS;
|
|
|
|
int outputL;
|
|
|
|
int outputR;
|
|
|
|
int outputS;
|
|
|
|
|
|
|
|
EffectDelayInfo(int delayL, int delayR, int delayS, int feedbackL, int feedbackR, int feedbackS,
|
|
|
|
int outputL, int outputR, int outputS)
|
|
|
|
: delayL(delayL)
|
|
|
|
, delayR(delayR)
|
|
|
|
, delayS(delayS)
|
|
|
|
, feedbackL(feedbackL)
|
|
|
|
, feedbackR(feedbackR)
|
|
|
|
, feedbackS(feedbackS)
|
|
|
|
, outputL(outputL)
|
|
|
|
, outputR(outputR)
|
|
|
|
, outputS(outputS) {}
|
|
|
|
};
|
|
|
|
|
|
|
|
class CScriptRoomAcoustics : public CEntity {
|
|
|
|
public:
|
|
|
|
CScriptRoomAcoustics(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
|
|
|
bool active, uint volScale, bool revHi, bool revHiDis, float revHiColoration,
|
|
|
|
float revHiMix, float revHiTime, float revHiDamping, float revHiPreDelay,
|
|
|
|
float revHiCrosstalk, bool chorus, float baseDelay, float variation,
|
|
|
|
float period, bool revStd, bool revStdDis, float revStdColoration,
|
|
|
|
float revStdMix, float revStdTime, float revStdDamping, float revStdPreDelay,
|
|
|
|
bool delay, int delayL, int delayR, int delayS, int feedbackL, int feedbackR,
|
|
|
|
int feedbackS, int outputL, int outputR, int outputS);
|
|
|
|
virtual ~CScriptRoomAcoustics();
|
|
|
|
|
2023-02-06 17:01:01 +00:00
|
|
|
void Think(float dt, CStateManager& stateMgr) override;
|
|
|
|
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) override;
|
|
|
|
void Accept(IVisitor& visitor) override;
|
2022-11-04 14:58:34 +00:00
|
|
|
void EnableAuxCallbacks();
|
|
|
|
|
|
|
|
static void DisableAuxCallbacks();
|
|
|
|
|
|
|
|
private:
|
|
|
|
uint x34_volumeScale;
|
|
|
|
|
|
|
|
bool x38_revHi, x39_revHiDis;
|
|
|
|
EffectReverbHiInfo x3c_revHiInfo;
|
|
|
|
|
|
|
|
bool x54_chorus;
|
|
|
|
EffectChorusInfo x58_chorusInfo;
|
|
|
|
|
|
|
|
bool x64_revStd, x65_revStdDis;
|
|
|
|
EffectReverbStdInfo x68_revStdInfo;
|
|
|
|
|
|
|
|
bool x7c_delay;
|
|
|
|
EffectDelayInfo x80_delayInfo;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _CSCRIPTROOMACOUSTICS
|