From a183fb25049645347af8c0448d09a9d37478f9ae Mon Sep 17 00:00:00 2001 From: Hannu Haahti Date: Fri, 17 Jan 2014 09:49:35 +0200 Subject: [PATCH 1/3] pitch automation in piano roll doesn't require first point to be 0 --- include/InlineAutomation.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) 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() From 3d0749ad67857acbdbfbc63d92ee5087a6895215 Mon Sep 17 00:00:00 2001 From: Hannu Haahti Date: Fri, 17 Jan 2014 09:50:30 +0200 Subject: [PATCH 2/3] points are shown in the correct scale --- src/gui/piano_roll.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 1728b1c035d..44f49e68006 100644 --- a/src/gui/piano_roll.cpp +++ b/src/gui/piano_roll.cpp @@ -929,7 +929,7 @@ 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 ); _p.drawLine( pos_x - 1, pos_y, pos_x + 1, pos_y ); _p.drawLine( pos_x, pos_y - 1, pos_x, pos_y + 1 ); From dfd57530320589d06d8ce44dd3901ab56cf35b8d Mon Sep 17 00:00:00 2001 From: Hannu Haahti Date: Fri, 17 Jan 2014 10:46:52 +0200 Subject: [PATCH 3/3] draw discrete and linear differently --- src/gui/piano_roll.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/gui/piano_roll.cpp b/src/gui/piano_roll.cpp index 44f49e68006..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 ) { @@ -931,8 +934,26 @@ inline void pianoRoll::drawDetuningInfo( QPainter & _p, note * _n, int _x, 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; } }