13
0

triggerbox: allow set_region_threaded() to "unset" the region

This commit is contained in:
Paul Davis 2021-12-17 19:22:44 -07:00
parent c6e141aaba
commit 2111cfe557

View File

@ -745,15 +745,21 @@ AudioTrigger::natural_length() const
int int
AudioTrigger::set_region_threaded (boost::shared_ptr<Region> r) AudioTrigger::set_region_threaded (boost::shared_ptr<Region> r)
{ {
using namespace RubberBand; assert (!active());
boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r); boost::shared_ptr<AudioRegion> ar = boost::dynamic_pointer_cast<AudioRegion> (r);
if (!ar) { if (r && !ar) {
return -1; return -1;
} }
set_region_internal (r); set_region_internal (r);
if (!r) {
/* unset */
return 0;
}
load_data (ar); load_data (ar);
determine_tempo (); determine_tempo ();
setup_stretcher (); setup_stretcher ();