Last active
January 21, 2019 00:16
-
-
Save caseyanderson/7daadbe8be4f80cbe9434db3960e55c1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
midi controls gui | |
written for midifighter twister | |
HT Scott Cazan for line 40 | |
*/ | |
s.boot; | |
MIDIIn.connectAll; | |
// setup GUI | |
( | |
~knob0 = Bus.control(s, 1); | |
a = currentEnvironment; | |
~window = Window.new("mixer", Rect(0, 0, 465, 335)) | |
.onClose_({ | |
"closing".postln; | |
}); | |
~window.background = Color.gray(0.15); | |
a[\k0Label] = StaticText(~window, Rect( 10, 10, 100, 50)); | |
a[\k0Label].align = \center; | |
a[\k0Label].background = Color.gray(0.15); | |
a[\k0Label].stringColor = Color.white; | |
a[\k0Label].string = "test"; | |
// display val in box | |
a[\k0Val] = NumberBox(~window, Rect(10, 60, 100, 50)); | |
a[\k0Val].align = \center; | |
a[\k0Val].background = Color.white; | |
// make the knob, connect to NumberBox | |
a[\k0] = Knob.new(~window, Rect(10, 120, 100, 100)); | |
a[\k0].background_(Color.black); | |
a[\k0].action_{ |knob| | |
~knob0.set(knob.value); // gui sets bus value | |
a[\k0Val].value_(knob.value); // gui also updates numberbox | |
}; | |
// | |
~window.front; | |
) | |
( | |
// controller interface | |
MIDIdef.cc(\knob0, {arg ...msg; | |
var val = msg[0].linlin(0, 127, 0.0, 1.0); | |
{ ~k0.valueAction_(val) }.defer; | |
}, 0); | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment