« Return to Thread: WiiMote example code request

Re: WiiMote example code request

by Stephan Wittwer :: Rate this Message:

Reply to Author | View in Thread


Am 16.05.2008 um 11:03 schrieb nescivi:

> WiiMote.start;    // start the eventloop
> WiiMote.discover; // discover a new device (wait for post about  
> connected)


I tried this several times, with no luck (Dual G5 Mac, 10.5.2).

Post window says:

        ///
WII: searching wiimote 1
device added
[ a WiiMote ]
WARNING:
WiiMote disconnected!
        ///

This non-functional instance of WiiMote is in WiiMote.all now.
If one tries WiiMote.discover again, without doing closeAll before,  
it's possible to populate the array with many more instances, all of  
them pointing to the same hardware device. Why?

Pete Moss's WiimoteLib UGens are working fine here, as are  
DarwiinRemote.app and OSCulator.app
(glad they exist since I have the WiiMote device only since yesterday  
and first thought it was broken).

May I ask this question:
Is WiiMote from SCClassLibray working at all for anybody (on a Mac) ?

Regards
Stephan



>
> 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:
>>
>> I guess the code is not clear enough for me.
>> Is it rude to ask you to spell it out for me?
>> How does this action look like?
>> Thanks for your patience
>> Tomer
>>
>>
>> nescivi wrote:
>>>
>>> Is the example code in the helpfile not clear enough?
>>>
>>> You can just set the action to put the value on a control bus for  
>>> the
>>> sensors that you are interested in. Then you can use the values
>>> directly inside a SynthDef by reading from the control bus.
>>>
>>> sincerely,
>>> Marije
>>>
>>> On 5/14/08, Tomer Harari <hatanin@...> wrote:
>>>>
>>>> Hi,
>>>> I am looking for some example code for using the wiimote and  
>>>> nunchuk.
>>>> I had luck with Pete Moss's WiimoteLib, but it does not support the
>>>> nunchuk.
>>>> so, I would like to get some examples of how to tap in to the
>>>> accelerometers, and map them to a control bus or use them inside a
>>>> SynthDef
>>>> with the WiiMote class that comes with SC.
>>>> Thanks a lot
>>>> Tomer
>>>>
>>>>
_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

 « Return to Thread: WiiMote example code request