Link reverb_fx.c

Former-commit-id: 5b08fd287a
This commit is contained in:
Phillip Stephens 2022-07-26 23:32:31 -07:00
parent abba84e48a
commit 6fc7123b94
3 changed files with 92 additions and 4 deletions

View File

@ -3,6 +3,10 @@
#include "types.h"
#ifndef bool8
typedef char bool8;
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -20,6 +24,55 @@ typedef struct _SND_HOOKS {
void (*free)(void* addr);
} SND_HOOKS;
#define SND_AUX_NUMPARAMETERS 4
typedef struct SND_AUX_INFO {
union SND_AUX_DATA {
struct SND_AUX_BUFFERUPDATE {
s32* left;
s32* right;
s32* surround;
} bufferUpdate;
struct SND_AUX_PARAMETERUPDATE {
u16 para[SND_AUX_NUMPARAMETERS];
} parameterUpdate;
} data;
} SND_AUX_INFO;
typedef struct _SND_REVHI_DELAYLINE {
s32 inPoint;
s32 outPoint;
s32 length;
f32* inputs;
f32 lastOutput;
} _SND_REVHI_DELAYLINE;
typedef struct _SND_REVHI_WORK {
_SND_REVHI_DELAYLINE AP[9];
_SND_REVHI_DELAYLINE C[9];
f32 allPassCoeff;
f32 combCoef[9];
f32 lpLastout[3];
f32 level;
f32 damping;
s32 preDelayTime;
f32 crosstalk;
f32* preDelayLine[3];
f32* preDelayPtr[3];
} _SND_REVHI_WORK;
typedef struct SND_AUX_REVERBHI {
_SND_REVHI_WORK rv;
bool8 tempDisableFX;
f32 coloration;
f32 mix;
f32 time;
f32 damping;
f32 preDelay;
f32 crosstalk;
} SND_AUX_REVERBHI;
#ifdef __cplusplus
}
#endif

View File

@ -808,7 +808,7 @@ MUSYX_FILES :=\
$(BUILD_DIR)/src/musyx/hw_memory.o\
$(BUILD_DIR)/asm/musyx/creverb_fx.o\
$(BUILD_DIR)/asm/musyx/creverb.o\
$(BUILD_DIR)/asm/musyx/reverb_fx.o\
$(BUILD_DIR)/src/musyx/reverb_fx.o\
$(BUILD_DIR)/asm/musyx/reverb.o\
$(BUILD_DIR)/asm/musyx/delay_fx.o\
$(BUILD_DIR)/asm/musyx/chorus_fx.o

35
src/musyx/reverb_fx.c Normal file
View File

@ -0,0 +1,35 @@
#include "musyx/musyx_priv.h"
#ifdef __cplusplus
extern "C" {
#endif
extern bool8 ReverbHICreate(_SND_REVHI_WORK* rev, f32 coloration, f32 time, f32 mix, f32 damping, f32 preDelay, f32 crosstalk);
extern void ReverbHIFree(_SND_REVHI_WORK* rev);
void sndAuxCallbackReverbHI(u8 reason, SND_AUX_INFO* info, void* user) {
switch (reason) {
case 0:
if (*((u8*)user + 0x1c4) == 0) {
ReverbHICallback(info->data.bufferUpdate.left, info->data.bufferUpdate.right, info->data.bufferUpdate.surround, user);
}
/* fallthrough */
case 1:
return;
}
}
bool8 sndAuxCallbackPrepareReverbHI(SND_AUX_REVERBHI *rev) {
rev->tempDisableFX = 0;
return ReverbHICreate(&rev->rv, rev->coloration, rev->time, rev->mix, rev->damping, rev->preDelay, rev->crosstalk);
}
bool8 sndAuxCallbackShutdownReverbHI(SND_AUX_REVERBHI* rev) {
ReverbHIFree(&rev->rv);
return 1;
}
#ifdef __cplusplus
}
#endif