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 8, 2017
1 parent 3070cec commit 70250a2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/DataFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class EXPORT DataFile : public QDomDocument
void upgrade_1_0_99();
void upgrade_1_1_0();
void upgrade_1_1_91();
void upgrade_1_2_0_rc3();

void upgrade();

Expand Down
30 changes: 30 additions & 0 deletions src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -901,6 +901,32 @@ void DataFile::upgrade_1_1_91()
}


void DataFile::upgrade_1_2_0_rc3()
{
// Upgrad from earlier bbtrack beat note behaviour of adding
// steps if a note is placed after the last step.
QDomNodeList 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 )
{
if( el.attribute( "len" ) != "" )
{
patternLength = el.attribute( "len" ).toInt();
steps = patternLength / 12;
el.setAttribute( "steps", steps );
}
}
}
}
}


void DataFile::upgrade()
{
ProjectVersion version =
Expand Down Expand Up @@ -977,6 +1003,10 @@ void DataFile::upgrade()
{
upgrade_1_1_91();
}
if( version < "1.2.0-rc3" )
{
upgrade_1_2_0_rc3();
}

// update document meta data
documentElement().setAttribute( "version", LDF_VERSION_STRING );
Expand Down
9 changes: 5 additions & 4 deletions src/tracks/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,21 +196,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 70250a2

Please sign in to comment.