summaryrefslogtreecommitdiffstats
path: root/classes/PlatformMPlus.sc
blob: 0236dedfc1da000763a386b9cb218d94859b4713 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
PlatformMPlus : MIDIDevice{

  *new{
    arg name, uid, inPort, outPort, verbose, states;
    var faderSize = 9,
    potiSize = 8,
    buttonSize = 47,
    jogwheelSize = 1;
    ^super.new(name, uid, inPort, outPort, verbose, states, faderSize,
      potiSize, buttonSize, jogwheelSize).init;
  }

  init{
    this.addFaders();
    this.addPotis();
    this.addJogwheels();
    this.addButtons();
    this.addPassThroughs();
    super.connectPassThroughs();
    super.connectStates();
  }

  cleanup{
    super.disconnectPorts();
    super.disconnectPassThroughs();
    states.connected=false;
  }

  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, 0, 127),
        super.addSpec(\channel1RecNoteOff, \noteOff, 0, 0, 0, 127),
      ]);
    );
    buttons.put(1,
      List.newUsing([
        super.addSpec(\channel2RecNoteOn, \noteOn, 0, 1, 0, 127),
        super.addSpec(\channel2RecNoteOff, \noteOff, 0, 1, 0, 127),
      ]);
    );
    buttons.put(2,
      List.newUsing([
        super.addSpec(\channel3RecNoteOn, \noteOn, 0, 2, 0, 127),
        super.addSpec(\channel3RecNoteOff, \noteOff, 0, 2, 0, 127),
      ]);
    );
    buttons.put(3,
      List.newUsing([
        super.addSpec(\channel4RecNoteOn, \noteOn, 0, 3, 0, 127),
        super.addSpec(\channel4RecNoteOff, \noteOff, 0, 3, 0, 127),
      ]);
    );
    buttons.put(4,
      List.newUsing([
        super.addSpec(\channel5RecNoteOn, \noteOn, 0, 4, 0, 127),
        super.addSpec(\channel5RecNoteOff, \noteOff, 0, 4, 0, 127),
      ]);
    );
    buttons.put(5,
      List.newUsing([
        super.addSpec(\channel6RecNoteOn, \noteOn, 0, 5, 0, 127),
        super.addSpec(\channel6RecNoteOff, \noteOff, 0, 5, 0, 127127),
      ]);
    );
    buttons.put(6,
      List.newUsing([
        super.addSpec(\channel7RecNoteOn, \noteOn, 0, 6, 0, 127),
        super.addSpec(\channel7RecNoteOff, \noteOff, 0, 6, 0, 127),
      ]);
    );
    buttons.put(7,
      List.newUsing([
        super.addSpec(\channel8RecNoteOn, \noteOn, 0, 7, 0, 127),
        super.addSpec(\channel8RecNoteOff, \noteOff, 0, 7, 0, 127),
      ]);
    );
    buttons.put(8,
      List.newUsing([
        super.addSpec(\channel1SoloNoteOn, \noteOn, 0, 8, 0, 127),
        super.addSpec(\channel1SoloNoteOff, \noteOff, 0, 8, 0, 127),
      ]);
    );
    buttons.put(9,
      List.newUsing([
        super.addSpec(\channel2SoloNoteOn, \noteOn, 0, 9, 0, 127),
        super.addSpec(\channel2SoloNoteOff, \noteOff, 0, 9, 0, 127),
      ]);
    );
    buttons.put(10,
      List.newUsing([
        super.addSpec(\channel3SoloNoteOn, \noteOn, 0, 10, 0, 127),
        super.addSpec(\channel3SoloNoteOff, \noteOff, 0, 10, 0, 127),
      ]);
    );
    buttons.put(11,
      List.newUsing([
        super.addSpec(\channel4SoloNoteOn, \noteOn, 0, 11, 0, 127),
        super.addSpec(\channel4SoloNoteOff, \noteOff, 0, 11, 0, 127),
      ]);
    );
    buttons.put(12,
      List.newUsing([
        super.addSpec(\channel5SoloNoteOn, \noteOn, 0, 12, 0, 127),
        super.addSpec(\channel5SoloNoteOff, \noteOff, 0, 12, 0, 127),
      ]);
    );
    buttons.put(13,
      List.newUsing([
        super.addSpec(\channel6SoloNoteOn, \noteOn, 0, 13, 0, 127),
        super.addSpec(\channel6SoloNoteOff, \noteOff, 0, 13, 0, 127),
      ]);
    );
    buttons.put(14,
      List.newUsing([
        super.addSpec(\channel7SoloNoteOn, \noteOn, 0, 14, 0, 127),
        super.addSpec(\channel7SoloNoteOff, \noteOff, 0, 14, 0, 127),
      ]);
    );
    buttons.put(15,
      List.newUsing([
        super.addSpec(\channel8SoloNoteOn, \noteOn, 0, 15, 0, 127),
        super.addSpec(\channel8SoloNoteOff, \noteOff, 0, 15, 0, 127),
      ]);
    );
    buttons.put(16,
      List.newUsing([
        super.addSpec(\channel1MuteNoteOn, \noteOn, 0, 16, 0, 127),
        super.addSpec(\channel1MuteNoteOff, \noteOff, 0, 16, 0, 127),
      ]);
    );
    buttons.put(17,
      List.newUsing([
        super.addSpec(\channel2MuteNoteOn, \noteOn, 0, 17, 0, 127),
        super.addSpec(\channel2MuteNoteOff, \noteOff, 0, 17, 0, 127),
      ]);
    );
    buttons.put(18,
      List.newUsing([
        super.addSpec(\channel3MuteNoteOn, \noteOn, 0, 18, 0, 127),
        super.addSpec(\channel3MuteNoteOff, \noteOff, 0, 18, 0, 127),
      ]);
    );
    buttons.put(19,
      List.newUsing([
        super.addSpec(\channel4MuteNoteOn, \noteOn, 0, 19, 0, 127),
        super.addSpec(\channel4MuteNoteOff, \noteOff, 0, 19, 0, 127),
      ]);
    );
    buttons.put(20,
      List.newUsing([
        super.addSpec(\channel5MuteNoteOn, \noteOn, 0, 20, 0, 127),
        super.addSpec(\channel5MuteNoteOff, \noteOff, 0, 20, 0, 127),
      ]);
    );
    buttons.put(21,
      List.newUsing([
        super.addSpec(\channel6MuteNoteOn, \noteOn, 0, 21, 0, 127),
        super.addSpec(\channel6MuteNoteOff, \noteOff, 0, 21, 0, 127),
      ]);
    );
    buttons.put(22,
      List.newUsing([
        super.addSpec(\channel7MuteNoteOn, \noteOn, 0, 22, 0, 127),
        super.addSpec(\channel7MuteNoteOff, \noteOff, 0, 22, 0, 127),
      ]);
    );
    buttons.put(23,
      List.newUsing([
        super.addSpec(\channel8MuteNoteOn, \noteOn, 0, 23, 0, 127),
        super.addSpec(\channel8MuteNoteOff, \noteOff, 0, 23, 0, 127),
      ]);
    );
    buttons.put(24,
      List.newUsing([
        super.addSpec(\channel1SelectNoteOn, \noteOn, 0, 24, 0, 127),
        super.addSpec(\channel1SelectNoteOff, \noteOff, 0, 24, 0, 127),
      ]);
    );
    buttons.put(25,
      List.newUsing([
        super.addSpec(\channel2SelectNoteOn, \noteOn, 0, 25, 0, 127),
        super.addSpec(\channel2SelectNoteOff, \noteOff, 0, 25, 0, 127),
      ]);
    );
    buttons.put(26,
      List.newUsing([
        super.addSpec(\channel3SelectNoteOn, \noteOn, 0, 26, 0, 127),
        super.addSpec(\channel3SelectNoteOff, \noteOff, 0, 26, 0, 127),
      ]);
    );
    buttons.put(27,
      List.newUsing([
        super.addSpec(\channel4SelectNoteOn, \noteOn, 0, 27, 0, 127),
        super.addSpec(\channel4SelectNoteOff, \noteOff, 0, 27, 0, 127),
      ]);
    );
    buttons.put(28,
      List.newUsing([
        super.addSpec(\channel5SelectNoteOn, \noteOn, 0, 28, 0, 127),
        super.addSpec(\channel5SelectNoteOff, \noteOff, 0, 28, 0, 127),
      ]);
    );
    buttons.put(29,
      List.newUsing([
        super.addSpec(\channel6SelectNoteOn, \noteOn, 0, 29, 0, 127),
        super.addSpec(\channel6SelectNoteOff, \noteOff, 0, 29, 0, 127),
      ]);
    );
    buttons.put(30,
      List.newUsing([
        super.addSpec(\channel7SelectNoteOn, \noteOn, 0, 30, 0, 127),
        super.addSpec(\channel7SelectNoteOff, \noteOff, 0, 30, 0, 127),
      ]);
    );
    buttons.put(31,
      List.newUsing([
        super.addSpec(\channel8SelectNoteOn, \noteOn, 0, 31, 0, 127),
        super.addSpec(\channel8SelectNoteOff, \noteOff, 0, 31, 0, 127),
      ]);
    );
    buttons.put(32,
      List.newUsing([
        super.addSpec(\channel8SelectNoteOn, \noteOn, 0, 31, 0, 127),
        super.addSpec(\channel8SelectNoteOff, \noteOff, 0, 31, 0, 127),
      ]);
    );
    buttons.put(33,
      List.newUsing([
        super.addSpec(\bankDownNoteOn, \noteOn, 0, 46, 0, 127),
        super.addSpec(\bankDownNoteOff, \noteOff, 0, 46, 0, 127),
      ]);
    );
    buttons.put(34,
      List.newUsing([
        super.addSpec(\bankUpNoteOn, \noteOn, 0, 47, 0, 127),
        super.addSpec(\bankUpNoteOff, \noteOff, 0, 47, 0, 127),
      ]);
    );
    buttons.put(35,
      List.newUsing([
        super.addSpec(\chanDownNoteOn, \noteOn, 0, 48, 0, 127),
        super.addSpec(\chanDownNoteOff, \noteOff, 0, 48, 0, 127),
      ]);
    );
    buttons.put(36,
      List.newUsing([
        super.addSpec(\chanUpNoteOn, \noteOn, 0, 49, 0, 127),
        super.addSpec(\chanUpNoteOff, \noteOff, 0, 49, 0, 127),
      ]);
    );
    buttons.put(37,
      List.newUsing([
        super.addSpec(\readNoteOn, \noteOn, 0, 74, 0, 127),
        super.addSpec(\readNoteOff, \noteOff, 0, 74, 0, 127),
      ]);
    );
    buttons.put(38,
      List.newUsing([
        super.addSpec(\writeNoteOn, \noteOn, 0, 75, 0, 127),
        super.addSpec(\writeNoteOff, \noteOff, 0, 75, 0, 127),
      ]);
    );
    buttons.put(39,
      List.newUsing([
        super.addSpec(\mixerNoteOn, \noteOn, 0, 78, 0, 127),
        super.addSpec(\mixerNoteOff, \noteOff, 0, 78, 0, 127),
      ]);
    );
    buttons.put(40,
      List.newUsing([
        super.addSpec(\rewindNoteOn, \noteOn, 0, 86, 0, 127),
        super.addSpec(\rewindNoteOff, \noteOff, 0, 86, 0, 127),
      ]);
    );
    buttons.put(41,
      List.newUsing([
        super.addSpec(\transDownNoteOn, \noteOn, 0, 91, 0, 127),
        super.addSpec(\transDownNoteOff, \noteOff, 0, 91, 0, 127),
      ]);
    );
    buttons.put(42,
      List.newUsing([
        super.addSpec(\transUpNoteOn, \noteOn, 0, 92, 0, 127),
        super.addSpec(\transUpNoteOff, \noteOff, 0, 92, 0, 127),
      ]);
    );
    buttons.put(43,
      List.newUsing([
        super.addSpec(\stopNoteOn, \noteOn, 0, 93, 0, 127),
        super.addSpec(\stopNoteOff, \noteOff, 0, 93, 0, 127),
      ]);
    );
    buttons.put(44,
      List.newUsing([
        super.addSpec(\playNoteOn, \noteOn, 0, 94, 0, 127),
        super.addSpec(\playNoteOff, \noteOff, 0, 94, 0, 127),
      ]);
    );
    buttons.put(45,
      List.newUsing([
        super.addSpec(\recordNoteOn, \noteOn, 0, 95, 0, 127),
        super.addSpec(\recordNoteOff, \noteOff, 0, 95, 0, 127),
      ]);
    );
    buttons.put(46,
      List.newUsing([
        super.addSpec(\zoomNoteOn, \noteOn, 0, 100, 0, 127),
        super.addSpec(\zoomNoteOff, \noteOff, 0, 100, 0, 127),
      ]);
    );
  }

  addJogwheels{
    jogwheels.put(0,
      List.newUsing([
        super.addSpec(\jogwheel1Control, \control, 0, 60, 0, 127),
        super.addSpec(\jogwheel1NoteOn, \noteOn, 0, 101, 0, 127),
        super.addSpec(\jogwheel1NoteOff, \noteOff, 0, 101, 0, 127)
      ])
    );
  }

  addPotis{
    potis.put(0,
      List.newUsing([
        super.addSpec(\nonLinearPoti1Control, \control, 0, 16, 0, 127),
        super.addSpec(\poti1NoteOn, \noteOn, 0, 32, 0, 127),
        super.addSpec(\poti1NoteOff, \noteOff, 0, 32, 0, 127)
      ])
    );
    potis.put(1,
      List.newUsing([
        super.addSpec(\nonLinearPoti2Control, \control, 0, 17, 0, 127),
        super.addSpec(\poti2NoteOn, \noteOn, 0, 33, 0, 127),
        super.addSpec(\poti2NoteOff, \noteOff, 0, 33, 0, 127)
      ])
    );
    potis.put(2,
      List.newUsing([
        super.addSpec(\nonLinearPoti3Control, \control, 0, 18, 0, 127),
        super.addSpec(\poti3NoteOn, \noteOn, 0, 34, 0, 127),
        super.addSpec(\poti3NoteOff, \noteOff, 0, 34, 0, 127)
      ])
    );
    potis.put(3,
      List.newUsing([
        super.addSpec(\nonLinearPoti4Control, \control, 0, 19, 0, 127),
        super.addSpec(\poti4NoteOn, \noteOn, 0, 35, 0, 127),
        super.addSpec(\poti4NoteOff, \noteOff, 0, 35, 0, 127)
      ])
    );
    potis.put(4,
      List.newUsing([
        super.addSpec(\nonLinearPoti5Control, \control, 0, 20, 0, 127),
        super.addSpec(\poti5NoteOn, \noteOn, 0, 36, 0, 127),
        super.addSpec(\poti5NoteOff, \noteOff, 0, 36, 0, 127)
      ])
    );
    potis.put(5,
      List.newUsing([
        super.addSpec(\nonLinearPoti6Control, \control, 0, 21, 0, 127),
        super.addSpec(\poti6NoteOn, \noteOn, 0, 37, 0, 127),
        super.addSpec(\poti6NoteOff, \noteOff, 0, 37, 0, 127)
      ])
    );
    potis.put(6,
      List.newUsing([
        super.addSpec(\nonLinearPoti7Control, \control, 0, 22, 0, 127),
        super.addSpec(\poti7NoteOn, \noteOn, 0, 38, 0, 127),
        super.addSpec(\poti7NoteOff, \noteOff, 0, 38, 0, 127)
      ])
    );
    potis.put(7,
      List.newUsing([
        super.addSpec(\nonLinearPoti8Control, \control, 0, 23, 0, 127),
        super.addSpec(\poti8NoteOn, \noteOn, 0, 39, 0, 127),
        super.addSpec(\poti8NoteOff, \noteOff, 0, 39, 0, 127)
      ])
    );
  }

  addFaders{
    faders.put(0,
      List.newUsing([
        super.addSpec(\fader1, \bend, 0, Nil, 0, 16383),
        super.addSpec(\fader1NoteOn, \noteOn, 0, 104, 0, 127),
        super.addSpec(\fader1NoteOff, \noteOff, 0, 104, 0, 127)
      ])
    );
    faders.put(1,
      List.newUsing([
        super.addSpec(\fader2, \bend, 1, Nil, 0, 16383),
        super.addSpec(\fader2NoteOn, \noteOn, 0, 105, 0, 127),
        super.addSpec(\fader2NoteOff, \noteOff, 0, 105, 0, 127)
      ])
    );
    faders.put(2,
      List.newUsing([
        super.addSpec(\fader3, \bend, 2, Nil, 0, 16383),
        super.addSpec(\fader3NoteOn, \noteOn, 0, 106, 0, 127),
        super.addSpec(\fader3NoteOff, \noteOff, 0, 106, 0, 127)
      ])
    );
    faders.put(3,
      List.newUsing([
        super.addSpec(\fader4, \bend, 3, Nil, 0, 16383),
        super.addSpec(\fader4NoteOn, \noteOn, 0, 107, 0, 127),
        super.addSpec(\fader4NoteOff, \noteOff, 0, 107, 0, 127)
      ])
    );
    faders.put(4,
      List.newUsing([
        super.addSpec(\fader5, \bend, 4, Nil, 0, 16383),
        super.addSpec(\fader5NoteOn, \noteOn, 0, 108, 0, 127),
        super.addSpec(\fader5NoteOff, \noteOff, 0, 108, 0, 127)
      ])
    );
    faders.put(5,
      List.newUsing([
        super.addSpec(\fader6, \bend, 5, Nil, 0, 16383),
        super.addSpec(\fader6NoteOn, \noteOn, 0, 109, 0, 127),
        super.addSpec(\fader6NoteOff, \noteOff, 0, 109, 0, 127)
      ])
    );
    faders.put(6,
      List.newUsing([
        super.addSpec(\fader7, \bend, 6, Nil, 0, 16383),
        super.addSpec(\fader7NoteOn, \noteOn, 0, 110, 0, 127),
        super.addSpec(\fader7NoteOff, \noteOff, 0, 110, 0, 127)
      ])
    );
    faders.put(7,
      List.newUsing([
        super.addSpec(\fader8, \bend, 7, Nil, 0, 16383),
        super.addSpec(\fader8NoteOn, \noteOn, 0, 111, 0, 127),
        super.addSpec(\fader8NoteOff, \noteOff, 0, 111, 0, 127)
      ])
    );
    faders.put(8,
      List.newUsing([
        super.addSpec(\fader9, \bend, 8, Nil, 0, 16383),
        super.addSpec(\fader9NoteOn, \noteOn, 0, 112, 0, 127),
        super.addSpec(\fader9NoteOff, \noteOff, 0, 112, 0, 127)
      ])
    );
  }
}