From 7d56323cd45760140d7b6b3ecc73eb3a2a602045 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Thu, 28 Jul 2022 07:24:49 -0700 Subject: [PATCH] Line match reverb_fx.c and delay_fx.c for S&Gs Former-commit-id: 51a84f6ed2607d20b64573abad33857253bf2320 --- src/musyx/delay_fx.c | 29 +++++++++++++++++++++-------- src/musyx/reverb_fx.c | 27 ++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/src/musyx/delay_fx.c b/src/musyx/delay_fx.c index 2b6a4b27..23d3ddac 100644 --- a/src/musyx/delay_fx.c +++ b/src/musyx/delay_fx.c @@ -1,3 +1,14 @@ +/* --------------------------------------- + + + + + + + + + --------------------------------------- +*/ #include "musyx/musyx_priv.h" void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user) { @@ -12,7 +23,6 @@ void sndAuxCallbackDelay(u8 reason, SND_AUX_INFO* info, void* user) { s32* rightPtr; s32* surPtr; SND_AUX_DELAY* delay; - switch (reason) { case 0: delay = (SND_AUX_DELAY*)user; @@ -42,9 +52,10 @@ 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]; - /* fallthrough */ - case 1: - return; + case 1: break; + default: + // ASSERT_MSG(FALSE); + break; } } @@ -62,13 +73,15 @@ bool8 sndAuxCallbackUpdateSettingsDelay(SND_AUX_DELAY* delay) { delay->currentOutput[i] = (delay->output[i] << 7) / 100; } - delay->left = (s32*)salMalloc(delay->currentSize[0] * 0x280); - delay->right = (s32*)salMalloc(delay->currentSize[1] * 0x280); - delay->sur = (s32*)salMalloc(delay->currentSize[2] * 0x280); - + delay->left = (s32*)salMalloc(delay->currentSize[0] * 160 * 4); + delay->right = (s32*)salMalloc(delay->currentSize[1] * 160 * 4); + delay->sur = (s32*)salMalloc(delay->currentSize[2] * 160 * 4); left = delay->left; right = delay->right; sur = delay->sur; + // ASSERT_MSG(delay->left!=NULL); + // ASSERT_MSG(delay->right!=NULL); + // ASSERT_MSG(delay->sur!=NULL); for (i = 0; i < delay->currentSize[0] * 160; ++i) { *left = 0; diff --git a/src/musyx/reverb_fx.c b/src/musyx/reverb_fx.c index 82a3478b..38f51cdb 100644 --- a/src/musyx/reverb_fx.c +++ b/src/musyx/reverb_fx.c @@ -1,5 +1,22 @@ +/* --------------------------------------- + + + + + + + + + --------------------------------------- +*/ + #include "musyx/musyx_priv.h" + + + + + 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); @@ -7,11 +24,15 @@ void sndAuxCallbackReverbHI(u8 reason, SND_AUX_INFO* info, void* user) { switch (reason) { case SND_AUX_REASON_BUFFERUPDATE: if (((SND_AUX_REVERBHI*)user)->tempDisableFX == 0) { - ReverbHICallback(info->data.bufferUpdate.left, info->data.bufferUpdate.right, info->data.bufferUpdate.surround, user); + ReverbHICallback(info->data.bufferUpdate.left, + info->data.bufferUpdate.right, + info->data.bufferUpdate.surround, user); } - /* fallthrough */ case SND_AUX_REASON_PARAMETERUPDATE: - return; + break; + default: + //ASSERT_MSG(FALSE); + break; } }