'Off beat' beat notes to MelodyPattern

This commit is contained in:
Oskar Wallgren
2017-02-16 01:17:46 +01:00
parent 01472aade7
commit e4474af091
3 changed files with 9 additions and 3 deletions

View File

@@ -88,7 +88,7 @@ public:
{
return m_patternType;
}
void checkType();
// next/previous track based on position in the containing track
Pattern * previousPattern() const;
@@ -132,7 +132,6 @@ private:
MidiTime beatPatternLength() const;
void setType( PatternTypes _new_pattern_type );
void checkType();
void resizeToFirstTrack();

View File

@@ -2472,6 +2472,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();
}
}
}
}

View File

@@ -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;