Link creverb_fx.c, minor fixes

This commit is contained in:
Phillip Stephens 2022-07-28 08:50:05 -07:00
parent 51a84f6ed2
commit 7e1b3eeb58
6 changed files with 90 additions and 15 deletions

View File

@ -131,6 +131,7 @@ $(BUILD_DIR)/src/musyx/dsp_import.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/hw_memory.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/reverb_fx.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/delay_fx.o: CFLAGS := $(CFLAGS_MUSYX)
$(BUILD_DIR)/src/musyx/creverb_fx.o: CFLAGS := $(CFLAGS_MUSYX)
#-------------------------------------------------------------------------------

View File

@ -77,8 +77,8 @@ typedef struct SND_AUX_REVERBHI {
} SND_AUX_REVERBHI;
void sndAuxCallbackReverbHI(u8 reason, SND_AUX_INFO* info, void* user);
bool8 sndAuxCallbackPrepareReverbHI(SND_AUX_REVERBHI *rev);
bool8 sndAuxCallbackShutdownReverbHI(SND_AUX_REVERBHI* rev);
s32 sndAuxCallbackPrepareReverbHI(SND_AUX_REVERBHI* rev);
s32 sndAuxCallbackShutdownReverbHI(SND_AUX_REVERBHI* rev);
typedef struct SND_AUX_DELAY {
u32 currentSize[3];
@ -95,12 +95,48 @@ typedef struct SND_AUX_DELAY {
u32 output[3]; // Output volume in % per channel
} SND_AUX_DELAY;
void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user);
s32 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay);
s32 sndAuxCallbackPrepareDelay(SND_AUX_DELAY* rev);
s32 sndAuxCallbackShutdownDelay(SND_AUX_DELAY* rev);
s32 sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI *rev);
void sndAuxCallbackDelay(u8 reason,SND_AUX_INFO *info, void *user);
bool8 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY *delay);
bool8 sndAuxCallbackPrepareDelay(SND_AUX_DELAY *rev);
bool8 sndAuxCallbackShutdownDelay(SND_AUX_DELAY* rev);
typedef struct _SND_REVSTD_DELAYLINE {
s32 inPoint;
s32 outPoint;
s32 length;
f32* inputs;
f32 lastOutput;
} _SND_REVSTD_DELAYLINE;
typedef struct _SND_REVSTD_WORK {
_SND_REVSTD_DELAYLINE AP[6];
_SND_REVSTD_DELAYLINE C[6];
f32 allPassCoeff;
f32 combCoef[6];
f32 lpLastout[3];
f32 level;
f32 damping;
s32 preDelayTime;
f32* preDelayLine[3];
f32* preDelayPtr[3];
} _SND_REVSTD_WORK;
typedef struct SND_AUX_REVERBSTD {
_SND_REVSTD_WORK rv;
bool8 tempDisableFX;
f32 coloration;
f32 mix;
f32 time;
f32 damping;
f32 preDelay;
} SND_AUX_REVERBSTD;
void sndAuxCallbackReverbSTD(u8 reason,SND_AUX_INFO *info,void *user);
s32 sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD *rev);
s32 sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD *rev);
s32 sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD *rev);
#ifdef __cplusplus
}
#endif

View File

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

34
src/musyx/creverb_fx.c Normal file
View File

@ -0,0 +1,34 @@
#include "musyx/musyx_priv.h"
extern s32 ReverbSTDCreate(_SND_REVSTD_WORK* rv, f32 coloration, f32 time, f32 mix, f32 damping, f32 preDelay);
extern void ReverbHIFree(_SND_REVSTD_WORK* rev);
extern void ReverbSTDCallback(s32* left, s32* right, s32* surround, _SND_REVSTD_WORK* rv);
void sndAuxCallbackReverbSTD(u8 reason, SND_AUX_INFO* info, void* user) {
SND_AUX_REVERBSTD* rev ;
switch (reason) {
case SND_AUX_REASON_BUFFERUPDATE:
rev = (SND_AUX_REVERBSTD*)user;
if ((u8)rev->tempDisableFX == 0) {
ReverbSTDCallback(info->data.bufferUpdate.left, info->data.bufferUpdate.right, info->data.bufferUpdate.surround,
&rev->rv);
}
case SND_AUX_REASON_PARAMETERUPDATE:
break;
default:
// ASSERT_MSG(FALSE);
break;
}
}
s32 sndAuxCallbackPrepareReverbSTD(SND_AUX_REVERBSTD* rev) {
rev->tempDisableFX = 0;
return ReverbSTDCreate(&rev->rv, rev->coloration, rev->time, rev->mix, rev->damping, rev->preDelay);
}
s32 sndAuxCallbackShutdownReverbSTD(SND_AUX_REVERBSTD* rev) {
ReverbSTDFree(&rev->rv);
return 1;
}
s32 sndAuxCallbackUpdateSettingsReverbSTD(SND_AUX_REVERBSTD* rev) { /* not in MP */
}

View File

@ -24,7 +24,7 @@ void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user) {
s32* surPtr;
SND_AUX_DELAY* delay;
switch (reason) {
case 0:
case SND_AUX_REASON_BUFFERUPDATE:
delay = (SND_AUX_DELAY*)user;
leftOffset = delay->left + (delay->currentPos[0] * 160);
leftPtr = info->data.bufferUpdate.left;
@ -52,14 +52,14 @@ void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user) {
delay->currentPos[0] = (delay->currentPos[0] + 1) % delay->currentSize[0];
delay->currentPos[1] = (delay->currentPos[1] + 1) % delay->currentSize[1];
delay->currentPos[2] = (delay->currentPos[2] + 1) % delay->currentSize[2];
case 1: break;
case SND_AUX_REASON_PARAMETERUPDATE: break;
default:
// ASSERT_MSG(FALSE);
break;
}
}
bool8 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
s32 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
s32 i;
s32* left;
s32* right;
@ -99,12 +99,12 @@ bool8 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) {
return 1;
}
bool8 sndAuxCallbackPrepareDelay(SND_AUX_DELAY* delay) {
s32 sndAuxCallbackPrepareDelay(SND_AUX_DELAY* delay) {
delay->left = NULL;
return sndAuxCallbackUpdateSettingsDelay(delay);
}
bool8 sndAuxCallbackShutdownDelay(SND_AUX_DELAY* delay) {
s32 sndAuxCallbackShutdownDelay(SND_AUX_DELAY* delay) {
if (delay->left != NULL) {
salFree(delay->left);
salFree(delay->right);

View File

@ -17,7 +17,7 @@
extern bool8 ReverbHICreate(_SND_REVHI_WORK* rev, f32 coloration, f32 time, f32 mix, f32 damping, f32 preDelay, f32 crosstalk);
extern s32 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) {
@ -36,12 +36,16 @@ void sndAuxCallbackReverbHI(u8 reason, SND_AUX_INFO* info, void* user) {
}
}
bool8 sndAuxCallbackPrepareReverbHI(SND_AUX_REVERBHI *rev) {
s32 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) {
s32 sndAuxCallbackShutdownReverbHI(SND_AUX_REVERBHI* rev) {
ReverbHIFree(&rev->rv);
return 1;
}
s32 sndAuxCallbackUpdateSettingsReverbHI(SND_AUX_REVERBHI *rev) {
/* not in MP */
}