.cc - week one.
This is my first experiment with creating a GUI in SuperCollider. It's a "Gain Envelope" program, an idea I borrowed from Peak. Note that at this stage it's a bit like Anna Kornikova, it looks good but doesn't actually do anything.
SuperCollider has plenty of options for the creation of UI's. I had a look at a video on youtube that uses the WiimoteLib class to use a Wii controller with SC.
(
var a, env, c, combo, comboInfo, loadButton, saveButton, previewButton, soundFile;
//window
a = GUI.window.new( "Gain Envelope...", Rect(158, 185, 360, 315));
a.view.decorator = FlowLayout(a.view.bounds);
comboInfo = ["Fade In", "Fade Out", "Retro Synth", "Random"];
combo = SCPopUpMenu(a, Rect(10,10,100,20));
combo.items = comboInfo;
combo.background_(Color.white);
combo.action = {/*ACTION*/};
//envelope
env = SCEnvelopeView(a, Rect(0, 0, 350, 100))
.thumbSize_(5)
.drawLines_(true)
.fillColor_(Color.black)
.selectionColor_(Color.red)
.drawRects_(true)
.value_([(0.0, 0.25 .. 1.0), (0.0, 0.25 .. 1.0)])
.setEditable(0,false);
a.front;
//buttons
loadButton = SCButton(a, Rect(10,10,114,20))
.states_([
["Load", Color.black, Color.white],
["Loading file", Color.black, Color.grey]
])
.action_({/*ACTION*/});
saveButton = SCButton(a, Rect(10,10,114,20))
.states_([
["Save", Color.black, Color.white],
["Saving file", Color.black, Color.grey]
])
.action_({/*ACTION*/});
previewButton = SCButton(a, Rect(10,10,114,20))
.states_([
["Preview", Color.black, Color.white],
["Previewing", Color.black, Color.grey]
])
.action_({/*ACTION*/});
//sliders
b = [0, 100].asSpec;
c = SCNumberBox(a, Rect(10, 20, 40, 20));
j = SCSlider(a, Rect(10, 80, 305, 20))
.focusColor_(Color.red(alpha:0.2))
.action_({
c.value_(b.map(j.value).round(0.01))
});
//sound file
soundFile = SCSoundFileView.new(a, Rect(20,20, 350, 120));
f = SoundFile.new;
f.openRead("sounds/a11wlk01.wav");
f.inspect;
soundFile.soundfile = f;
soundFile.read(0, f.numFrames);
soundFile.elasticMode = true;
soundFile.timeCursorOn = true;
soundFile.timeCursorColor = Color.black;
soundFile.gridColor = Color.white;
// soundFile.waveformColor = Color.grey;
soundFile.timeCursorColor = Color.grey;
soundFile.setSelectionColor(0, Color.grey);
soundFile.timeCursorPosition = 2050;
soundFile.drawsWaveForm = true;
soundFile.gridOn = true;
soundFile.gridResolution = 0.2;
)
ui.rtf
.sources.
Haines, Christian 31.07.08, "Graphical User Interface (1)," Lecture of EMU, Adelaide University.
iieiwrmeieweeiimeemmwreiweremweireeemeimwieewwrwweereireeiimeewmiwwwemwiewimeeeremeiewmemweewieewerwemwiimiewmeiwireiiwrrewmwewree |
4.8.08
I am the operator of my SuperCollider GUI
copywrite 10:02 pm
Subscribe to:
Post Comments (Atom)
1 comment:
Anna Kornikova
Hah, burn.
Post a Comment