WiiMote.start; // start the eventloop
WiiMote.discover; // discover a new device (wait for post about connected)
WiiMote.all; // post an array of all devices
w = WiiMote.all[0];
x = WiiMoteGUI.new( w ); // create a GUI (only covers the WiiMote and
NunChuk currently)
w.enableMotionSensor( 1 );
w.enableExpansion( 1 );
// create bus on the server
b = Bus.control( s, 1 );
w.setAction( \ax, { |v| b.set( v ) } ); // write the value to the bus.
SynthDef( \wii_example, { |out=0,amp=0|
Out.ar( out, SinOsc.ar( 300, 0, 0.01*amp.abs ) );
}).load( s );
)
x = Synth.new( \wii_example );
x.map( \amp, b );
x.free;
// same but using In.kr to read from bus
SynthDef( \wii_example2, { |out=0,controlbus=0|
var amp;
amp = In.kr( controlbus, 1 );
Out.ar( out, SinOsc.ar( 300, 0, 0.01*amp.abs ) );
}).load( s );
)
x = Synth.new( \wii_example2, [\controlbus, b] );
x.free;
On 5/16/08, Tomer Harari <
hatanin@...> wrote:
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users