summaryrefslogtreecommitdiffstats
path: root/classes/PlatformMPlus.sc
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2018-02-02 21:02:41 +0100
committerDavid Runge <dave@sleepmap.de>2018-02-02 21:02:41 +0100
commit277292e7d7ea7c2275ea35ea40510b16c144593d (patch)
treeaaf854434f930c0c457ab0cba0bd47a5900ad20f /classes/PlatformMPlus.sc
downloadusbmidiism-277292e7d7ea7c2275ea35ea40510b16c144593d.tar.gz
usbmidiism-277292e7d7ea7c2275ea35ea40510b16c144593d.tar.bz2
usbmidiism-277292e7d7ea7c2275ea35ea40510b16c144593d.tar.xz
usbmidiism-277292e7d7ea7c2275ea35ea40510b16c144593d.zip
classes: Adding first draft of USBMIDIIsm, allowing setting up and connecting of devices.
Mappings for Korg nanoKONTROL2 and ICON Platform M+ are included in the respective classes. MIDIDevice.sc serves as the common parent for all further specific implementations.
Diffstat (limited to 'classes/PlatformMPlus.sc')
-rw-r--r--classes/PlatformMPlus.sc463
1 files changed, 463 insertions, 0 deletions
diff --git a/classes/PlatformMPlus.sc b/classes/PlatformMPlus.sc
new file mode 100644
index 0000000..fc10aa1
--- /dev/null
+++ b/classes/PlatformMPlus.sc
@@ -0,0 +1,463 @@
+PlatformMPlus : MIDIDevice{
+
+ *new{
+ arg name, uid, inPort, outPort, verbose;
+ var faderSize = 9,
+ potiSize = 8,
+ buttonSize = 48,
+ jogwheelSize = 1;
+ ^super.new(name, uid, inPort, outPort, verbose, faderSize, potiSize, buttonSize, jogwheelSize).init;
+ }
+
+ init{
+ this.addFaders();
+ this.addPotis();
+ this.addJogwheels();
+ this.addButtons();
+ this.addPassThroughs();
+ super.connectPassThroughs();
+ }
+
+ cleanup{
+ super.disconnectPorts();
+ super.disconnectPassThroughs();
+ }
+
+ addPassThroughs{
+ passThroughs.add(0->\bend);
+ passThroughs.add(1->\bend);
+ passThroughs.add(2->\bend);
+ passThroughs.add(3->\bend);
+ passThroughs.add(4->\bend);
+ passThroughs.add(5->\bend);
+ passThroughs.add(6->\bend);
+ passThroughs.add(7->\bend);
+ passThroughs.add(8->\bend);
+ }
+
+ addButtons{
+ buttons.put(0,
+ List.newUsing([
+ super.addSpec(\channel1RecNoteOn, \noteOn, 0, 0, 127),
+ super.addSpec(\channel1RecNoteOff, \noteOff, 0, 0, 127),
+ ]);
+ );
+ buttons.put(1,
+ List.newUsing([
+ super.addSpec(\channel2RecNoteOn, \noteOn, 1, 0, 127),
+ super.addSpec(\channel2RecNoteOff, \noteOff, 1, 0, 127),
+ ]);
+ );
+ buttons.put(2,
+ List.newUsing([
+ super.addSpec(\channel3RecNoteOn, \noteOn, 2, 0, 127),
+ super.addSpec(\channel3RecNoteOff, \noteOff, 2, 0, 127),
+ ]);
+ );
+ buttons.put(3,
+ List.newUsing([
+ super.addSpec(\channel4RecNoteOn, \noteOn, 3, 0, 127),
+ super.addSpec(\channel4RecNoteOff, \noteOff, 3, 0, 127),
+ ]);
+ );
+ buttons.put(4,
+ List.newUsing([
+ super.addSpec(\channel5RecNoteOn, \noteOn, 4, 0, 127),
+ super.addSpec(\channel5RecNoteOff, \noteOff, 4, 0, 127),
+ ]);
+ );
+ buttons.put(5,
+ List.newUsing([
+ super.addSpec(\channel6RecNoteOn, \noteOn, 5, 0, 127),
+ super.addSpec(\channel6RecNoteOff, \noteOff, 5, 0, 127127),
+ ]);
+ );
+ buttons.put(6,
+ List.newUsing([
+ super.addSpec(\channel7RecNoteOn, \noteOn, 6, 0, 127),
+ super.addSpec(\channel7RecNoteOff, \noteOff, 6, 0, 127),
+ ]);
+ );
+ buttons.put(7,
+ List.newUsing([
+ super.addSpec(\channel8RecNoteOn, \noteOn, 7, 0, 127),
+ super.addSpec(\channel8RecNoteOff, \noteOff, 7, 0, 127),
+ ]);
+ );
+ buttons.put(8,
+ List.newUsing([
+ super.addSpec(\channel1SoloNoteOn, \noteOn, 8, 0, 127),
+ super.addSpec(\channel1SoloNoteOff, \noteOff, 8, 0, 127),
+ ]);
+ );
+ buttons.put(9,
+ List.newUsing([
+ super.addSpec(\channel2SoloNoteOn, \noteOn, 9, 0, 127),
+ super.addSpec(\channel2SoloNoteOff, \noteOff, 9, 0, 127),
+ ]);
+ );
+ buttons.put(10,
+ List.newUsing([
+ super.addSpec(\channel3SoloNoteOn, \noteOn, 10, 0, 127),
+ super.addSpec(\channel3SoloNoteOff, \noteOff, 10, 0, 127),
+ ]);
+ );
+ buttons.put(11,
+ List.newUsing([
+ super.addSpec(\channel4SoloNoteOn, \noteOn, 11, 0, 127),
+ super.addSpec(\channel4SoloNoteOff, \noteOff, 11, 0, 127),
+ ]);
+ );
+ buttons.put(12,
+ List.newUsing([
+ super.addSpec(\channel5SoloNoteOn, \noteOn, 12, 0, 127),
+ super.addSpec(\channel5SoloNoteOff, \noteOff, 12, 0, 127),
+ ]);
+ );
+ buttons.put(13,
+ List.newUsing([
+ super.addSpec(\channel6SoloNoteOn, \noteOn, 13, 0, 127),
+ super.addSpec(\channel6SoloNoteOff, \noteOff, 13, 0, 127),
+ ]);
+ );
+ buttons.put(14,
+ List.newUsing([
+ super.addSpec(\channel7SoloNoteOn, \noteOn, 14, 0, 127),
+ super.addSpec(\channel7SoloNoteOff, \noteOff, 14, 0, 127),
+ ]);
+ );
+ buttons.put(15,
+ List.newUsing([
+ super.addSpec(\channel8SoloNoteOn, \noteOn, 15, 0, 127),
+ super.addSpec(\channel8SoloNoteOff, \noteOff, 15, 0, 127),
+ ]);
+ );
+ buttons.put(16,
+ List.newUsing([
+ super.addSpec(\channel1MuteNoteOn, \noteOn, 16, 0, 127),
+ super.addSpec(\channel1MuteNoteOff, \noteOff, 16, 0, 127),
+ ]);
+ );
+ buttons.put(17,
+ List.newUsing([
+ super.addSpec(\channel2MuteNoteOn, \noteOn, 17, 0, 127),
+ super.addSpec(\channel2MuteNoteOff, \noteOff, 17, 0, 127),
+ ]);
+ );
+ buttons.put(18,
+ List.newUsing([
+ super.addSpec(\channel3MuteNoteOn, \noteOn, 18, 0, 127),
+ super.addSpec(\channel3MuteNoteOff, \noteOff, 18, 0, 127),
+ ]);
+ );
+ buttons.put(19,
+ List.newUsing([
+ super.addSpec(\channel4MuteNoteOn, \noteOn, 19, 0, 127),
+ super.addSpec(\channel4MuteNoteOff, \noteOff, 19, 0, 127),
+ ]);
+ );
+ buttons.put(20,
+ List.newUsing([
+ super.addSpec(\channel5MuteNoteOn, \noteOn, 20, 0, 127),
+ super.addSpec(\channel5MuteNoteOff, \noteOff, 20, 0, 127),
+ ]);
+ );
+ buttons.put(21,
+ List.newUsing([
+ super.addSpec(\channel6MuteNoteOn, \noteOn, 21, 0, 127),
+ super.addSpec(\channel6MuteNoteOff, \noteOff, 21, 0, 127),
+ ]);
+ );
+ buttons.put(22,
+ List.newUsing([
+ super.addSpec(\channel7MuteNoteOn, \noteOn, 22, 0, 127),
+ super.addSpec(\channel7MuteNoteOff, \noteOff, 22, 0, 127),
+ ]);
+ );
+ buttons.put(23,
+ List.newUsing([
+ super.addSpec(\channel8MuteNoteOn, \noteOn, 23, 0, 127),
+ super.addSpec(\channel8MuteNoteOff, \noteOff, 23, 0, 127),
+ ]);
+ );
+ buttons.put(24,
+ List.newUsing([
+ super.addSpec(\channel1SelectNoteOn, \noteOn, 24, 0, 127),
+ super.addSpec(\channel1SelectNoteOff, \noteOff, 24, 0, 127),
+ ]);
+ );
+ buttons.put(25,
+ List.newUsing([
+ super.addSpec(\channel2SelectNoteOn, \noteOn, 25, 0, 127),
+ super.addSpec(\channel2SelectNoteOff, \noteOff, 25, 0, 127),
+ ]);
+ );
+ buttons.put(26,
+ List.newUsing([
+ super.addSpec(\channel3SelectNoteOn, \noteOn, 26, 0, 127),
+ super.addSpec(\channel3SelectNoteOff, \noteOff, 26, 0, 127),
+ ]);
+ );
+ buttons.put(27,
+ List.newUsing([
+ super.addSpec(\channel4SelectNoteOn, \noteOn, 27, 0, 127),
+ super.addSpec(\channel4SelectNoteOff, \noteOff, 27, 0, 127),
+ ]);
+ );
+ buttons.put(28,
+ List.newUsing([
+ super.addSpec(\channel5SelectNoteOn, \noteOn, 28, 0, 127),
+ super.addSpec(\channel5SelectNoteOff, \noteOff, 28, 0, 127),
+ ]);
+ );
+ buttons.put(29,
+ List.newUsing([
+ super.addSpec(\channel6SelectNoteOn, \noteOn, 29, 0, 127),
+ super.addSpec(\channel6SelectNoteOff, \noteOff, 29, 0, 127),
+ ]);
+ );
+ buttons.put(30,
+ List.newUsing([
+ super.addSpec(\channel7SelectNoteOn, \noteOn, 30, 0, 127),
+ super.addSpec(\channel7SelectNoteOff, \noteOff, 30, 0, 127),
+ ]);
+ );
+ buttons.put(31,
+ List.newUsing([
+ super.addSpec(\channel8SelectNoteOn, \noteOn, 31, 0, 127),
+ super.addSpec(\channel8SelectNoteOff, \noteOff, 31, 0, 127),
+ ]);
+ );
+ buttons.put(32,
+ List.newUsing([
+ super.addSpec(\channel8SelectNoteOn, \noteOn, 31, 0, 127),
+ super.addSpec(\channel8SelectNoteOff, \noteOff, 31, 0, 127),
+ ]);
+ );
+ buttons.put(33,
+ List.newUsing([
+ super.addSpec(\flipBankDownNoteOn, \noteOn, 46, 0, 127),
+ super.addSpec(\flipBankDownNoteOff, \noteOff, 46, 0, 127),
+ ]);
+ );
+ buttons.put(34,
+ List.newUsing([
+ super.addSpec(\flipBankUpNoteOn, \noteOn, 47, 0, 127),
+ super.addSpec(\flipBankUpNoteOff, \noteOff, 47, 0, 127),
+ ]);
+ );
+ buttons.put(35,
+ List.newUsing([
+ super.addSpec(\flipChanDownNoteOn, \noteOn, 48, 0, 127),
+ super.addSpec(\flipChanDownNoteOff, \noteOff, 48, 0, 127),
+ ]);
+ );
+ buttons.put(36,
+ List.newUsing([
+ super.addSpec(\flipChanUpNoteOn, \noteOn, 49, 0, 127),
+ super.addSpec(\flipChanUpNoteOff, \noteOff, 49, 0, 127),
+ ]);
+ );
+ buttons.put(37,
+ List.newUsing([
+ super.addSpec(\flipChanUpNoteOn, \noteOn, 49, 0, 127),
+ super.addSpec(\flipChanUpNoteOff, \noteOff, 49, 0, 127),
+ ]);
+ );
+ buttons.put(38,
+ List.newUsing([
+ super.addSpec(\readNoteOn, \noteOn, 74, 0, 127),
+ super.addSpec(\readNoteOff, \noteOff, 74, 0, 127),
+ ]);
+ );
+ buttons.put(39,
+ List.newUsing([
+ super.addSpec(\writeNoteOn, \noteOn, 75, 0, 127),
+ super.addSpec(\writeNoteOff, \noteOff, 75, 0, 127),
+ ]);
+ );
+ buttons.put(40,
+ List.newUsing([
+ super.addSpec(\mixerNoteOn, \noteOn, 78, 0, 127),
+ super.addSpec(\mixerNoteOff, \noteOff, 78, 0, 127),
+ ]);
+ );
+ buttons.put(41,
+ List.newUsing([
+ super.addSpec(\rewindNoteOn, \noteOn, 86, 0, 127),
+ super.addSpec(\rewindNoteOff, \noteOff, 86, 0, 127),
+ ]);
+ );
+ buttons.put(42,
+ List.newUsing([
+ super.addSpec(\transDownNoteOn, \noteOn, 91, 0, 127),
+ super.addSpec(\transDownNoteOff, \noteOff, 91, 0, 127),
+ ]);
+ );
+ buttons.put(43,
+ List.newUsing([
+ super.addSpec(\transUpNoteOn, \noteOn, 92, 0, 127),
+ super.addSpec(\transUpNoteOff, \noteOff, 92, 0, 127),
+ ]);
+ );
+ buttons.put(44,
+ List.newUsing([
+ super.addSpec(\stopNoteOn, \noteOn, 93, 0, 127),
+ super.addSpec(\stopNoteOff, \noteOff, 93, 0, 127),
+ ]);
+ );
+ buttons.put(45,
+ List.newUsing([
+ super.addSpec(\playNoteOn, \noteOn, 94, 0, 127),
+ super.addSpec(\playNoteOff, \noteOff, 94, 0, 127),
+ ]);
+ );
+ buttons.put(46,
+ List.newUsing([
+ super.addSpec(\recordNoteOn, \noteOn, 95, 0, 127),
+ super.addSpec(\recordNoteOff, \noteOff, 95, 0, 127),
+ ]);
+ );
+ buttons.put(47,
+ List.newUsing([
+ super.addSpec(\zoomNoteOn, \noteOn, 100, 0, 127),
+ super.addSpec(\zoomNoteOff, \noteOff, 100, 0, 127),
+ ]);
+ );
+ }
+
+ addJogwheels{
+ jogwheels.put(0,
+ List.newUsing([
+ super.addSpec(\jogwheel1Control, \control, 60, 0, 127),
+ super.addSpec(\jogwheel1NoteOn, \noteOn, 101, 0, 127),
+ super.addSpec(\jogwheel1NoteOff, \noteOff, 101, 0, 127)
+ ])
+ );
+ }
+
+ addPotis{
+ potis.put(0,
+ List.newUsing([
+ super.addSpec(\poti1Control, \control, 16, 0, 127),
+ super.addSpec(\poti1NoteOn, \noteOn, 32, 0, 127),
+ super.addSpec(\poti1NoteOff, \noteOff, 32, 0, 127)
+ ])
+ );
+ potis.put(1,
+ List.newUsing([
+ super.addSpec(\poti2Control, \control, 17, 0, 127),
+ super.addSpec(\poti2NoteOn, \noteOn, 33, 0, 127),
+ super.addSpec(\poti2NoteOff, \noteOff, 33, 0, 127)
+ ])
+ );
+ potis.put(2,
+ List.newUsing([
+ super.addSpec(\poti3Control, \control, 18, 0, 127),
+ super.addSpec(\poti3NoteOn, \noteOn, 34, 0, 127),
+ super.addSpec(\poti3NoteOff, \noteOff, 34, 0, 127)
+ ])
+ );
+ potis.put(3,
+ List.newUsing([
+ super.addSpec(\poti4Control, \control, 19, 0, 127),
+ super.addSpec(\poti4NoteOn, \noteOn, 35, 0, 127),
+ super.addSpec(\poti4NoteOff, \noteOff, 35, 0, 127)
+ ])
+ );
+ potis.put(4,
+ List.newUsing([
+ super.addSpec(\poti5Control, \control, 20, 0, 127),
+ super.addSpec(\poti5NoteOn, \noteOn, 36, 0, 127),
+ super.addSpec(\poti5NoteOff, \noteOff, 36, 0, 127)
+ ])
+ );
+ potis.put(5,
+ List.newUsing([
+ super.addSpec(\poti6Control, \control, 21, 0, 127),
+ super.addSpec(\poti6NoteOn, \noteOn, 37, 0, 127),
+ super.addSpec(\poti6NoteOff, \noteOff, 37, 0, 127)
+ ])
+ );
+ potis.put(6,
+ List.newUsing([
+ super.addSpec(\poti7Control, \control, 22, 0, 127),
+ super.addSpec(\poti7NoteOn, \noteOn, 38, 0, 127),
+ super.addSpec(\poti7NoteOff, \noteOff, 38, 0, 127)
+ ])
+ );
+ potis.put(7,
+ List.newUsing([
+ super.addSpec(\poti8Control, \control, 23, 0, 127),
+ super.addSpec(\poti8NoteOn, \noteOn, 39, 0, 127),
+ super.addSpec(\poti8NoteOff, \noteOff, 39, 0, 127)
+ ])
+ );
+ }
+
+ addFaders{
+ faders.put(0,
+ List.newUsing([
+ super.addSpec(\fader1, \bend, 0, 0, 16383),
+ super.addSpec(\fader1NoteOn, \noteOn, 104, 0, 127),
+ super.addSpec(\fader1NoteOff, \noteOff, 104, 0, 127)
+ ])
+ );
+ faders.put(1,
+ List.newUsing([
+ super.addSpec(\fader2, \bend, 1, 0, 16383),
+ super.addSpec(\fader2NoteOn, \noteOn, 105, 0, 127),
+ super.addSpec(\fader2NoteOff, \noteOff, 105, 0, 127)
+ ])
+ );
+ faders.put(2,
+ List.newUsing([
+ super.addSpec(\fader3, \bend, 2, 0, 16383),
+ super.addSpec(\fader3NoteOn, \noteOn, 106, 0, 127),
+ super.addSpec(\fader3NoteOff, \noteOff, 106, 0, 127)
+ ])
+ );
+ faders.put(3,
+ List.newUsing([
+ super.addSpec(\fader4, \bend, 3, 0, 16383),
+ super.addSpec(\fader4NoteOn, \noteOn, 107, 0, 127),
+ super.addSpec(\fader4NoteOff, \noteOff, 107, 0, 127)
+ ])
+ );
+ faders.put(4,
+ List.newUsing([
+ super.addSpec(\fader5, \bend, 4, 0, 16383),
+ super.addSpec(\fader5NoteOn, \noteOn, 108, 0, 127),
+ super.addSpec(\fader5NoteOff, \noteOff, 108, 0, 127)
+ ])
+ );
+ faders.put(5,
+ List.newUsing([
+ super.addSpec(\fader6, \bend, 5, 0, 16383),
+ super.addSpec(\fader6NoteOn, \noteOn, 109, 0, 127),
+ super.addSpec(\fader6NoteOff, \noteOff, 109, 0, 127)
+ ])
+ );
+ faders.put(6,
+ List.newUsing([
+ super.addSpec(\fader7, \bend, 6, 0, 16383),
+ super.addSpec(\fader7NoteOn, \noteOn, 110, 0, 127),
+ super.addSpec(\fader7NoteOff, \noteOff, 110, 0, 127)
+ ])
+ );
+ faders.put(7,
+ List.newUsing([
+ super.addSpec(\fader8, \bend, 7, 0, 16383),
+ super.addSpec(\fader8NoteOn, \noteOn, 111, 0, 127),
+ super.addSpec(\fader8NoteOff, \noteOff, 111, 0, 127)
+ ])
+ );
+ faders.put(8,
+ List.newUsing([
+ super.addSpec(\fader9, \bend, 8, 0, 16383),
+ super.addSpec(\fader9NoteOn, \noteOn, 112, 0, 127),
+ super.addSpec(\fader9NoteOff, \noteOff, 112, 0, 127)
+ ])
+ );
+ }
+}