Skip to content

Commit

Permalink
visible beat notes in MelodyPattern
Browse files Browse the repository at this point in the history
  • Loading branch information
zonkmachine committed Feb 20, 2017
1 parent b6441b7 commit 96647a9
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/tracks/Pattern.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -933,13 +933,10 @@ void PatternView::paintEvent( QPaintEvent * )
for( NoteVector::Iterator it = m_pat->m_notes.begin();
it != m_pat->m_notes.end(); ++it )
{
if( ( *it )->length() > 0 )
{
max_key = qMax( max_key, ( *it )->key() );
min_key = qMin( min_key, ( *it )->key() );
central_key += ( *it )->key();
++total_notes;
}
max_key = qMax( max_key, ( *it )->key() );
min_key = qMin( min_key, ( *it )->key() );
central_key += ( *it )->key();
++total_notes;
}

if( total_notes > 0 )
Expand Down Expand Up @@ -974,17 +971,18 @@ void PatternView::paintEvent( QPaintEvent * )
// if( ( *it )->length() > 0 ) qDebug( "key %d, central_key %d, y_key %f, y_pos %d", ( *it )->key(), central_key, y_key, y_pos );

// check that note isn't out of bounds, and has a length
if( ( *it )->length() > 0 &&
y_pos >= TCO_BORDER_WIDTH &&
y_pos <= max_ht )
if( y_pos >= TCO_BORDER_WIDTH &&
y_pos <= max_ht )
{
// calculate start and end x-coords of the line to be drawn
int length = ( *it )->length();
length = length > 0 ? length : 4;
const int x1 = x_base +
static_cast<int>
( ( *it )->pos() * ( ppt / MidiTime::ticksPerTact() ) );
( ( *it )->pos() * ( ppt / MidiTime::ticksPerTact() ) );
const int x2 = x_base +
static_cast<int>
( ( ( *it )->pos() + ( *it )->length() ) * ( ppt / MidiTime::ticksPerTact() ) );
( ( ( *it )->pos() + length ) * ( ppt / MidiTime::ticksPerTact() ) );

// check bounds, draw line
if( x1 < width() - TCO_BORDER_WIDTH )
Expand Down

0 comments on commit 96647a9

Please sign in to comment.