Add threaded APU option.

This commit is contained in:
Brandon Wright 2018-04-12 16:26:10 -05:00
parent 5285ec4e9d
commit 045f68bb26
7 changed files with 551 additions and 384 deletions

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,12 @@ AC_ARG_WITH(xrandr,
[],
[with_xrandr=yes])
AC_ARG_WITH(pthreads,
[AS_HELP_STRING([--with(out)-pthreads],
[Enable POSIX Threads (default: with)])],
[],
[with_pthreads=yes])
AC_ARG_WITH(portaudio,
[AS_HELP_STRING([--with(out)-portaudio],
[Enable PortAudio sound driver support (default: with)])],
@ -268,6 +274,17 @@ if test yes = "$with_oss" ; then
])
fi
THREADS=0
if test yes = "$with_pthreads" ; then
AC_CHECK_HEADER(pthread.h, [
CFLAGS="$CFLAGS -DUSE_THREADS"
LIBS="$LIBS -lpthread"
THREADS=1
],[
echo "Cannot find pthreads. Disabling threading."
])
fi
ALSA=0
ALSA_CFLAGS=""
ALSA_LIBS=""

View File

@ -255,6 +255,7 @@ Snes9xConfig::load_defaults (void)
Settings.SoundSync = 1;
Settings.DynamicRateControl = 1;
Settings.DynamicRateLimit = 5;
Settings.ThreadedAPU = FALSE;
Settings.HDMATimingHack = 100;
Settings.ApplyCheats = 1;
@ -406,6 +407,7 @@ Snes9xConfig::save_config_file (void)
xml_out_int (xml, "sound_sync", Settings.SoundSync);
xml_out_int (xml, "dynamic_rate_control", Settings.DynamicRateControl);
xml_out_int (xml, "dynamic_rate_limit", Settings.DynamicRateLimit);
xml_out_int (xml, "threaded_apu", Settings.ThreadedAPU);
/* Snes9X core-stored variables */
xml_out_int (xml, "transparency", Settings.Transparency);
@ -677,6 +679,10 @@ Snes9xConfig::set_option (const char *name, const char *value)
Settings.DynamicRateLimit = atoi (value);
Settings.DynamicRateLimit = CLAMP (Settings.DynamicRateLimit, 1, 1000);
}
else if (!strcasecmp (name, "threaded_apu"))
{
Settings.ThreadedAPU = atoi (value);
}
else if (!strcasecmp (name, "gaussian_interpolation"))
{
}

View File

@ -678,6 +678,7 @@ Snes9xPreferences::move_settings_to_dialog (void)
set_check ("sync_sound", Settings.SoundSync);
set_check ("dynamic_rate_control", Settings.DynamicRateControl);
set_spin ("dynamic_rate_limit", Settings.DynamicRateLimit / 1000.0);
set_check ("threaded_apu", Settings.ThreadedAPU);
set_spin ("rewind_buffer_size", config->rewind_buffer_size);
set_spin ("rewind_granularity", config->rewind_granularity);
@ -770,7 +771,8 @@ Snes9xPreferences::get_settings_from_dialog (void)
(7 - (get_combo ("playback_combo")))) ||
(config->sound_input_rate != get_slider ("sound_input_rate")) ||
(Settings.SoundSync != get_check ("sync_sound")) ||
(Settings.DynamicRateControl != get_check ("dynamic_rate_control"))
(Settings.DynamicRateControl != get_check ("dynamic_rate_control")) ||
(Settings.ThreadedAPU != get_check ("threaded_apu"))
)
{
sound_needs_restart = 1;
@ -836,6 +838,7 @@ Snes9xPreferences::get_settings_from_dialog (void)
config->mute_sound_turbo = get_check ("mute_sound_turbo_check");
Settings.DynamicRateControl = get_check ("dynamic_rate_control");
Settings.DynamicRateLimit = (uint32) (get_spin ("dynamic_rate_limit") * 1000);
Settings.ThreadedAPU = get_check ("threaded_apu");
store_ntsc_settings ();
config->ntsc_scanline_intensity = get_combo ("ntsc_scanline_intensity");

View File

@ -4016,7 +4016,21 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="threaded_apu">
<property name="label" translatable="yes">Threaded sound processors</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Tries to run the S-SMP and S-DSP on a separate thread</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="dynamic_rate_control">
<property name="label" translatable="yes">Dynamic rate control</property>
@ -4029,7 +4043,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
@ -4046,7 +4060,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
<child>
@ -4062,7 +4076,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
<property name="position">5</property>
</packing>
</child>
<child>
@ -4078,7 +4092,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">5</property>
<property name="position">6</property>
</packing>
</child>
<child>
@ -4298,7 +4312,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="position">7</property>
</packing>
</child>
</object>

View File

@ -424,6 +424,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.ThreadedAPU = conf.GetBool("Sound::ThreadedAPU", false);
// Display

View File

@ -409,6 +409,7 @@ struct SSettings
bool8 Mute;
bool8 DynamicRateControl;
int32 DynamicRateLimit; /* Multiplied by 1000 */
bool8 ThreadedAPU;
bool8 SupportHiRes;
bool8 Transparency;