Separation of Data and GUI in SC3dev
//this simple example shows how sound and graphics both are equally
//only the repesentation of the underlying data. (jrh)
(
#{
{
var c;
c = ControlValue(\unipolar, \pisa, 0);
Sequencer.kr({ c.set(c.get*0.9); 0.0 }, Impulse.kr(10));
SinOsc.ar(ControlSpace.kr(0)*200+[200, 300], 0, 0.1) + SinOsc.ar([200, 300], 0, 0.1);
}.play(id: \pisa);
}.send;
)
(
x = GUIScreen("-", Rect.newBy(500, 100, 50, 200), v = View.new);
p = Pen(foreColor: rgb(100, 100, 100), backColor: rgb(100, 100, 100), action: \fill);
v.pen = p;
d = Slider(nil, Rect.newBy(50, 20, 20, 150), ControlValue(\unipolar, \pisa, 0, 0));
v.items = [ Rect.newBy(0, 0, 150, 200), d];
x.sched(0, inf, { x.refresh; 0.01 });
)
(
#{
{
var c;
c = ControlValue(\unipolar, \pisa, 0);
Sequencer.kr({ c.set(1.0.rand); 0.0 }, Impulse.kr(0.4));
SinOsc.ar(ControlSpace.kr(0)*200+200, 0, 0.1);
}.play(id: \pisa);
}.send;
)
//not to forget: remove the reference after finishing:
ControlSpace.removeAt(\pisa);
Links to this Page
- enter. last edited on 29 January 2003 at 10:46 pm by 203.14.169.19
- Theory last edited on 2 August 2006 at 3:11 pm by Q1e64.q.pppool.de