X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fdfsound%2Freverb.c;h=7e32b8e875b5957536eeffe5a7340639eb1fae50;hb=8f5f2dd5a70f47322614eda6f97304808447199c;hp=0a94ff4a5696490937a92bd3e50659544e1a90ef;hpb=650adfd2da779ba8855623362c2900583e22931e;p=pcsx_rearmed.git diff --git a/plugins/dfsound/reverb.c b/plugins/dfsound/reverb.c index 0a94ff4a..7e32b8e8 100644 --- a/plugins/dfsound/reverb.c +++ b/plugins/dfsound/reverb.c @@ -26,36 +26,17 @@ // will be included from spu.c #ifdef _IN_SPU -//////////////////////////////////////////////////////////////////////// -// globals -//////////////////////////////////////////////////////////////////////// - -// REVERB info and timing vars... - -int * sRVBPlay = 0; -int * sRVBEnd = 0; -int * sRVBStart = 0; - //////////////////////////////////////////////////////////////////////// // START REVERB //////////////////////////////////////////////////////////////////////// INLINE void StartREVERB(int ch) { - if(s_chan[ch].bReverb && (spuCtrl&0x80)) // reverb possible? + if(spu.s_chan[ch].bReverb && (spu.spuCtrl&0x80)) // reverb possible? { - s_chan[ch].bRVBActive=!!iUseReverb; + spu.s_chan[ch].bRVBActive=!!spu_config.iUseReverb; } - else s_chan[ch].bRVBActive=0; // else -> no reverb -} - -//////////////////////////////////////////////////////////////////////// -// HELPER FOR NEILL'S REVERB: re-inits our reverb mixing buf -//////////////////////////////////////////////////////////////////////// - -INLINE void InitREVERB(int ns_to) -{ - memset(sRVBStart,0,ns_to*sizeof(sRVBStart[0])*2); + else spu.s_chan[ch].bRVBActive=0; // else -> no reverb } //////////////////////////////////////////////////////////////////////// @@ -69,21 +50,21 @@ INLINE int rvb2ram_offs(int curr, int space, int iOff) // get_buffer content helper: takes care about wraps #define g_buffer(var) \ - ((int)(signed short)spuMem[rvb2ram_offs(curr_addr, space, rvb.n##var)]) + ((int)(signed short)spu.spuMem[rvb2ram_offs(curr_addr, space, rvb.n##var)]) // saturate iVal and store it as var #define s_buffer(var, iVal) \ ssat32_to_16(iVal); \ - spuMem[rvb2ram_offs(curr_addr, space, rvb.n##var)] = iVal + spu.spuMem[rvb2ram_offs(curr_addr, space, rvb.n##var)] = iVal #define s_buffer1(var, iVal) \ ssat32_to_16(iVal); \ - spuMem[rvb2ram_offs(curr_addr, space, rvb.n##var + 1)] = iVal + spu.spuMem[rvb2ram_offs(curr_addr, space, rvb.n##var + 1)] = iVal //////////////////////////////////////////////////////////////////////// // portions based on spu2-x from PCSX2 -static void MixREVERB(int ns_to) +static void MixREVERB(int *SSumLR, int *RVB, int ns_to) { int l_old = rvb.iRVBLeft; int r_old = rvb.iRVBRight; @@ -97,8 +78,8 @@ static void MixREVERB(int ns_to) int ACC0, ACC1, FB_A0, FB_A1, FB_B0, FB_B1; int mix_dest_a0, mix_dest_a1, mix_dest_b0, mix_dest_b1; - int input_L = sRVBStart[ns] * rvb.IN_COEF_L; - int input_R = sRVBStart[ns+1] * rvb.IN_COEF_R; + int input_L = RVB[ns] * rvb.IN_COEF_L; + int input_R = RVB[ns+1] * rvb.IN_COEF_R; int IIR_INPUT_A0 = ((g_buffer(IIR_SRC_A0) * rvb.IIR_COEF) + input_L) >> 15; int IIR_INPUT_A1 = ((g_buffer(IIR_SRC_A1) * rvb.IIR_COEF) + input_R) >> 15; @@ -168,7 +149,7 @@ static void MixREVERB(int ns_to) rvb.CurrAddr = curr_addr; } -static void MixREVERB_off(int ns_to) +static void MixREVERB_off(int *SSumLR, int ns_to) { int l_old = rvb.iRVBLeft; int r_old = rvb.iRVBRight; @@ -246,7 +227,7 @@ static void prepare_offsets(void) rvb.dirty = 0; } -INLINE void REVERBDo(int ns_to) +INLINE void REVERBDo(int *SSumLR, int *RVB, int ns_to) { if (!rvb.StartAddr) // reverb is off { @@ -254,19 +235,19 @@ INLINE void REVERBDo(int ns_to) return; } - if (spuCtrl & 0x80) // -> reverb on? oki + if (spu.spuCtrl & 0x80) // -> reverb on? oki { if (unlikely(rvb.dirty)) prepare_offsets(); - MixREVERB(ns_to); + MixREVERB(SSumLR, RVB, ns_to); } else if (rvb.VolLeft || rvb.VolRight) { if (unlikely(rvb.dirty)) prepare_offsets(); - MixREVERB_off(ns_to); + MixREVERB_off(SSumLR, ns_to); } else // -> reverb off {