13
0

Fix fader/trim automation after locate

First see 31c6f66d9b and 5cb6e1046b.

It worked previously due to `AutomationControl::get_value`
evaluating automation, which was removed in 5cb6e1046b
in favor of properly using latency compensated evaluation.

However due to 31c6f66d9b, fader and trim automation were
never evaluated on locate, only during playback via
`Amp::setup_gain_automation`.

This fixes a case where gain is incorrect after a locate.
The amp still has the gain from before the locate, and when starting
playback ramps to the new gain.
This commit is contained in:
Robin Gareus 2024-07-10 19:26:02 +02:00
parent ab0d2dce6f
commit c3d90f415c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04

View File

@ -73,7 +73,7 @@ Amp::configure_io (ChanCount in, ChanCount out)
}
void
Amp::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
Amp::run (BufferSet& bufs, samplepos_t start_sample, samplepos_t /*end_sample*/, double /*speed*/, pframes_t nframes, bool)
{
if (!check_active()) {
/* disregard potentially prepared gain-automation. */
@ -129,6 +129,8 @@ Amp::run (BufferSet& bufs, samplepos_t /*start_sample*/, samplepos_t /*end_sampl
} else { /* manual (scalar) gain */
_gain_control->automation_run (start_sample, nframes);
gain_t const target_gain = _gain_control->get_value();
if (fabsf (_current_gain - target_gain) >= GAIN_COEFF_DELTA) {
@ -384,7 +386,7 @@ Amp::setup_gain_automation (samplepos_t start_sample, samplepos_t end_sample, sa
_apply_gain_automation = _gain_control->get_masters_curve ( start_sample, end_sample, _gain_automation_buffer, nframes);
if (start_sample != _current_automation_sample && _session.bounce_processing ()) {
if (start_sample != _current_automation_sample) {
_current_gain = _gain_automation_buffer[0];
}
_current_automation_sample = end_sample;