Skip to content

Commit

Permalink
Stop note one from hanging on skip
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Sep 7, 2016
1 parent 7737b2b commit abbb028
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
1 change: 1 addition & 0 deletions include/InstrumentFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "JournallingObject.h"
#include "lmms_basics.h"
#include "AutomatableModel.h"
#include "Instrument.h"
#include "TempoSyncKnobModel.h"
#include "ComboBoxModel.h"

Expand Down
6 changes: 6 additions & 0 deletions include/NotePlayHandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions src/core/InstrumentFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
*
*/

#include <QDebug>
#include <QDomElement>

#include "InstrumentFunctions.h"
Expand Down Expand Up @@ -268,8 +269,6 @@ void InstrumentFunctionNoteStacking::processNote( NotePlayHandle * _n )
}
}
}


}


Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit abbb028

Please sign in to comment.