From abbb028f2d97f2d0adadd06627d916e1ac6b3a9e Mon Sep 17 00:00:00 2001 From: Oskar Wallgren Date: Wed, 7 Sep 2016 08:06:21 +0200 Subject: [PATCH] Stop note one from hanging on skip --- include/InstrumentFunctions.h | 1 + include/NotePlayHandle.h | 6 ++++++ src/core/InstrumentFunctions.cpp | 20 ++++++++------------ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/include/InstrumentFunctions.h b/include/InstrumentFunctions.h index d9d81637852..b5498f16207 100644 --- a/include/InstrumentFunctions.h +++ b/include/InstrumentFunctions.h @@ -28,6 +28,7 @@ #include "JournallingObject.h" #include "lmms_basics.h" #include "AutomatableModel.h" +#include "Instrument.h" #include "TempoSyncKnobModel.h" #include "ComboBoxModel.h" diff --git a/include/NotePlayHandle.h b/include/NotePlayHandle.h index 130799b0709..c0ea63f6409 100644 --- a/include/NotePlayHandle.h +++ b/include/NotePlayHandle.h @@ -195,6 +195,12 @@ class EXPORT NotePlayHandle : public PlayHandle, public Note { return m_subNotes.size() > 0 || m_hadChildren; } + + void setMasterNote() + { + m_hadChildren = true; + setUsesBuffer( false ); + } /*! Returns whether note is muted */ bool isMuted() const diff --git a/src/core/InstrumentFunctions.cpp b/src/core/InstrumentFunctions.cpp index 08d3610ea80..12366dea272 100644 --- a/src/core/InstrumentFunctions.cpp +++ b/src/core/InstrumentFunctions.cpp @@ -22,6 +22,7 @@ * */ +#include #include #include "InstrumentFunctions.h" @@ -268,8 +269,6 @@ void InstrumentFunctionNoteStacking::processNote( NotePlayHandle * _n ) } } } - - } @@ -418,8 +417,15 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) // Skip notes randomly if( m_arpSkipModel.value() ) { + if( 101 * ( (float) rand() / (float) RAND_MAX ) < m_arpSkipModel.value() ) { + //if( ! _n->instrumentTrack()->instrument()->flags() & Instrument::IsSingleStreamed ) + + if( cur_arp_idx == 0 ) + { + _n->setMasterNote(); + } // update counters frames_processed += arp_frames; cur_frame += arp_frames; @@ -515,16 +521,6 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) vol_level = _n->volumeLevel( cur_frame + gated_frames ); } - // Alternative fix for skip note issues. - // Skip notes randomly by muting. -/* if( m_arpSkipModel.value() ) - { - if( 101 * ( (float) rand() / (float) RAND_MAX ) < m_arpSkipModel.value() ) - { - vol_level = 0.0f; - } - }*/ - // create new arp-note // create sub-note-play-handle, only ptr to note is different