Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beat note bug at the end of bars #2964

Merged
merged 1 commit into from
Feb 9, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
{
// Upgrade 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