From 277292e7d7ea7c2275ea35ea40510b16c144593d Mon Sep 17 00:00:00 2001 From: David Runge Date: Fri, 2 Feb 2018 21:02:41 +0100 Subject: 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. --- classes/NanoKontrol2.sc | 289 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 289 insertions(+) create mode 100644 classes/NanoKontrol2.sc (limited to 'classes/NanoKontrol2.sc') diff --git a/classes/NanoKontrol2.sc b/classes/NanoKontrol2.sc new file mode 100644 index 0000000..d0f79c9 --- /dev/null +++ b/classes/NanoKontrol2.sc @@ -0,0 +1,289 @@ +NanoKontrol2 : MIDIDevice{ + + *new{ + arg name, uid, inPort, outPort, verbose; + var faderSize = 8, + potiSize = 8, + buttonSize = 36; + ^super.new(name, uid, inPort, outPort, verbose, faderSize, potiSize, buttonSize).init; + } + + init{ + this.addFaders(); + this.addPotis(); + this.addButtons(); + } + + cleanup{ + super.disconnectPorts(); + } + + addButtons{ + buttons.put(0, + List.newUsing([ + super.addSpec(\channel1Select, \control, 32, 0, 127), + ]); + ); + buttons.put(1, + List.newUsing([ + super.addSpec(\channel2Select, \control, 33, 0, 127), + ]); + ); + buttons.put(2, + List.newUsing([ + super.addSpec(\channel3Select, \control, 34, 0, 127), + ]); + ); + buttons.put(3, + List.newUsing([ + super.addSpec(\channel4Select, \control, 35, 0, 127), + ]); + ); + buttons.put(4, + List.newUsing([ + super.addSpec(\channel5Select, \control, 36, 0, 127), + ]); + ); + buttons.put(5, + List.newUsing([ + super.addSpec(\channel6Select, \control, 37, 0, 127), + ]); + ); + buttons.put(6, + List.newUsing([ + super.addSpec(\channel7Select, \control, 38, 0, 127), + ]); + ); + buttons.put(7, + List.newUsing([ + super.addSpec(\channel8Select, \control, 39, 0, 127), + ]); + ); + buttons.put(8, + List.newUsing([ + super.addSpec(\channel1Mute, \control, 48, 0, 127), + ]); + ); + buttons.put(9, + List.newUsing([ + super.addSpec(\channel2Mute, \control, 49, 0, 127), + ]); + ); + buttons.put(10, + List.newUsing([ + super.addSpec(\channel3Mute, \control, 50, 0, 127), + ]); + ); + buttons.put(11, + List.newUsing([ + super.addSpec(\channel4Mute, \control, 51, 0, 127), + ]); + ); + buttons.put(12, + List.newUsing([ + super.addSpec(\channel5Mute, \control, 52, 0, 127), + ]); + ); + buttons.put(13, + List.newUsing([ + super.addSpec(\channel6Mute, \control, 53, 0, 127), + ]); + ); + buttons.put(14, + List.newUsing([ + super.addSpec(\channel7Mute, \control, 54, 0, 127), + ]); + ); + buttons.put(15, + List.newUsing([ + super.addSpec(\channel8Mute, \control, 55, 0, 127), + ]); + ); + buttons.put(16, + List.newUsing([ + super.addSpec(\channel1Record, \control, 64, 0, 127), + ]); + ); + buttons.put(17, + List.newUsing([ + super.addSpec(\channel2Record, \control, 65, 0, 127), + ]); + ); + buttons.put(18, + List.newUsing([ + super.addSpec(\channel3Record, \control, 66, 0, 127), + ]); + ); + buttons.put(19, + List.newUsing([ + super.addSpec(\channel4Record, \control, 67, 0, 127), + ]); + ); + buttons.put(20, + List.newUsing([ + super.addSpec(\channel5Record, \control, 68, 0, 127), + ]); + ); + buttons.put(21, + List.newUsing([ + super.addSpec(\channel6Record, \control, 69, 0, 127), + ]); + ); + buttons.put(22, + List.newUsing([ + super.addSpec(\channel7Record, \control, 70, 0, 127), + ]); + ); + buttons.put(23, + List.newUsing([ + super.addSpec(\channel8Record, \control, 71, 0, 127), + ]); + ); + buttons.put(24, + List.newUsing([ + super.addSpec(\channel8Record, \control, 71, 0, 127), + ]); + ); + buttons.put(25, + List.newUsing([ + super.addSpec(\trackDown, \control, 58, 0, 127), + ]); + ); + buttons.put(26, + List.newUsing([ + super.addSpec(\trackUp, \control, 59, 0, 127), + ]); + ); + buttons.put(27, + List.newUsing([ + super.addSpec(\cycle, \control, 46, 0, 127), + ]); + ); + buttons.put(28, + List.newUsing([ + super.addSpec(\backwards, \control, 43, 0, 127), + ]); + ); + buttons.put(29, + List.newUsing([ + super.addSpec(\forwards, \control, 44, 0, 127), + ]); + ); + buttons.put(30, + List.newUsing([ + super.addSpec(\set, \control, 60, 0, 127), + ]); + ); + buttons.put(31, + List.newUsing([ + super.addSpec(\markerDown, \control, 61, 0, 127), + ]); + ); + buttons.put(32, + List.newUsing([ + super.addSpec(\markerUp, \control, 62, 0, 127), + ]); + ); + buttons.put(33, + List.newUsing([ + super.addSpec(\stop, \control, 42, 0, 127), + ]); + ); + buttons.put(34, + List.newUsing([ + super.addSpec(\play, \control, 41, 0, 127), + ]); + ); + buttons.put(35, + List.newUsing([ + super.addSpec(\record, \control, 45, 0, 127), + ]); + ); + } + + addPotis{ + potis.put(0, + List.newUsing([ + super.addSpec(\poti1, \control, 16, 0, 127), + ]); + ); + potis.put(1, + List.newUsing([ + super.addSpec(\poti2, \control, 17, 0, 127), + ]); + ); + potis.put(2, + List.newUsing([ + super.addSpec(\poti3, \control, 18, 0, 127), + ]); + ); + potis.put(3, + List.newUsing([ + super.addSpec(\poti4, \control, 19, 0, 127), + ]); + ); + potis.put(4, + List.newUsing([ + super.addSpec(\poti5, \control, 20, 0, 127), + ]); + ); + potis.put(5, + List.newUsing([ + super.addSpec(\poti6, \control, 21, 0, 127), + ]); + ); + potis.put(6, + List.newUsing([ + super.addSpec(\poti7, \control, 22, 0, 127), + ]); + ); + potis.put(7, + List.newUsing([ + super.addSpec(\poti8, \control, 23, 0, 127), + ]); + ); + } + + addFaders{ + faders.put(0, + List.newUsing([ + super.addSpec(\fader1, \control, 0, 0, 127), + ]); + ); + faders.put(1, + List.newUsing([ + super.addSpec(\fader2, \control, 1, 0, 127), + ]); + ); + faders.put(2, + List.newUsing([ + super.addSpec(\fader3, \control, 2, 0, 127), + ]); + ); + faders.put(3, + List.newUsing([ + super.addSpec(\fader4, \control, 3, 0, 127), + ]); + ); + faders.put(4, + List.newUsing([ + super.addSpec(\fader5, \control, 4, 0, 127), + ]); + ); + faders.put(5, + List.newUsing([ + super.addSpec(\fader6, \control, 5, 0, 127), + ]); + ); + faders.put(6, + List.newUsing([ + super.addSpec(\fader7, \control, 6, 0, 127), + ]); + ); + faders.put(7, + List.newUsing([ + super.addSpec(\fader8, \control, 7, 0, 127), + ]); + ); + } +} -- cgit v1.2.3-54-g00ecf