diff options
author | Robin Gareus <robin@gareus.org> | 2017-11-01 15:46:23 +0100 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2017-11-01 15:46:23 +0100 |
commit | c291cb64b1e3ebf3ba6458fec3c1b446e0db3b9c (patch) | |
tree | 8e306a210c8032e72c116df4c070a109004d6455 /libs/ardour/processor.cc | |
parent | c411e05b6f9c5738b53f5a94812b6f24d53a86d1 (diff) |
Wrap automation on loop-position, split plugin processing
Diffstat (limited to 'libs/ardour/processor.cc')
-rw-r--r-- | libs/ardour/processor.cc | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libs/ardour/processor.cc b/libs/ardour/processor.cc index 19b6f30367..39c3d68ad7 100644 --- a/libs/ardour/processor.cc +++ b/libs/ardour/processor.cc @@ -275,6 +275,34 @@ Processor::configure_io (ChanCount in, ChanCount out) return true; } +bool +Processor::map_loop_range (samplepos_t& start, samplepos_t& end) const +{ + if (!_loop_location) { + return false; + } + if (start >= end) { + /* no backwards looping */ + return false; + } + + const samplepos_t loop_end = _loop_location->end (); + if (start < loop_end) { + return false; + } + + const samplepos_t loop_start = _loop_location->start (); + const samplecnt_t looplen = loop_end - loop_start; + const sampleoffset_t start_off = (start - loop_start) % looplen; + const samplepos_t start_pos = loop_start + start_off; + + assert (start >= start_pos); + end -= start - start_pos; + start = start_pos; + assert (end > start); + return true; +} + void Processor::set_display_to_user (bool yn) { |