From 392210270ce3f8d7c7670cced27674c3aac02b74 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Wed, 12 Oct 2022 22:24:15 +0200 Subject: [PATCH] Fix pitch-shift producing partially silent regions It can happen that with a scaling factor of 1.0, rubberband produces slightly fewer samples than the original. Region::set_length (region->length * 1.0) is idempotent and does not shorten it as appropriate to the longest source via Region::verify_length(), which leads to various issues. --- libs/ardour/rb_effect.cc | 2 +- libs/ardour/st_stretch.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/ardour/rb_effect.cc b/libs/ardour/rb_effect.cc index 428490b2d1..070c96c00f 100644 --- a/libs/ardour/rb_effect.cc +++ b/libs/ardour/rb_effect.cc @@ -360,7 +360,7 @@ RBEffect::run (boost::shared_ptr r, Progress* progress) /* multiply the old (possibly previously stretched) region length by the extra * stretch this time around to get its new length. this is a non-music based edit atm. */ - (*x)->set_length ((*x)->length ().scale (tsr.time_fraction)); + (*x)->set_length_unchecked ((*x)->length ().scale (tsr.time_fraction)); (*x)->set_whole_file (true); } diff --git a/libs/ardour/st_stretch.cc b/libs/ardour/st_stretch.cc index 6e703a5b46..4313616d8f 100644 --- a/libs/ardour/st_stretch.cc +++ b/libs/ardour/st_stretch.cc @@ -304,7 +304,7 @@ STStretch::run (boost::shared_ptr r, Progress* progress) /* multiply the old (possibly previously stretched) region length by the extra * stretch this time around to get its new length. this is a non-music based edit atm. */ - (*x)->set_length ((*x)->length ().scale (tsr.time_fraction)); + (*x)->set_length_unchecked ((*x)->length ().scale (tsr.time_fraction)); (*x)->set_whole_file (true); }