From 2111cfe5574b5054cd060cf2aac2e1579913069d Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 17 Dec 2021 19:22:44 -0700 Subject: [PATCH] triggerbox: allow set_region_threaded() to "unset" the region --- libs/ardour/triggerbox.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/ardour/triggerbox.cc b/libs/ardour/triggerbox.cc index 73ada2bbdb..99827c240b 100644 --- a/libs/ardour/triggerbox.cc +++ b/libs/ardour/triggerbox.cc @@ -745,15 +745,21 @@ AudioTrigger::natural_length() const int AudioTrigger::set_region_threaded (boost::shared_ptr r) { - using namespace RubberBand; + assert (!active()); boost::shared_ptr ar = boost::dynamic_pointer_cast (r); - if (!ar) { + if (r && !ar) { return -1; } set_region_internal (r); + + if (!r) { + /* unset */ + return 0; + } + load_data (ar); determine_tempo (); setup_stretcher ();