diff --git a/include/InlineAutomation.h b/include/InlineAutomation.h index 89f3e9164ca..70cefbec9fd 100644 --- a/include/InlineAutomation.h +++ b/include/InlineAutomation.h @@ -52,9 +52,7 @@ class InlineAutomation : public FloatModel, public sharedObject inline bool hasAutomation() const { return m_autoPattern != NULL && - !typeInfo::isEqual( - m_autoPattern->getTimeMap()[0], - defaultValue() ); + m_autoPattern->getTimeMap().isEmpty() == false; } AutomationPattern * automationPattern() diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 1728b1c035d..39a12611b67 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -917,6 +917,9 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x, int middle_y = _y + KEY_LINE_HEIGHT / 2; _p.setPen( QColor( 0xFF, 0xDF, 0x20 ) ); + int old_x = 0; + int old_y = 0; + timeMap & map = _n->detuning()->automationPattern()->getTimeMap(); for( timeMap::ConstIterator it = map.begin(); it != map.end(); ++it ) { @@ -929,10 +932,28 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x, const float level = it.value(); - int pos_y = (int)( middle_y - level * KEY_LINE_HEIGHT / 10 ); + int pos_y = (int)( middle_y - level * KEY_LINE_HEIGHT ); + + if( old_x != 0 && old_y != 0 ) + { + switch( _n->detuning()->automationPattern()->progressionType() ) + { + case AutomationPattern::DiscreteProgression: + _p.drawLine( old_x, old_y, pos_x, old_y ); + _p.drawLine( pos_x, old_y, pos_x, pos_y ); + break; + case AutomationPattern::CubicHermiteProgression: /* TODO */ + case AutomationPattern::LinearProgression: + _p.drawLine( old_x, old_y, pos_x, pos_y ); + break; + } + } _p.drawLine( pos_x - 1, pos_y, pos_x + 1, pos_y ); _p.drawLine( pos_x, pos_y - 1, pos_x, pos_y + 1 ); + + old_x = pos_x; + old_y = pos_y; } }