summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-28 23:43:21 +0200
committerRobin Haberkorn <robin.haberkorn@googlemail.com>2012-06-28 23:43:21 +0200
commit9cfd5aed215bbb5079571b464448c954152bbf51 (patch)
tree4762ae020d7b65469fa77a6f63145e5c3ac47bde /lib
parent899033e19b308b7a76f8c694f178994c5918361d (diff)
downloaddigitale-debutanten-9cfd5aed215bbb5079571b464448c954152bbf51.tar.gz
additional live-sampler volume and pitch controls
* check for collisions when registering scenes/controls in NanoEvent * fixed null-string checks in NanoEvent.ck
Diffstat (limited to 'lib')
-rw-r--r--lib/NanoEvent.ck19
1 files changed, 15 insertions, 4 deletions
diff --git a/lib/NanoEvent.ck b/lib/NanoEvent.ck
index f4637c8..aba3822 100644
--- a/lib/NanoEvent.ck
+++ b/lib/NanoEvent.ck
@@ -83,7 +83,7 @@ public class NanoEvent extends Event {
while (min => now) {
while (MidiMsg msg => min.recv) {
__channelToScene[msg.data1 & 0x0F].v @=> scene;
- if (scene == null) {
+ if (scene == "") {
<<< "Unknown channel", msg.data1 & 0x0F >>>;
msg.data1 & 0x0F => Std.itoa @=> scene;
}
@@ -92,14 +92,14 @@ public class NanoEvent extends Event {
msg.data2 => CCId;
__controlToName[scene].v[CCId].v @=> control;
- if (control == null) {
+ if (control == "") {
<<< "Unknown controller", CCId >>>;
CCId => Std.itoa @=> control;
}
(msg.data3 $ float)/127 => value;
- if (cmd == 0xB0 && (wantScene == null || scene == wantScene))
+ if (cmd == 0xB0 && (wantScene == "" || scene == wantScene))
broadcast();
}
}
@@ -120,6 +120,11 @@ public class NanoEvent extends Event {
fun static void
registerScene(int channel, string name)
{
+ if (__channelToScene[channel].v != "")
+ <<< "Warning: Already registered channel", channel >>>;
+ if (__controlToName[name] != null)
+ <<< "Warning: Already registered scene name", name >>>;
+
name @=> __channelToScene[channel].v;
new StringArray @=> __controlToName[name];
new String[0x100] @=> __controlToName[name].v;
@@ -128,6 +133,10 @@ public class NanoEvent extends Event {
fun static void
registerControl(string sceneName, int id, string controlName)
{
+ if (__controlToName[sceneName].v[id].v != "")
+ <<< "Warning: Already registered control", id,
+ "on scene", sceneName >>>;
+
controlName @=> __controlToName[sceneName].v[id].v;
}
}
@@ -149,7 +158,9 @@ NanoEvent.registerControl("primary", 03, "feedbackPregainSlider");
NanoEvent.registerControl("primary", 15, "feedbackGainKnob");
for (23 => int i; i <= 29; i++)
- NanoEvent.registerControl("primary", i, "chooseSampleButton#"+i);
+ NanoEvent.registerControl("primary", i, "samplerBankButton#"+i);
+NanoEvent.registerControl("primary", 19, "samplerVolumeKnob");
+NanoEvent.registerControl("primary", 08, "samplerPitchSlider");
fun void
registerLFO(string scene)