diff --git a/src/core/DataFile.cpp b/src/core/DataFile.cpp index f4220c20c06..ac26081b4ad 100644 --- a/src/core/DataFile.cpp +++ b/src/core/DataFile.cpp @@ -41,6 +41,7 @@ #include "GuiApplication.h" #include "lmms_basics.h" #include "lmmsversion.h" +#include "MidiTime.h" #include "PluginFactory.h" #include "ProjectVersion.h" #include "SongEditor.h" @@ -898,6 +899,25 @@ void DataFile::upgrade_1_1_91() el.setAttribute( "arpdir", "3" ); } } + + // Upgrad from earlier bbtrack beat not ending of adding steps if + // a note is placed after the last step. + list = elementsByTagName( "bbtrack" ); + for( int i = 0; !list.item( i ).isNull(); ++i ) + { + list = elementsByTagName( "pattern" ); + for( int i = 0; !list.item( i ).isNull(); ++i ) + { + int patternLength, steps; + QDomElement el = list.item( i ).toElement(); + for( int i = 0; !list.item( i ).isNull(); ++i ) + { + patternLength = el.attribute( "len" ).toInt(); + steps = patternLength / 12; + el.setAttribute( "steps", steps ); + } + } + } } diff --git a/src/tracks/Pattern.cpp b/src/tracks/Pattern.cpp index 2266e512f04..efb97911427 100644 --- a/src/tracks/Pattern.cpp +++ b/src/tracks/Pattern.cpp @@ -195,21 +195,22 @@ MidiTime Pattern::beatPatternLength() const if( ( *it )->length() < 0 ) { max_length = qMax( max_length, - ( *it )->pos() + - MidiTime::ticksPerTact() / - MidiTime::stepsPerTact() ); + ( *it )->pos() + 1 ); } } if( m_steps != MidiTime::stepsPerTact() ) { max_length = m_steps * MidiTime::ticksPerTact() / - MidiTime::stepsPerTact() ; + MidiTime::stepsPerTact(); } return MidiTime( max_length ).nextFullTact() * MidiTime::ticksPerTact(); } + + + Note * Pattern::addNote( const Note & _new_note, const bool _quant_pos ) { Note * new_note = new Note( _new_note );