Skip to content

Commit

Permalink
No extra bar with beat note near end
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Feb 3, 2017
1 parent c54171b commit 7a7587c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
20 changes: 20 additions & 0 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );
}
}
}
}


Expand Down
9 changes: 5 additions & 4 deletions src/tracks/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,21 +195,22 @@ MidiTime Pattern::beatPatternLength() const
if( ( *it )->length() < 0 )
{
max_length = qMax<tick_t>( 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 );
Expand Down

0 comments on commit 7a7587c

Please sign in to comment.