13
0

triggerbox: add follow count support

This commit is contained in:
Paul Davis 2021-10-06 22:40:37 -06:00
parent 05df62ed79
commit 7e2dd8a718
2 changed files with 18 additions and 1 deletions

View File

@ -167,6 +167,9 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
virtual void jump_start ();
virtual void jump_stop ();
uint32_t follow_count() const { return _follow_count; }
void set_follow_count (uint32_t n);
void set_ui (void*);
void* ui () const { return _ui; }
@ -182,6 +185,8 @@ class LIBARDOUR_API Trigger : public PBD::Stateful {
PBD::Property<bool> _use_follow;
FollowAction _follow_action[2];
int _follow_action_probability;
uint32_t _follow_cnt;
uint32_t _follow_count;
boost::shared_ptr<Region> _region;
Temporal::BBT_Offset _quantization;
PBD::Property<bool> _legato;

View File

@ -56,6 +56,8 @@ Trigger::Trigger (uint64_t n, TriggerBox& b)
, _use_follow (Properties::use_follow, true)
, _follow_action { NextTrigger, Stop }
, _follow_action_probability (100)
, _follow_cnt (0)
, _follow_count (1)
, _quantization (Temporal::BBT_Offset (0, 1, 0))
, _legato (Properties::legato, true)
, _stretch (1.0)
@ -98,6 +100,13 @@ Trigger::unbang ()
DEBUG_TRACE (DEBUG::Triggers, string_compose ("un-bang on %1\n", _index));
}
void
Trigger::set_follow_count (uint32_t n)
{
_follow_count = n;
}
void
Trigger::set_follow_action (FollowAction f, uint64_t n)
{
@ -222,6 +231,7 @@ void
Trigger::startup()
{
_state = WaitingToStart;
_follow_cnt = _follow_count;
PropertyChanged (ARDOUR::Properties::running);
}
@ -811,7 +821,9 @@ AudioTrigger::run (BufferSet& bufs, pframes_t nframes, pframes_t dest_offset, bo
/* We reached the end */
if ((_launch_style == Repeat) || (_box.peek_next_trigger() == this)) { /* self repeat */
_follow_cnt--;
if ((_follow_cnt != 0) || (_launch_style == Repeat) || (_box.peek_next_trigger() == this)) { /* self repeat */
nframes -= this_read;
dest_offset += this_read;
DEBUG_TRACE (DEBUG::Triggers, string_compose ("%1 reached end, but set to loop, so retrigger\n", index()));