Skip to content

Commit

Permalink
'Off beat' beat notes to MelodyPattern
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Feb 20, 2017
1 parent 2c8e9a0 commit 025b474
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions include/Pattern.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class EXPORT Pattern : public TrackContentObject
{
return m_patternType;
}

void checkType();

// next/previous track based on position in the containing track
Pattern * previousPattern() const;
Expand Down Expand Up @@ -132,7 +132,6 @@ protected slots:
MidiTime beatPatternLength() const;

void setType( PatternTypes _new_pattern_type );
void checkType();

void resizeToFirstTrack();

Expand Down
5 changes: 5 additions & 0 deletions src/gui/editors/PianoRoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,11 @@ void PianoRoll::dragNotes( int x, int y, bool alt, bool shift, bool ctrl )

note->setPos( MidiTime( pos_ticks ) );
note->setKey( key_num );
// If dragging beat notes check if pattern should be MelodyPattern
if( note->length() < 0 )
{
m_pattern->checkType();
}
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/tracks/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,9 @@ void Pattern::checkType()
NoteVector::Iterator it = m_notes.begin();
while( it != m_notes.end() )
{
if( ( *it )->length() > 0 )
if( ( *it )->length() > 0 ||
( *it )->pos() % ( MidiTime::ticksPerTact() /
MidiTime::stepsPerTact() ) )
{
setType( MelodyPattern );
return;
Expand Down

0 comments on commit 025b474

Please sign in to comment.