13
0

triggerbox: initial support for "reapeat" launch style.

Don't change it while the trigger is running!
This commit is contained in:
Paul Davis 2021-08-11 18:25:46 -06:00
parent bab6c5cbdd
commit 17b7e0648f
2 changed files with 31 additions and 0 deletions

View File

@ -160,6 +160,7 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
void set_region_internal (boost::shared_ptr<Region>);
void request_state (State s);
virtual void retrigger() = 0;
virtual void set_usable_length () = 0;
};
class LIBARDOUR_API AudioTrigger : public Trigger {
@ -177,6 +178,7 @@ class LIBARDOUR_API AudioTrigger : public Trigger {
protected:
void retrigger ();
void set_usable_length ();
private:
std::vector<Sample*> data;

View File

@ -69,6 +69,8 @@ void
Trigger::set_launch_style (LaunchStyle l)
{
_launch_style = l;
set_usable_length ();
}
XMLNode&
@ -87,6 +89,7 @@ void
Trigger::set_quantization (Temporal::BBT_Offset const & q)
{
_quantization = q;
set_usable_length ();
}
void
@ -414,6 +417,32 @@ AudioTrigger::set_length (timecnt_t const & newlen)
}
}
void
AudioTrigger::set_usable_length ()
{
if (!_region) {
return;
}
switch (_launch_style) {
case Repeat:
break;
default:
usable_length = data_length;
return;
}
if (_quantization == Temporal::BBT_Offset ()) {
usable_length = data_length;
return;
}
/* XXX MUST HANDLE BAR-LEVEL QUANTIZATION */
timecnt_t len (Temporal::Beats (_quantization.beats, _quantization.ticks), timepos_t (Temporal::Beats()));
usable_length = len.samples();
}
timecnt_t
AudioTrigger::current_length() const
{