Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: «Gui for NanoKontrol 2»
name
code content
//Gui for NanoKontrol 2 by GlacioArdor //Gui ( s.waitForBoot({ var win, defFont, title, ccs, lbls, syms, trackLbl; // Main window // Window.closeAll; win = Window.new("NanoKontrol2 GUI", Rect(0, 600, 1024, 300), false, true); win.onClose = {s.freeAll; "NanoKontrol2 GUI window closed.".postln; "".postln}; // win.background = Color.gray(0.9); //win.alpha = 0.9; //FreqScope.new; title = StaticText.new(win, Rect(45, 50, 250, 20)); title.align = \left; title.font = Font("Arial", 28); title.string = "nanoKONTROL2"; //Create 8 slider and add labels ccs = SparseArray.new; lbls = SparseArray.new; syms = SparseArray.new; 8.do { |i| ccs.put(i, Slider.new(win, Rect(343 + (87 * i), 90, 27, 140))); lbls.put(i, StaticText.new(win, Rect(335 + (87 * i), 235, 40, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_("CC#0" ++ i) ); }; //Create 8 knobs and labels on top (16 .. 23).do { |i| ccs.put(i, Knob.new(win, Rect(335 + (87 * (i-16)), 25, 45, 45))); lbls.put(i, StaticText.new(win, Rect(335 + (87 * (i-16)), 70, 40, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_("CC#" ++ i) ); }; //Create 3 buttons on left of each slider // for this you need nested loops (there's another trick, but not today) (32 .. 39).do { |i| 3.do { |j| var ccnum = i + (16 * j); ccs.put(ccnum, Button(win, Rect(310 + (87 * (i-32)), 98 + (47 * j), 26, 26))); lbls.put(ccnum, StaticText.new(win, Rect(302 + (87 * (i-32)), 124 + (47 * j), 40, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_("CC#" ++ ccnum) ); syms.put(ccnum, StaticText.new(win, Rect(303 + (87 * (i-32)), 102 + (47 * j), 40, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_("SMR".at(j)) ); }; }; [43, 44, 42, 41, 45].do { |ccnum, i| ccs.put(ccnum, Button(win, Rect(40 + (50 * i), 192, 26, 26))); lbls.put(ccnum, StaticText.new(win, Rect(35 + (50 * i), 218, 40, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_("CC#" ++ ccnum) ); syms.put(ccnum, StaticText.new(win, Rect(40 + (50 * i), 175, 26, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_(#["<<", ">>", "□", ">", "o"].at(i)) ); }; [46, 60, 61, 62].do { |ccnum, i| ccs.put(ccnum, Button(win, Rect(40 + (50 * i), 148, 26, 13))); lbls.put(ccnum, StaticText.new(win, Rect(35 + (50 * i), 158, 40, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_("CC#" ++ ccnum) ); syms.put(ccnum, StaticText.new(win, Rect(36 + (50 * i), 132, 32, 20)) .align_(\center) .font_(Font("Arial", 9)) .string_(#["CYCLE", "SET", "<", ">"].at(i)) ); }; [58, 59].do { |ccnum, i| ccs.put(ccnum, Button(win, Rect(40 + (50 * i), 104, 26, 13))); lbls.put(ccnum, StaticText.new(win, Rect(35 + (50 * i), 114, 40, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_("CC#" ++ ccnum) ); syms.put(ccnum, StaticText.new(win, Rect(36 + (50 * i), 89, 36, 20)) .align_(\center) .font_(Font("Arial", 11)) .string_(#["<", ">"].at(i)) ); }; trackLbl = StaticText.new(win, Rect(63, 89, 30, 20)); trackLbl.align = \center; trackLbl.font = Font("Arial", 9); trackLbl.string = "TRACK"; win.front; }); // end of waitForBoot )
code description
GUI for NanoKontrol2 (barebone)
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change