Some work on the fake reverb. Renamed it to "Custom Reverb" and the original to "SPU2 Reverb".

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4665 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2011-05-23 17:14:56 +00:00
parent 8e28873436
commit c440b442ac
5 changed files with 109 additions and 100 deletions

View File

@ -177,8 +177,8 @@ void DisplayDialog()
reverb_label = gtk_label_new ("Reverb Mode Selection:");
reverb_box = gtk_combo_box_new_text ();
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "Normal Reverb");
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "Fake Reverb");
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "SPU2 Reverb");
gtk_combo_box_append_text(GTK_COMBO_BOX(reverb_box), "Custom Reverb");
gtk_combo_box_set_active(GTK_COMBO_BOX(reverb_box), ReverbMode);
debug_check = gtk_check_button_new_with_label("Enable Debug Options");

View File

@ -705,7 +705,7 @@ StereoOut32 V_Core::Mix( const VoiceMixSet& inVoices, const StereoOut32& Input,
WaveDump::WriteCore( Index, CoreSrc_PreReverb, TW );
StereoOut32 RV;
// Fake reverb active?
// Custom reverb active?
if (ReverbMode == 1)
RV = DoReverb_Fake( TW );
else

View File

@ -282,7 +282,7 @@ StereoOut32 V_Core::DoReverb( const StereoOut32& Input )
StereoOut32 V_Core::DoReverb_Fake( const StereoOut32& Input )
{
if(!FakeReverbActive)
if(!FakeReverbActive /*|| (Cycles&1) == 0*/)
return StereoOut32::Empty;
V_Core& thiscore(Cores[Index]);
@ -300,28 +300,34 @@ StereoOut32 V_Core::DoReverb_Fake( const StereoOut32& Input )
const s32 InputR = -0x3fff;
// Echo 1: Positive, short delay
const u32 Echo1L = 0x3700; // must be even!
const u32 Echo1R = 0x2704; // must be even!
const u32 Echo1L = 0x3700;
const u32 Echo1R = 0x2704;
const s32 Echo1A = 0x5000 / 8;
// Echo 2: Negative, slightly longer delay, quiet
const u32 Echo2L = 0x2f10; // must be even!
const u32 Echo2R = 0x1f04; // must be even!
const u32 Echo2L = 0x2f10;
const u32 Echo2R = 0x1f04;
const s32 Echo2A = 0x4c00 / 8;
// Echo 3: Negative, longer delay, full feedback
const u32 Echo3L = 0x2800 ; // must be even!
const u32 Echo3R = 0x1b34 ; // must be even!
const u32 Echo3L = 0x2800;
const u32 Echo3R = 0x1b34;
const s32 Echo3A = 0xb800 / 8;
// Echo 4: Negative, longer delay, full feedback
const u32 Echo4L = 0x2708 ; // must be even!
const u32 Echo4R = 0x1704 ; // must be even!
const u32 Echo4L = 0x2708;
const u32 Echo4R = 0x1704;
const s32 Echo4A = 0xbc00 / 8;
const u32 CrossChannelL = 0x0694 ; // must be even!
const u32 CrossChannelR = 0x04e4 ; // must be even!
const u32 CrossChannelA = 0x6000 / 2;
// Output control:
const u32 Mix1L = thiscore.Revb.MIX_DEST_A0;
const u32 Mix1R = thiscore.Revb.MIX_DEST_A1;
const u32 Mix2L = thiscore.Revb.MIX_DEST_B0;
const u32 Mix2R = thiscore.Revb.MIX_DEST_B1;
const u32 CrossChannelL = 0x4694;
const u32 CrossChannelR = 0x52e4;
const u32 CrossChannelA = thiscore.Revb.FB_ALPHA / 8;
///////////////////////////////////////////////////////////
// part 1: input
@ -367,12 +373,6 @@ StereoOut32 V_Core::DoReverb_Fake( const StereoOut32& Input )
s32 ccR = Base[WrapAround(thiscore,CrossChannelR )] * CrossChannelA;
accL += ccL;
accR += ccR;
///////////////////////////////////////////////////////////
// part N-2: filter
if (accL > -200000 && accL < 200000) accL /= 4;
if (accR > -200000 && accR < 200000) accR /= 4;
///////////////////////////////////////////////////////////
// part N-1: normalize output
@ -383,10 +383,17 @@ StereoOut32 V_Core::DoReverb_Fake( const StereoOut32& Input )
///////////////////////////////////////////////////////////
// part N: write output
s32 tmpL = accL>>5;
s32 tmpL = accL>>5; // reduce the volume
s32 tmpR = accR>>5;
Base[WrapAround(thiscore,0)] = clamp_mix(accL-tmpL);
Base[WrapAround(thiscore,1)] = clamp_mix(accR-tmpR);
return StereoOut32(accL,accR);
Base[WrapAround(thiscore,Mix1L)] = clamp_mix(accL-tmpL);
Base[WrapAround(thiscore,Mix1R)] = clamp_mix(accR-tmpR);
Base[WrapAround(thiscore,Mix2L)] = clamp_mix(accL-tmpL);
Base[WrapAround(thiscore,Mix2R)] = clamp_mix(accR-tmpR);
s32 returnL = Base[WrapAround(thiscore,Mix1L)] + Base[WrapAround(thiscore,Mix2L)];
s32 returnR = Base[WrapAround(thiscore,Mix1R)] + Base[WrapAround(thiscore,Mix2R)];
return StereoOut32(returnL,returnR);
}

View File

@ -153,8 +153,8 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_SETCURSEL,Interpolation,0 );
SendDialogMsg( hWnd, IDC_REVERB_MODE, CB_RESETCONTENT,0,0 );
SendDialogMsg( hWnd, IDC_REVERB_MODE, CB_ADDSTRING,0,(LPARAM) L"Normal Reverb" );
SendDialogMsg( hWnd, IDC_REVERB_MODE, CB_ADDSTRING,0,(LPARAM) L"Fake Reverb" );
SendDialogMsg( hWnd, IDC_REVERB_MODE, CB_ADDSTRING,0,(LPARAM) L"SPU2 Reverb" );
SendDialogMsg( hWnd, IDC_REVERB_MODE, CB_ADDSTRING,0,(LPARAM) L"Custom Reverb" );
SendDialogMsg( hWnd, IDC_REVERB_MODE, CB_SETCURSEL,ReverbMode,0 );
SendDialogMsg( hWnd, IDC_SYNCHMODE, CB_RESETCONTENT,0,0 );

View File

@ -222,80 +222,82 @@ void V_Core::Reset( int index )
void V_Core::AnalyzeReverbPreset()
{
//ConLog("Reverb Parameter Update:\n");
//ConLog("----------------------------------------------------------\n");
//
//ConLog(" IN_COEF_L, IN_COEF_R 0x%08x, 0x%08x\n", Revb.IN_COEF_L, Revb.IN_COEF_R);
//ConLog(" FB_SRC_A, FB_SRC_B 0x%08x, 0x%08x\n", Revb.FB_SRC_A, Revb.FB_SRC_B);
//ConLog(" FB_ALPHA, FB_X 0x%08x, 0x%08x\n", Revb.FB_ALPHA, Revb.FB_X);
//
//ConLog(" ACC_COEF_A 0x%08x\n", Revb.ACC_COEF_A);
//ConLog(" ACC_COEF_B 0x%08x\n", Revb.ACC_COEF_B);
//ConLog(" ACC_COEF_C 0x%08x\n", Revb.ACC_COEF_C);
//ConLog(" ACC_COEF_D 0x%08x\n", Revb.ACC_COEF_D);
//ConLog(" MIX_DEST_A0 0x%08x\n", Revb.MIX_DEST_A0);
//ConLog(" MIX_DEST_A1 0x%08x\n", Revb.MIX_DEST_A1);
//ConLog(" MIX_DEST_B0 0x%08x\n", Revb.MIX_DEST_B0);
//ConLog(" MIX_DEST_B1 0x%08x\n", Revb.MIX_DEST_B1);
//
//ConLog(" ACC_SRC_A0, ACC_SRC_A1 0x%08x, 0x%08x\n", Revb.ACC_SRC_A0, Revb.ACC_SRC_A1);
//ConLog(" ACC_SRC_B0, ACC_SRC_B1 0x%08x, 0x%08x\n", Revb.ACC_SRC_B0, Revb.ACC_SRC_B1);
//ConLog(" ACC_SRC_C0, ACC_SRC_C1 0x%08x, 0x%08x\n", Revb.ACC_SRC_C0, Revb.ACC_SRC_C1);
//ConLog(" ACC_SRC_D0, ACC_SRC_D1 0x%08x, 0x%08x\n", Revb.ACC_SRC_D0, Revb.ACC_SRC_D1);
//
//ConLog(" IIR_SRC_A0, IIR_SRC_A1 0x%08x, 0x%08x\n", Revb.IIR_SRC_A0, Revb.IIR_SRC_A1);
//ConLog(" IIR_SRC_B0, IIR_SRC_B1 0x%08x, 0x%08x\n", Revb.IIR_SRC_B0, Revb.IIR_SRC_B1);
//ConLog(" IIR_DEST_A0, IIR_DEST_A1 0x%08x, 0x%08x\n", Revb.IIR_DEST_A0, Revb.IIR_DEST_A1);
//ConLog(" IIR_DEST_B0, IIR_DEST_B1 0x%08x, 0x%08x\n", Revb.IIR_DEST_B0, Revb.IIR_DEST_B1);
//
//ConLog("----------------------------------------------------------\n");
u32 Reverb_Parameters[] = { // 32 values
// Coefs/Alphas // L/0 // R/1 // params here / total
Revb.IN_COEF_L, Revb.IN_COEF_R, // 2 / 2
Revb.ACC_COEF_A, Revb.ACC_SRC_A0, Revb.ACC_SRC_A1,
Revb.ACC_COEF_B, Revb.ACC_SRC_B0, Revb.ACC_SRC_B1,
Revb.ACC_COEF_C, Revb.ACC_SRC_C0, Revb.ACC_SRC_C1,
Revb.ACC_COEF_D, Revb.ACC_SRC_D0, Revb.ACC_SRC_D1, // 12 / 14
Revb.IIR_ALPHA, // 1 / 15
Revb.IIR_COEF, // 1 / 16
Revb.IIR_DEST_A0, Revb.IIR_DEST_A1,
Revb.IIR_DEST_B0, Revb.IIR_DEST_B1, // 4 / 20
Revb.IIR_SRC_A0, Revb.IIR_SRC_A1,
Revb.IIR_SRC_B0, Revb.IIR_SRC_B1, // 4 / 24
Revb.MIX_DEST_A0, Revb.MIX_DEST_A1,
Revb.MIX_DEST_B0, Revb.MIX_DEST_B1, // 4 / 28
Revb.FB_ALPHA, Revb.FB_SRC_A, Revb.FB_SRC_B, // 3 / 31
EffectsBufferSize // 1 / 32
};
ConLog("Reverb Parameter Update:\n");
ConLog("--------------------------------------------\n");
ConLog(" { /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[ 0], Reverb_Parameters[ 1]);
ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[ 2], Reverb_Parameters[ 3], Reverb_Parameters[ 4]);
ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[ 5], Reverb_Parameters[ 6], Reverb_Parameters[ 7]);
ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[ 8], Reverb_Parameters[ 9], Reverb_Parameters[10]);
ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[11], Reverb_Parameters[12], Reverb_Parameters[13]);
ConLog( " 0x%08x,\n", Reverb_Parameters[14]);
ConLog( " 0x%08x,\n", Reverb_Parameters[15]);
ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[16], Reverb_Parameters[17]);
ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[18], Reverb_Parameters[19]);
ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[20], Reverb_Parameters[21]);
ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[22], Reverb_Parameters[23]);
ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[24], Reverb_Parameters[25]);
ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[26], Reverb_Parameters[27]);
ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[28], Reverb_Parameters[29], Reverb_Parameters[30]);
ConLog( " 0x%08x }\n", Reverb_Parameters[31]);
ConLog("--------------------------------------------\n");
ConLog("----------------------------------------------------------\n");
ConLog(" IN_COEF_L, IN_COEF_R 0x%08x, 0x%08x\n", Revb.IN_COEF_L, Revb.IN_COEF_R);
ConLog(" FB_SRC_A, FB_SRC_B 0x%08x, 0x%08x\n", Revb.FB_SRC_A, Revb.FB_SRC_B);
ConLog(" FB_ALPHA, FB_X 0x%08x, 0x%08x\n", Revb.FB_ALPHA, Revb.FB_X);
ConLog(" ACC_COEF_A 0x%08x\n", Revb.ACC_COEF_A);
ConLog(" ACC_COEF_B 0x%08x\n", Revb.ACC_COEF_B);
ConLog(" ACC_COEF_C 0x%08x\n", Revb.ACC_COEF_C);
ConLog(" ACC_COEF_D 0x%08x\n", Revb.ACC_COEF_D);
ConLog(" MIX_DEST_A0 0x%08x\n", Revb.MIX_DEST_A0);
ConLog(" MIX_DEST_A1 0x%08x\n", Revb.MIX_DEST_A1);
ConLog(" MIX_DEST_B0 0x%08x\n", Revb.MIX_DEST_B0);
ConLog(" MIX_DEST_B1 0x%08x\n", Revb.MIX_DEST_B1);
ConLog(" ACC_SRC_A0, ACC_SRC_A1 0x%08x, 0x%08x\n", Revb.ACC_SRC_A0, Revb.ACC_SRC_A1);
ConLog(" ACC_SRC_B0, ACC_SRC_B1 0x%08x, 0x%08x\n", Revb.ACC_SRC_B0, Revb.ACC_SRC_B1);
ConLog(" ACC_SRC_C0, ACC_SRC_C1 0x%08x, 0x%08x\n", Revb.ACC_SRC_C0, Revb.ACC_SRC_C1);
ConLog(" ACC_SRC_D0, ACC_SRC_D1 0x%08x, 0x%08x\n", Revb.ACC_SRC_D0, Revb.ACC_SRC_D1);
ConLog(" IIR_SRC_A0, IIR_SRC_A1 0x%08x, 0x%08x\n", Revb.IIR_SRC_A0, Revb.IIR_SRC_A1);
ConLog(" IIR_SRC_B0, IIR_SRC_B1 0x%08x, 0x%08x\n", Revb.IIR_SRC_B0, Revb.IIR_SRC_B1);
ConLog(" IIR_DEST_A0, IIR_DEST_A1 0x%08x, 0x%08x\n", Revb.IIR_DEST_A0, Revb.IIR_DEST_A1);
ConLog(" IIR_DEST_B0, IIR_DEST_B1 0x%08x, 0x%08x\n", Revb.IIR_DEST_B0, Revb.IIR_DEST_B1);
ConLog(" IIR_ALPHA, IIR_COEF 0x%08x, 0x%08x\n", Revb.IIR_ALPHA, Revb.IIR_COEF);
ConLog("----------------------------------------------------------\n");
//u32 Reverb_Parameters[] = { // 32 values
// // Coefs/Alphas // L/0 // R/1 // params here / total
// Revb.IN_COEF_L, Revb.IN_COEF_R, // 2 / 2
// Revb.ACC_COEF_A, Revb.ACC_SRC_A0, Revb.ACC_SRC_A1,
// Revb.ACC_COEF_B, Revb.ACC_SRC_B0, Revb.ACC_SRC_B1,
// Revb.ACC_COEF_C, Revb.ACC_SRC_C0, Revb.ACC_SRC_C1,
// Revb.ACC_COEF_D, Revb.ACC_SRC_D0, Revb.ACC_SRC_D1, // 12 / 14
// Revb.IIR_ALPHA, // 1 / 15
// Revb.IIR_COEF, // 1 / 16
// Revb.IIR_DEST_A0, Revb.IIR_DEST_A1,
// Revb.IIR_DEST_B0, Revb.IIR_DEST_B1, // 4 / 20
// Revb.IIR_SRC_A0, Revb.IIR_SRC_A1,
// Revb.IIR_SRC_B0, Revb.IIR_SRC_B1, // 4 / 24
// Revb.MIX_DEST_A0, Revb.MIX_DEST_A1,
// Revb.MIX_DEST_B0, Revb.MIX_DEST_B1, // 4 / 28
// Revb.FB_ALPHA, Revb.FB_SRC_A, Revb.FB_SRC_B, // 3 / 31
// EffectsBufferSize // 1 / 32
//};
//ConLog("Reverb Parameter Update:\n");
//ConLog("--------------------------------------------\n");
//ConLog(" { /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[ 0], Reverb_Parameters[ 1]);
//ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[ 2], Reverb_Parameters[ 3], Reverb_Parameters[ 4]);
//ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[ 5], Reverb_Parameters[ 6], Reverb_Parameters[ 7]);
//ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[ 8], Reverb_Parameters[ 9], Reverb_Parameters[10]);
//ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[11], Reverb_Parameters[12], Reverb_Parameters[13]);
//ConLog( " 0x%08x,\n", Reverb_Parameters[14]);
//ConLog( " 0x%08x,\n", Reverb_Parameters[15]);
//ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[16], Reverb_Parameters[17]);
//ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[18], Reverb_Parameters[19]);
//ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[20], Reverb_Parameters[21]);
//ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[22], Reverb_Parameters[23]);
//ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[24], Reverb_Parameters[25]);
//ConLog(" /**/ 0x%08x, 0x%08x,\n", Reverb_Parameters[26], Reverb_Parameters[27]);
//ConLog( " 0x%08x, 0x%08x, 0x%08x,\n", Reverb_Parameters[28], Reverb_Parameters[29], Reverb_Parameters[30]);
//ConLog( " 0x%08x }\n", Reverb_Parameters[31]);
//ConLog("--------------------------------------------\n");
}
s32 V_Core::EffectsBufferIndexer( s32 offset ) const
{