Start defining buttons and rotators and faders
authorEugene Petkevich <nasedil.genio.code@gmail.com>
Sat, 21 May 2022 18:43:19 +0000 (21:43 +0300)
committerEugene Petkevich <nasedil.genio.code@gmail.com>
Sat, 21 May 2022 18:43:19 +0000 (21:43 +0300)
extensions/classes/midimix.sc
Хэзифу/mix101-control.scd

index c92316b..fc3b3d2 100644 (file)
@@ -1,5 +1,6 @@
 MidiMix {
   classvar ledValues;
+  classvar controlNotes;
   const <version = "0.1";
   var <name;
   var <channel = 5;
@@ -19,6 +20,18 @@ MidiMix {
       \dark -> 0,
       false -> 0
     ];
+
+    controlNotes = IdentityDictionary[
+      1 -> \da,
+      2 -> \ze,
+      3 -> \ku,
+      4 -> \ta,
+      7 -> \be,
+      8 -> \bu,
+      9 -> \pe,
+      11 -> \gu,
+
+    ];
   }
 
   *new {|name=\Mix101|
@@ -51,13 +64,13 @@ MidiMix {
     MIDIdef.noteOff(\wire+name, {|...args|
       wire.value(*args);
     }, 21, srcID: idin);
-    // Rotating in sampler/loop/fx mode
+    // Rotating in sampler/loop/fx mode: -1/1
     MIDIdef.cc(\joro+name, {|...args|
-      joro.value(*args);
+      joro.value(args[0]-64, *args);
     }, 19, srcID: idin);
-    // Rotating in cue/vinyl mode
+    // Rotating in cue/vinyl mode: -1/1
     MIDIdef.cc(\viro+name, {|...args|
-      viro.value(*args);
+      viro.value(args[0]-64, *args);
     }, 21, srcID: idin);
 
     // == sync/select buttons
@@ -94,7 +107,109 @@ MidiMix {
       viwo.value(*args);
     }, 20, srcID: idin);
 
-    // Starter message and animation
+    // == faders
+    // channel A fader
+    MIDIdef.cc(\dafe+name, {|...args|
+      dafe.value(args[0].linlin(0, 127, 0, 1), *args);
+    }, 33, srcID: idin);
+    // channel B fader
+    MIDIdef.cc(\zefe+name, {|...args|
+      zefe.value(args[0].linlin(0, 127, 0, 1), *args);
+    }, 34, srcID: idin);
+    // cross fader
+    MIDIdef.cc(\cofe+name, {|...args|
+      cofe.value(args[0].bilin(64, 0, 127, 0, -1, 1), *args);
+    }, 35, srcID: idin);
+
+    // == knobs
+    // channel A gain
+    MIDIdef.cc(\dage+name, {|...args|
+      dage.value(args[0].linlin(0, 127, 0, 1), *args);
+    }, 36, srcID: idin);
+    // channel B gain
+    MIDIdef.cc(\zege+name, {|...args|
+      zege.value(args[0].linlin(0, 127, 0, 1), *args);
+    }, 37, srcID: idin);
+    // channel A hi
+    MIDIdef.cc(\daha+name, {|...args|
+      daha.value(args[0].bilin(64, 0, 127, 0, -1, 1), *args);
+    }, 38, srcID: idin);
+    // channel B hi
+    MIDIdef.cc(\zeha+name, {|...args|
+      zeha.value(args[0].bilin(64, 0, 127, 0, -1, 1), *args);
+    }, 39, srcID: idin);
+    // channel A mid
+    MIDIdef.cc(\dami+name, {|...args|
+      dami.value(args[0].bilin(64, 0, 127, 0, -1, 1), *args);
+    }, 40, srcID: idin);
+    // channel B mid
+    MIDIdef.cc(\zemi+name, {|...args|
+      zemi.value(args[0].bilin(64, 0, 127, 0, -1, 1), *args);
+    }, 41, srcID: idin);
+    // channel A low
+    MIDIdef.cc(\dalo+name, {|...args|
+      dalo.value(args[0].bilin(64, 0, 127, 0, -1, 1), *args);
+    }, 42, srcID: idin);
+    // channel B low
+    MIDIdef.cc(\zelo+name, {|...args|
+      zelo.value(args[0].bilin(64, 0, 127, 0, -1, 1), *args);
+    }, 43, srcID: idin);
+
+    // == endless rotators
+    // channel A rotator: -1/1
+    MIDIdef.cc(\daro+name, {|...args|
+      daro.value(args[0]-64, *args);
+    }, 16, srcID: idin);
+    // channel B rotator: -1/1
+    MIDIdef.cc(\zero+name, {|...args|
+      zero.value(args[0]-64, *args);
+    }, 17, srcID: idin);
+    // load/preview rotator: -1/1
+    MIDIdef.cc(\loro+name, {|...args|
+      loro.value(args[0]-64, *args);
+    }, 18, srcID: idin);
+
+    // == buttons
+    MIDIdef.noteOn(\buttons+name, {|...args|
+
+      var handler = this.perform(); a.value(1);
+      dape.value(*args);
+    }, [1, 2, 3, 4, 7, 8, 9, 11, 12, 13], srcID: idin);
+
+    // channel A pfl button pushed
+    MIDIdef.noteOn(\dapu+name, {|...args|
+      dape.value(*args);
+    }, 1, srcID: idin);
+    // channel A pfl button released
+    MIDIdef.noteOff(\dare+name, {|...args|
+      dare.value(*args);
+    }, 1, srcID: idin);
+    // channel A pfl button pushed
+    MIDIdef.noteOn(\zepu+name, {|...args|
+      zepu.value(*args);
+    }, 2, srcID: idin);
+    // channel A pfl button released
+    MIDIdef.noteOff(\zere+name, {|...args|
+      zere.value(*args);
+    }, 2, srcID: idin);
+    // channel A pfl button pushed
+    MIDIdef.noteOn(\dapu+name, {|...args|
+      dape.value(*args);
+    }, 3, srcID: idin);
+    // channel A pfl button released
+    MIDIdef.noteOff(\dare+name, {|...args|
+      dare.value(*args);
+    }, 3, srcID: idin);
+    // channel A pfl button pushed
+    MIDIdef.noteOn(\zepu+name, {|...args|
+      zepu.value(*args);
+    }, 4, srcID: idin);
+    // channel A pfl button released
+    MIDIdef.noteOff(\zere+name, {|...args|
+      zere.value(*args);
+    }, 4, srcID: idin);
+
+    // == Starter message and animation
     this.animate;
     "Шаҫиху готов к использованию 😊".postln;
   }
index a41d1cb..e657462 100644 (file)
@@ -22,12 +22,17 @@ MIDIdef.sysex(\testsysex, {|...args|
 });
 )
 
+MKtl.find;
+
 ~mix = MidiMix();
 ~mix.ledb(\off);
 ~mout = MIDIOut.newByName("Mix-101", "Mix-101 MIDI 1").latency_(0);
 ~mix.
 ~mout.noteOn(5, 20, 127);
 
+~mix.joro = {|i| i.postln};
+a = ~mix.perform(\joro); a.value(1);
+
 (
 (0..15).do {|i|
   [i].postln;