Merge pull request #579 from zonkmachine/arpDownUp

Arpeggio - Down, up
This commit is contained in:
Tobias Doerffel
2014-04-08 09:00:28 +02:00
2 changed files with 15 additions and 0 deletions

View File

@@ -165,6 +165,7 @@ public:
ArpDirUp,
ArpDirDown,
ArpDirUpAndDown,
ArpDirDownAndUp,
ArpDirRandom,
NumArpDirections
} ;

View File

@@ -314,6 +314,7 @@ InstrumentFunctionArpeggio::InstrumentFunctionArpeggio( Model * _parent ) :
m_arpDirectionModel.addItem( tr( "Up" ), new PixmapLoader( "arp_up" ) );
m_arpDirectionModel.addItem( tr( "Down" ), new PixmapLoader( "arp_down" ) );
m_arpDirectionModel.addItem( tr( "Up and down" ), new PixmapLoader( "arp_up_and_down" ) );
m_arpDirectionModel.addItem( tr( "Down and up" ), new PixmapLoader( "arp_up_and_down" ) );
m_arpDirectionModel.addItem( tr( "Random" ), new PixmapLoader( "arp_random" ) );
m_arpDirectionModel.setInitValue( ArpDirUp );
@@ -429,6 +430,19 @@ void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n )
cur_arp_idx = range - cur_arp_idx % ( range - 1 ) - 1;
}
}
else if( dir == ArpDirDownAndUp && range > 1 )
{
// copied from ArpDirUpAndDown above
cur_arp_idx = ( cur_frame / arp_frames ) % ( range * 2 - 2 );
// if greater than range, we have to play down...
// looks like the code for arp_dir==DOWN... :)
if( cur_arp_idx >= range )
{
cur_arp_idx = range - cur_arp_idx % ( range - 1 ) - 1;
}
// inverts direction
cur_arp_idx = range - cur_arp_idx - 1;
}
else if( dir == ArpDirRandom )
{
// just pick a random chord-index