Loopp/nonSeqLupppCCintegration.patch

113 lines
4.2 KiB
Diff

From d807068f61e6b5de698b9ed67772ac144be3b376 Mon Sep 17 00:00:00 2001
From: Harry van Haaren <harryhaaren@gmail.com>
Date: Tue, 22 Oct 2013 22:42:16 +0100
Subject: [PATCH] -Added CC21 CC22 for pattern on / off.
---
sequencer/src/jack.C | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 82 insertions(+)
diff --git a/sequencer/src/jack.C b/sequencer/src/jack.C
index a42d241..1cdf2fc 100644
--- a/sequencer/src/jack.C
+++ b/sequencer/src/jack.C
@@ -52,6 +52,8 @@ int pattern_control_channel = 0;
/* which control change number to use for pattern control */
int pattern_control_cc = 20;
+int pattern_on_cc = 21;
+int pattern_off_cc = 22;
jack_client_t *client;
@@ -417,6 +419,86 @@ process ( jack_nframes_t nframes, void *arg )
}
}
}
+ // CC 21 : ON event
+ else if ( e.channel() == pattern_control_channel &&
+ e.opcode() == midievent::CONTROL_CHANGE &&
+ e.lsb() == pattern_on_cc )
+ {
+ if ( e.msb() < pattern::patterns() )
+ {
+ pattern *p = pattern::pattern_by_number( e.msb() + 1 );
+
+ if ( TRIGGER == song.play_mode )
+ {
+ if ( p->playing() )
+ {
+ DMESSAGE( "Untriggering pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() );
+
+ //p->trigger( ph, e.timestamp() );
+ }
+ else
+ {
+ printf( "Triggering pattern %i ph=%lu, ts=%lu\n", e.msb(), ph, e.timestamp() );
+
+ p->trigger( e.timestamp(), INFINITY );
+ }
+ }
+ else
+ {
+ if ( p->mode() == PLAY )
+ {
+ DMESSAGE( "Dequeuing pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() );
+ //p->mode( MUTE );
+ }
+ else
+ {
+ printf( "Queuing pattern %i ph=%lu, ts=%lu\n", e.msb(), ph, e.timestamp() );
+
+ p->mode( PLAY );
+ }
+ }
+ }
+ }
+ // CC 22 : OFF event
+ else if ( e.channel() == pattern_control_channel &&
+ e.opcode() == midievent::CONTROL_CHANGE &&
+ e.lsb() == pattern_off_cc )
+ {
+ if ( e.msb() < pattern::patterns() )
+ {
+ pattern *p = pattern::pattern_by_number( e.msb() + 1 );
+
+ if ( TRIGGER == song.play_mode )
+ {
+ if ( p->playing() )
+ {
+ printf( "Untriggering pattern %i ph=%lu, ts=%lu\n", e.msb(), ph, e.timestamp() );
+
+ p->trigger( ph, e.timestamp() );
+ }
+ else
+ {
+ DMESSAGE( "Triggering pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() );
+
+ //p->trigger( e.timestamp(), INFINITY );
+ }
+ }
+ else
+ {
+ if ( p->mode() == PLAY )
+ {
+ printf( "Dequeuing pattern %i ph=%lu, ts=%lu\n", e.msb(), ph, e.timestamp() );
+ p->mode( MUTE );
+ }
+ else
+ {
+ DMESSAGE( "Queuing pattern %i ph=%lu, ts=%lu", e.msb(), ph, e.timestamp() );
+
+ //p->mode( PLAY );
+ }
+ }
+ }
+ }
}
}
--
1.8.4.1