[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] [approve] KrBusWatcher



Thought it might be useful to have something to do client-side updates based on the current value of a kr bus.

Comments?

Add this class file to the lib and try this example.

Attachment: KrBusWatcher.sc
Description: Binary data



s.boot;

(
w = KrBusWatcher.newFrom(s);
b = { Bus.control(s, 2) } ! 3;
f = FlowView.new;
g = b.collect({ |bus|
var res;
res = { SCSlider(f, Rect(0, 0, 100, 20)) } ! 2;
f.decorator.nextLine;
res
});

"test", { |bus|
Out.kr(bus, { Rand(0.2, 0.7), 0.5, 0.5) } ! 2)
}).send(s);
)

(
b.do({ |bus|
"test", [\bus, bus.index]);
w.register(bus);
Updater(bus, { |bus, vals|
{ g[bus.index>>1].do({ |sl, i|
sl.value_(vals[i])
}); }.defer;
})
});
w.startAliveThread;
)

hjh
____________________________________

H. James Harkins /// dewdrop_world
http://www.dewdrop-world.net

"If attacked by a lion, thrust your arm down his throat.
This takes some practice." -- Cyril Connolly