mirror of https://github.com/snes9xgit/snes9x.git
Optimize rate control formula and remove placeholder copy-paste.
This commit is contained in:
parent
2eaac353ba
commit
618519457b
|
@ -475,10 +475,8 @@ void S9xSetSamplesAvailableCallback (apu_callback callback, void *data)
|
||||||
|
|
||||||
void S9xUpdateDynamicRate (int avail, int buffer_size)
|
void S9xUpdateDynamicRate (int avail, int buffer_size)
|
||||||
{
|
{
|
||||||
int half_size = buffer_size / 2;
|
spc::dynamic_rate_multiplier = 1.0 + ((int) Settings.DynamicRateLimit * (buffer_size - 2 * avail)) /
|
||||||
int delta_mid = avail - half_size;
|
(double)(1000 * buffer_size);
|
||||||
double direction = (double) delta_mid / half_size;
|
|
||||||
spc::dynamic_rate_multiplier = 1.0 - (Settings.DynamicRateLimit / 100000.0) * direction;
|
|
||||||
|
|
||||||
UpdatePlaybackRate();
|
UpdatePlaybackRate();
|
||||||
}
|
}
|
||||||
|
|
|
@ -662,7 +662,7 @@ Snes9xPreferences::move_settings_to_dialog (void)
|
||||||
set_slider ("sound_input_rate", config->sound_input_rate);
|
set_slider ("sound_input_rate", config->sound_input_rate);
|
||||||
set_check ("sync_sound", Settings.SoundSync);
|
set_check ("sync_sound", Settings.SoundSync);
|
||||||
set_check ("dynamic_rate_control", Settings.DynamicRateControl);
|
set_check ("dynamic_rate_control", Settings.DynamicRateControl);
|
||||||
set_spin ("dynamic_rate_limit", Settings.DynamicRateLimit / 100000.0);
|
set_spin ("dynamic_rate_limit", Settings.DynamicRateLimit / 1000.0);
|
||||||
set_spin ("rewind_buffer_size", config->rewind_buffer_size);
|
set_spin ("rewind_buffer_size", config->rewind_buffer_size);
|
||||||
set_spin ("rewind_granularity", config->rewind_granularity);
|
set_spin ("rewind_granularity", config->rewind_granularity);
|
||||||
|
|
||||||
|
@ -819,7 +819,7 @@ Snes9xPreferences::get_settings_from_dialog (void)
|
||||||
config->mute_sound = get_check ("mute_sound_check");
|
config->mute_sound = get_check ("mute_sound_check");
|
||||||
config->mute_sound_turbo = get_check ("mute_sound_turbo_check");
|
config->mute_sound_turbo = get_check ("mute_sound_turbo_check");
|
||||||
Settings.DynamicRateControl = get_check ("dynamic_rate_control");
|
Settings.DynamicRateControl = get_check ("dynamic_rate_control");
|
||||||
Settings.DynamicRateLimit = (uint32) (get_spin ("dynamic_rate_limit") * 100000);
|
Settings.DynamicRateLimit = (uint32) (get_spin ("dynamic_rate_limit") * 1000);
|
||||||
|
|
||||||
store_ntsc_settings ();
|
store_ntsc_settings ();
|
||||||
config->ntsc_scanline_intensity = get_combo ("ntsc_scanline_intensity");
|
config->ntsc_scanline_intensity = get_combo ("ntsc_scanline_intensity");
|
||||||
|
|
2
snes9x.h
2
snes9x.h
|
@ -408,7 +408,7 @@ struct SSettings
|
||||||
bool8 ReverseStereo;
|
bool8 ReverseStereo;
|
||||||
bool8 Mute;
|
bool8 Mute;
|
||||||
bool8 DynamicRateControl;
|
bool8 DynamicRateControl;
|
||||||
uint32 DynamicRateLimit; /* Multiplied by 100000 */
|
uint32 DynamicRateLimit; /* Multiplied by 1000 */
|
||||||
|
|
||||||
bool8 SupportHiRes;
|
bool8 SupportHiRes;
|
||||||
bool8 Transparency;
|
bool8 Transparency;
|
||||||
|
|
Loading…
Reference in New Issue