From c39690d8e029c926880353475a5092abd445fe9a Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Mon, 2 Nov 2020 18:36:49 +0100 Subject: [PATCH] Arpeggiator - Cut off trailing short notes (#5523) Prevent triggering of extra notes at the end by not counting trailing notes shorter than one fifth of the notes arp_frames. This value being arbitrarily found by trial and error. --- src/core/InstrumentFunctions.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/InstrumentFunctions.cpp b/src/core/InstrumentFunctions.cpp index c8ec24d6e..42ad3f0a3 100644 --- a/src/core/InstrumentFunctions.cpp +++ b/src/core/InstrumentFunctions.cpp @@ -388,8 +388,10 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) while( frames_processed < Engine::mixer()->framesPerPeriod() ) { const f_cnt_t remaining_frames_for_cur_arp = arp_frames - ( cur_frame % arp_frames ); - // does current arp-note fill whole audio-buffer? - if( remaining_frames_for_cur_arp > Engine::mixer()->framesPerPeriod() ) + // does current arp-note fill whole audio-buffer or is the remaining time just + // a short bit that we can discard? + if( remaining_frames_for_cur_arp > Engine::mixer()->framesPerPeriod() || + _n->frames() - _n->totalFramesPlayed() < arp_frames / 5 ) { // then we don't have to do something! break;