Skip to content

Commit

Permalink
Adding Gaussian interpolation to SPU
Browse files Browse the repository at this point in the history
This function can be enabled as an option in the SPU settings
  • Loading branch information
xjsxjs197 committed Apr 18, 2024
1 parent 760da87 commit 98b11e8
Show file tree
Hide file tree
Showing 16 changed files with 261 additions and 244 deletions.
10 changes: 5 additions & 5 deletions Gamecube/GamecubeMain.cpp
Expand Up @@ -85,6 +85,7 @@ void LidInterrupt();
void CheckPsxType();
void psxResetRcntRate();
void plugin_call_rearmed_cbs(unsigned long autoDwActFixes, int cfgUseDithering);
void setSpuInterpolation(int spuInterpolation);
}

u32* xfb[3] = { NULL, NULL, NULL }; /*** Framebuffers ***/
Expand All @@ -108,7 +109,7 @@ char frameLimit[2];
char frameSkip;
char useDithering;
extern char audioEnabled;
char volume;
char spuInterpolation;
char showFPSonScreen;
char printToScreen;
char menuActive;
Expand Down Expand Up @@ -163,7 +164,7 @@ static struct {
char min, max;
} OPTIONS[] =
{ { "Audio", &audioEnabled, AUDIO_DISABLE, AUDIO_ENABLE },
{ "Volume", &volume, VOLUME_LOUDEST, VOLUME_LOW },
{ "Interpolation", &spuInterpolation, SIMPLE_INTERPOLATION, GAUSSI_INTERPOLATION },
{ "FPS", &showFPSonScreen, FPS_HIDE, FPS_SHOW },
// { "Debug", &printToScreen, DEBUG_HIDE, DEBUG_SHOW },
{ "ScreenMode", &screenMode, SCREENMODE_4x3, SCREENMODE_16x9_PILLARBOX },
Expand Down Expand Up @@ -331,7 +332,7 @@ void loadSettings(int argc, char *argv[])
{
// Default Settings
audioEnabled = 1; // Audio
volume = VOLUME_MEDIUM;
spuInterpolation = SIMPLE_INTERPOLATION;
#ifdef RELEASE
showFPSonScreen = 0; // Don't show FPS on Screen
#else
Expand Down Expand Up @@ -376,7 +377,6 @@ void loadSettings(int argc, char *argv[])
Config.Xa = 0; //XA enabled
Config.Cdda = 0; //CDDA enabled
Config.cycle_multiplier = CYCLE_MULT_DEFAULT;
iVolume = volume; //Volume="medium" in PEOPSspu
Config.PsxAuto = 1; //Autodetect
LoadCdBios = BOOTTHRUBIOS_NO;
lang = 0;
Expand Down Expand Up @@ -433,7 +433,7 @@ void loadSettings(int argc, char *argv[])
//Synch settings with Config
Config.Cpu=dynacore;
//iUseDither = useDithering;
iVolume = volume;
setSpuInterpolation(spuInterpolation);
}

void ScanPADSandReset(u32 dummy)
Expand Down
33 changes: 15 additions & 18 deletions Gamecube/menu/SettingsFrame.cpp
Expand Up @@ -143,6 +143,7 @@ FILE* IplFont_getFontFile(char* sdUsb);
void psxResetRcntRate();
void pl_chg_psxtype(int is_pal_);
void gpuChangePsxType();
void setSpuInterpolation(int spuInterpolation);
}

#define NUM_FRAME_BUTTONS 64
Expand Down Expand Up @@ -238,9 +239,9 @@ static char FRAME_STRINGS[79][24] =
"Disable Audio",
"Disable XA",
"Disable CDDA",
"Volume",
"loudest", //iVolume=1
"loud",
"Interpolation",
"Simple", //iVolume=1
"Gaussi",
"medium",
"low", //iVolume=4
//Strings for Saves tab (starting at FRAME_STRINGS[51]) ..was[55]
Expand Down Expand Up @@ -640,18 +641,12 @@ void SettingsFrame::activateSubmenu(int submenu)
else FRAME_BUTTONS[42].button->setSelected(true);
if (Config.Cdda == CDDA_DISABLE) FRAME_BUTTONS[43].button->setSelected(true);
else FRAME_BUTTONS[44].button->setSelected(true);
FRAME_BUTTONS[45].buttonString = FRAME_STRINGS[46+iVolume];
FRAME_BUTTONS[45].buttonString = FRAME_STRINGS[46 + spuInterpolation];
for (int i = 39; i < 46; i++)
{
FRAME_BUTTONS[i].button->setVisible(true);
FRAME_BUTTONS[i].button->setActive(true);
}
// upd xjsxjs197 start
/*for (int i = 43; i <= 44; i++) //disable CDDA buttons
{
FRAME_BUTTONS[i].button->setActive(false);
}*/
// upd xjsxjs197 end
break;
case SUBMENU_SAVES:
setDefaultFocus(FRAME_BUTTONS[4].button);
Expand Down Expand Up @@ -1669,16 +1664,18 @@ void Func_DisableCddaNo()
//menu::MessageBox::getInstance().setMessage("CDDA audio is not implemented");
}

extern "C" void SetVolume(void);

void Func_VolumeToggle()
{
iVolume--;
if (iVolume<1)
iVolume = 4;
FRAME_BUTTONS[45].buttonString = FRAME_STRINGS[46+iVolume];
volume = iVolume;
SetVolume();
if (spuInterpolation == SIMPLE_INTERPOLATION)
{
spuInterpolation = GAUSSI_INTERPOLATION;
}
else
{
spuInterpolation = SIMPLE_INTERPOLATION;
}
FRAME_BUTTONS[45].buttonString = FRAME_STRINGS[46 + spuInterpolation];
setSpuInterpolation(spuInterpolation);
}

void Func_MemcardSaveSD()
Expand Down
13 changes: 5 additions & 8 deletions Gamecube/wiiSXconfig.h
Expand Up @@ -44,14 +44,11 @@ enum ConfigCdda //Config.Cdda
CDDA_DISABLE
};

extern int iVolume;
extern char volume;
enum iVolume
{
VOLUME_LOUDEST=1,
VOLUME_LOUD,
VOLUME_MEDIUM,
VOLUME_LOW
extern char spuInterpolation;
enum spuInterpolationEnum
{
SIMPLE_INTERPOLATION = 1,
GAUSSI_INTERPOLATION,
};

extern char showFPSonScreen;
Expand Down

0 comments on commit 98b11e8

Please sign in to comment.