mirror of https://github.com/snes9xgit/snes9x.git
Make interpolation config a little cleaner.
Add config file option to all ports.
This commit is contained in:
parent
67dc92d2b0
commit
6d15bf7d94
|
@ -914,11 +914,3 @@ bool8 S9xSPCDump (const char *filename)
|
|||
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
extern int dsp_interpolation_method;
|
||||
|
||||
void S9xSetDSPInterpolation (int mode)
|
||||
{
|
||||
dsp_interpolation_method = mode;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -237,6 +237,4 @@ void S9xUpdateDynamicRate (int, int);
|
|||
#define DSP_INTERPOLATION_CUBIC 3
|
||||
#define DSP_INTERPOLATION_SINC 4
|
||||
|
||||
void S9xSetDSPInterpolation (int);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
// snes_spc 0.9.0. http://www.slack.net/~ant/
|
||||
|
||||
#include "snes9x.h"
|
||||
|
||||
#include "SPC_DSP.h"
|
||||
|
||||
#include "blargg_endian.h"
|
||||
|
@ -412,14 +414,12 @@ static short const sinc [2048] =
|
|||
-38, 41, -328, 718, 15642, 613, -302, 38,
|
||||
};
|
||||
|
||||
int dsp_interpolation_method = 2;
|
||||
|
||||
inline int SPC_DSP::interpolate( voice_t const* v )
|
||||
{
|
||||
int out;
|
||||
int const* in = &v->buf [(v->interp_pos >> 12) + v->buf_pos];
|
||||
|
||||
switch (dsp_interpolation_method)
|
||||
switch (Settings.InterpolationMethod)
|
||||
{
|
||||
case 0: // raw
|
||||
{
|
||||
|
|
|
@ -257,6 +257,7 @@ Snes9xConfig::load_defaults (void)
|
|||
Settings.SoundSync = 1;
|
||||
Settings.DynamicRateControl = FALSE;
|
||||
Settings.DynamicRateLimit = 5;
|
||||
Settings.InterpolationMethod = DSP_INTERPOLATION_GAUSSIAN;
|
||||
Settings.HDMATimingHack = 100;
|
||||
Settings.SuperFXClockMultiplier = 100;
|
||||
Settings.InitialSnapshotFilename[0] = '\0';
|
||||
|
@ -409,6 +410,7 @@ Snes9xConfig::save_config_file (void)
|
|||
xml_out_int (xml, "dynamic_rate_control", Settings.DynamicRateControl);
|
||||
xml_out_int (xml, "dynamic_rate_limit", Settings.DynamicRateLimit);
|
||||
xml_out_int (xml, "auto_input_rate", auto_input_rate);
|
||||
xml_out_int (xml, "interpolation_method", Settings.InterpolationMethod);
|
||||
|
||||
/* Snes9X core-stored variables */
|
||||
xml_out_int (xml, "transparency", Settings.Transparency);
|
||||
|
@ -917,6 +919,10 @@ Snes9xConfig::set_option (const char *name, const char *value)
|
|||
{
|
||||
rewind_granularity = CLAMP (atoi (value), 0, 600);
|
||||
}
|
||||
else if (!strcasecmp (name, "interpolation_method"))
|
||||
{
|
||||
Settings.InterpolationMethod = CLAMP (atoi (value), 0, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf (stderr, _("bad option name: %s\n"), name);
|
||||
|
|
|
@ -169,6 +169,7 @@ void retro_set_environment(retro_environment_t cb)
|
|||
{ "snes9x_up_down_allowed", "Allow Opposing Directions; disabled|enabled" },
|
||||
{ "snes9x_overclock_superfx", "SuperFX Overclocking; 100%|150%|200%|250%|300%|350%|400%|450%|500%|50%" },
|
||||
{ "snes9x_hires_blend", "Hires Blending; disabled|enabled" },
|
||||
{ "snes9x_audio_interpolation", "Audio Interpolation; gaussian|cubic|sinc|none|linear" },
|
||||
{ "snes9x_layer_1", "Show layer 1; enabled|disabled" },
|
||||
{ "snes9x_layer_2", "Show layer 2; enabled|disabled" },
|
||||
{ "snes9x_layer_3", "Show layer 3; enabled|disabled" },
|
||||
|
@ -313,6 +314,24 @@ static void update_variables(void)
|
|||
var.value=NULL;
|
||||
Settings.SupportHiRes=!(environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && !strcmp("disabled", var.value));
|
||||
|
||||
var.key="snes9x_audio_interpolation";
|
||||
var.value=NULL;
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
{
|
||||
if (strcmp(var.value, "gaussian") == 0)
|
||||
Settings.InterpolationMethod = DSP_INTERPOLATION_GAUSSIAN;
|
||||
else if (strcmp(var.value, "linear") == 0)
|
||||
Settings.InterpolationMethod = DSP_INTERPOLATION_LINEAR;
|
||||
else if (strcmp(var.value, "cubic") == 0)
|
||||
Settings.InterpolationMethod = DSP_INTERPOLATION_CUBIC;
|
||||
else if (strcmp(var.value, "sinc") == 0)
|
||||
Settings.InterpolationMethod = DSP_INTERPOLATION_SINC;
|
||||
else if (strcmp(var.value, "none") == 0)
|
||||
Settings.InterpolationMethod = DSP_INTERPOLATION_NONE;
|
||||
}
|
||||
else
|
||||
Settings.InterpolationMethod = DSP_INTERPOLATION_GAUSSIAN;
|
||||
|
||||
var.key = "snes9x_overscan";
|
||||
|
||||
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value)
|
||||
|
|
|
@ -428,6 +428,7 @@ void S9xLoadConfigFiles (char **argv, int argc)
|
|||
Settings.Mute = conf.GetBool("Sound::Mute", false);
|
||||
Settings.DynamicRateControl = conf.GetBool("Sound::DynamicRateControl", false);
|
||||
Settings.DynamicRateLimit = conf.GetInt ("Sound::DynamicRateLimit", 5);
|
||||
Settings.InterpolationMethod = conf.GetInt ("Sound::InterpolationMethod", 2);
|
||||
|
||||
// Display
|
||||
|
||||
|
|
1
snes9x.h
1
snes9x.h
|
@ -419,6 +419,7 @@ struct SSettings
|
|||
bool8 Mute;
|
||||
bool8 DynamicRateControl;
|
||||
int32 DynamicRateLimit; /* Multiplied by 1000 */
|
||||
int32 InterpolationMethod;
|
||||
|
||||
bool8 SupportHiRes;
|
||||
bool8 Transparency;
|
||||
|
|
|
@ -1005,6 +1005,7 @@ void WinRegisterConfigItems()
|
|||
AddBoolC("Mute", GUI.Mute, false, "true to mute sound output (does not disable the sound CPU)");
|
||||
AddBool("DynamicRateControl", Settings.DynamicRateControl, false);
|
||||
AddBool("AutomaticInputRate", GUI.AutomaticInputRate, true);
|
||||
AddIntC("InterpolationMethod", Settings.InterpolationMethod, 2, "0 = None, 1 = Linear, 2 = Gaussian (accurate), 3 = Cubic, 4 = Sinc");
|
||||
#undef CATEGORY
|
||||
#define CATEGORY "Sound\\Win"
|
||||
AddUIntC("SoundDriver", GUI.SoundDriver, 4, "0=Snes9xDirectSound, 4=XAudio2 (recommended)");
|
||||
|
|
Loading…
Reference in New Issue