13
0

Skip redundant disk buffer changes

This speeds up initial session loading or sessions with many regions.
This commit is contained in:
Robin Gareus 2021-05-12 19:10:10 +02:00
parent 3a7304ca01
commit bdaca1d783
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -83,20 +83,33 @@ Butler::config_changed (std::string p)
_session.adjust_playback_buffering ();
if (Config->get_buffering_preset() == Custom) {
/* size is in Samples, not bytes */
_audio_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.sample_rate());
_session.adjust_playback_buffering ();
samplecnt_t audio_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.sample_rate());
if (_audio_playback_buffer_size != audio_playback_buffer_size) {
_audio_playback_buffer_size = audio_playback_buffer_size;
_session.adjust_playback_buffering ();
}
}
} else if (p == "capture-buffer-seconds") {
if (Config->get_buffering_preset() == Custom) {
_audio_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.sample_rate());
_session.adjust_capture_buffering ();
/* size is in Samples, not bytes */
samplecnt_t audio_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.sample_rate());
if (_audio_capture_buffer_size != audio_capture_buffer_size) {
_audio_capture_buffer_size = audio_capture_buffer_size;
_session.adjust_capture_buffering ();
}
}
} else if (p == "buffering-preset") {
DiskIOProcessor::set_buffering_parameters (Config->get_buffering_preset());
_audio_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.sample_rate());
_audio_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.sample_rate());
_session.adjust_capture_buffering ();
_session.adjust_playback_buffering ();
samplecnt_t audio_capture_buffer_size = (uint32_t) floor (Config->get_audio_capture_buffer_seconds() * _session.sample_rate());
samplecnt_t audio_playback_buffer_size = (uint32_t) floor (Config->get_audio_playback_buffer_seconds() * _session.sample_rate());
if (_audio_capture_buffer_size != audio_capture_buffer_size) {
_audio_capture_buffer_size = audio_capture_buffer_size;
_session.adjust_capture_buffering ();
}
if (_audio_playback_buffer_size != audio_playback_buffer_size) {
_audio_playback_buffer_size = audio_playback_buffer_size;
_session.adjust_playback_buffering ();
}
}
}