Skip to content

Commit

Permalink
Merge pull request #41 from grejppi/stable-0.4-pitchautomation
Browse files Browse the repository at this point in the history
WIP: Pitch automation improvements in Piano Roll
  • Loading branch information
tobydox committed Jan 17, 2014
2 parents 2d4e769 + dfd5753 commit 6d0c544
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
4 changes: 1 addition & 3 deletions include/InlineAutomation.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,7 @@ class InlineAutomation : public FloatModel, public sharedObject
inline bool hasAutomation() const
{
return m_autoPattern != NULL &&
!typeInfo<float>::isEqual(
m_autoPattern->getTimeMap()[0],
defaultValue() );
m_autoPattern->getTimeMap().isEmpty() == false;
}

AutomationPattern * automationPattern()
Expand Down
23 changes: 22 additions & 1 deletion src/gui/piano_roll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand All @@ -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;
}
}

Expand Down

0 comments on commit 6d0c544

Please sign in to comment.