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)
|
||||
{
|
||||
int half_size = buffer_size / 2;
|
||||
int delta_mid = avail - half_size;
|
||||
double direction = (double) delta_mid / half_size;
|
||||
spc::dynamic_rate_multiplier = 1.0 - (Settings.DynamicRateLimit / 100000.0) * direction;
|
||||
spc::dynamic_rate_multiplier = 1.0 + ((int) Settings.DynamicRateLimit * (buffer_size - 2 * avail)) /
|
||||
(double)(1000 * buffer_size);
|
||||
|
||||
UpdatePlaybackRate();
|
||||
}
|
||||
|
|
|
@ -662,7 +662,7 @@ Snes9xPreferences::move_settings_to_dialog (void)
|
|||
set_slider ("sound_input_rate", config->sound_input_rate);
|
||||
set_check ("sync_sound", Settings.SoundSync);
|
||||
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_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_turbo = get_check ("mute_sound_turbo_check");
|
||||
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 ();
|
||||
config->ntsc_scanline_intensity = get_combo ("ntsc_scanline_intensity");
|
||||
|
|
Loading…
Reference in New Issue