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.
This commit is contained in:
Robin Gareus 2022-10-12 22:24:15 +02:00
parent 396013bf5a
commit 392210270c
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 2 additions and 2 deletions

View File

@ -360,7 +360,7 @@ RBEffect::run (boost::shared_ptr<Region> 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);
}

View File

@ -304,7 +304,7 @@ STStretch::run (boost::shared_ptr<Region> 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);
}