/[soapbox]/misc.wiiremote/trunk/misc.wiiremote.cpp
ViewVC logotype

Contents of /misc.wiiremote/trunk/misc.wiiremote.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3132 - (show annotations) (download)
Sun May 22 17:49:03 2011 UTC (11 years, 1 month ago) by tadas
File size: 19404 byte(s)
bin update
1 // misc.wiiremote.c
2 // Copyright by Masayuki Akamatsu
3
4
5 #include "ext.h"
6 #include "ext_obex.h"
7 #include "ext_strings.h"
8 #include "ext_common.h"
9 #include "ext_systhread.h"
10
11 #include "wiimote.h"
12 //#include <stdio.h>
13 //using namespace std;
14
15 #define T_EXPORT __declspec(dllexport)
16
17 #define kInterval 100
18 #define kMaxTrial 100
19
20 typedef struct _miscwiiremote
21 {
22 struct object obj;
23
24 wiimote *wiiremote;
25
26 //void *clock;
27 //Boolean connected;
28 bool isExtraOutputEnabled;
29
30 void *statusOut;
31 void *dataOut;
32 } t_miscwiiremote;
33
34 static t_class *miscwiiremote_class; // the number of instance of this object
35
36 void miscwiiremote_bang(t_miscwiiremote *x);
37 void miscwiiremote_connect(t_miscwiiremote *x, long devNumber);
38 void miscwiiremote_disconnect(t_miscwiiremote *x);
39 void miscwiiremote_motionsensor(t_miscwiiremote *x, long enable);
40 void miscwiiremote_irsensor(t_miscwiiremote *x, long enable);
41 void miscwiiremote_vibration(t_miscwiiremote *x, long enable);
42 void miscwiiremote_led(t_miscwiiremote *x, long enable1, long enable2, long enable3, long enable4);
43 void miscwiiremote_expansion(t_miscwiiremote *x, long enable);
44 void miscwiiremote_extraoutput(t_miscwiiremote *x, long enable);
45
46 void miscwiiremote_getbattery(t_miscwiiremote *x);
47 void miscwiiremote_getexpansion(t_miscwiiremote *x);
48 void miscwiiremote_getled(t_miscwiiremote *x);
49 void miscwiiremote_getcalibration(t_miscwiiremote *x);
50
51 void miscwiiremote_assist(t_miscwiiremote *x, void *b, long m, long a, char *s);
52 void miscwiiremote_clock(t_miscwiiremote *x);
53 void *miscwiiremote_new(t_symbol *s, short ac, t_atom *av);
54 void miscwiiremote_free(t_miscwiiremote *x);
55
56 char remoteStr[] = "remote";
57 char nunchukStr[] = "nunchuk";
58 char classicStr[] = "classic";
59 char motionPlusStr[] = "motionplus";
60 char balanceBoardStr[] = "balanceboard";
61
62 int T_EXPORT main(void)
63 {
64 post("misc.wiiremote alpha1 \"evil duck\" by Tadas Dailyda (using WiiYourself lib)");
65
66 t_class *c = class_new("misc.wiiremote", (method)miscwiiremote_new, (method)miscwiiremote_free, sizeof(t_miscwiiremote), (method)NULL, A_GIMME, 0);
67
68 common_symbols_init();
69
70 class_addmethod(c, (method)miscwiiremote_bang, "bang", 0);
71 class_addmethod(c, (method)miscwiiremote_connect, "connect", A_DEFLONG, 0);
72 class_addmethod(c, (method)miscwiiremote_disconnect, "disconnect", 0);
73 class_addmethod(c, (method)miscwiiremote_motionsensor, "motion", A_DEFLONG, 0);
74 class_addmethod(c, (method)miscwiiremote_irsensor, "ir", A_DEFLONG, 0);
75 class_addmethod(c, (method)miscwiiremote_vibration, "vibration", A_DEFLONG, 0);
76 class_addmethod(c, (method)miscwiiremote_led, "led", A_DEFLONG, A_DEFLONG, A_DEFLONG, A_DEFLONG, 0);
77 class_addmethod(c, (method)miscwiiremote_expansion, "expansion", A_DEFLONG, 0);
78 class_addmethod(c, (method)miscwiiremote_expansion, "nunchuk", A_DEFLONG, 0);
79 class_addmethod(c, (method)miscwiiremote_extraoutput, "extraoutput", A_DEFLONG, 0);
80
81 class_addmethod(c, (method)miscwiiremote_getbattery, "getbattery", 0);
82 class_addmethod(c, (method)miscwiiremote_getexpansion, "getexpansion", 0);
83 class_addmethod(c, (method)miscwiiremote_getled, "getled", 0);
84 class_addmethod(c, (method)miscwiiremote_getcalibration, "getcalibration", 0);
85
86 class_addmethod(c, (method)miscwiiremote_assist, "assist", A_CANT, 0);
87
88 class_register(_sym_box, c);
89 miscwiiremote_class = c;
90
91 return 0;
92 }
93
94 //--------------------------------------------------------------------------------------------
95
96 void miscwiiremote_bang(t_miscwiiremote *x)
97 {
98 t_atom av[7];
99
100 if (!x->wiiremote->IsConnected() || x->wiiremote->RefreshState() == NO_CHANGE)
101 return; // do nothing
102
103
104 if (x->wiiremote->NunchukConnected())
105 {
106 // Buttons
107 SETSYM(av, gensym("buttons"));
108 SETLONG(av + 1, x->wiiremote->Nunchuk.C);
109 SETLONG(av + 2, x->wiiremote->Nunchuk.Z);
110 outlet_anything(x->dataOut, gensym(nunchukStr), 3, av);
111
112 // Joystick
113 SETSYM(av, gensym("stick"));
114 SETFLOAT(av + 1, x->wiiremote->Nunchuk.Joystick.X);
115 SETFLOAT(av + 2, x->wiiremote->Nunchuk.Joystick.Y);
116 outlet_anything(x->dataOut, gensym(nunchukStr), 3, av);
117
118 if (x->isExtraOutputEnabled)
119 {
120 SETSYM(av, gensym("stick_calibration"));
121 SETLONG(av + 1, x->wiiremote->Nunchuk.CalibrationInfo.MinX);
122 SETLONG(av + 2, x->wiiremote->Nunchuk.CalibrationInfo.MaxX);
123 SETLONG(av + 3, x->wiiremote->Nunchuk.CalibrationInfo.MidX);
124 SETLONG(av + 4, x->wiiremote->Nunchuk.CalibrationInfo.MinY);
125 SETLONG(av + 5, x->wiiremote->Nunchuk.CalibrationInfo.MaxY);
126 SETLONG(av + 6, x->wiiremote->Nunchuk.CalibrationInfo.MidY);
127 outlet_anything(x->dataOut, gensym(nunchukStr), 7, av);
128 }
129
130 // Motion Sensor
131 //if (x->wiiremote->isMotionSensorEnabled)
132 //{
133 SETSYM(av, gensym("motion"));
134 SETLONG(av + 1, x->wiiremote->Nunchuk.Acceleration.X);
135 SETLONG(av + 2, x->wiiremote->Nunchuk.Acceleration.Y);
136 SETLONG(av + 3, x->wiiremote->Nunchuk.Acceleration.Z);
137 SETLONG(av + 4, x->wiiremote->Nunchuk.Acceleration.Orientation.Pitch);
138 SETLONG(av + 5, x->wiiremote->Nunchuk.Acceleration.Orientation.Roll);
139 outlet_anything(x->dataOut, gensym(nunchukStr), 6, av);
140
141 if (x->isExtraOutputEnabled)
142 {
143 SETSYM(av, gensym("motion_calibration"));
144 SETLONG(av + 1, x->wiiremote->Nunchuk.CalibrationInfo.X0);
145 SETLONG(av + 2, x->wiiremote->Nunchuk.CalibrationInfo.Y0);
146 SETLONG(av + 3, x->wiiremote->Nunchuk.CalibrationInfo.Z0);
147 SETLONG(av + 4, x->wiiremote->Nunchuk.CalibrationInfo.XG);
148 SETLONG(av + 5, x->wiiremote->Nunchuk.CalibrationInfo.YG);
149 SETLONG(av + 6, x->wiiremote->Nunchuk.CalibrationInfo.ZG);
150 outlet_anything(x->dataOut, gensym(nunchukStr), 7, av);
151 }
152 //}
153 }
154
155 // Wii Remote
156
157 // Buttons
158 SETSYM(av, gensym("buttons"));
159 SETLONG(av + 1, x->wiiremote->Button.Bits);
160 outlet_anything(x->dataOut, gensym(remoteStr), 2, av);
161
162 // IR Sensor
163 /*if (x->wiiremote->isIRSensorEnabled)
164 {
165 SETSYM(av, gensym("ir"));
166 SETFLOAT(av + 1, x->wiiremote->posX); // posX and posY are "float"????
167 SETFLOAT(av + 2, x->wiiremote->posY);
168 SETFLOAT(av + 3, x->wiiremote->angle);
169 SETLONG (av + 4, x->wiiremote->tracking);
170 outlet_anything(x->dataOut, gensym(remoteStr), 5, av);
171
172 if (x->wiiremote->isExtraOutputEnabled) // B7
173 {
174 SETSYM(av, gensym("irraw"));
175 SETLONG(av + 1, 0);
176 SETLONG(av + 2, x->wiiremote->irData[0].x);
177 SETLONG(av + 3, x->wiiremote->irData[0].y);
178 SETLONG(av + 4, x->wiiremote->irData[0].s);
179 outlet_anything(x->dataOut, gensym(remoteStr), 5, av);
180 SETLONG(av + 1, 1);
181 SETLONG(av + 2, x->wiiremote->irData[1].x);
182 SETLONG(av + 3, x->wiiremote->irData[1].y);
183 SETLONG(av + 4, x->wiiremote->irData[1].s);
184 outlet_anything(x->dataOut, gensym(remoteStr), 5, av);
185 SETLONG(av + 1, 2);
186 SETLONG(av + 2, x->wiiremote->irData[2].x);
187 SETLONG(av + 3, x->wiiremote->irData[2].y);
188 SETLONG(av + 4, x->wiiremote->irData[2].s);
189 outlet_anything(x->dataOut, gensym(remoteStr), 5, av);
190 SETLONG(av + 1, 3);
191 SETLONG(av + 2, x->wiiremote->irData[3].x);
192 SETLONG(av + 3, x->wiiremote->irData[3].y);
193 SETLONG(av + 4, x->wiiremote->irData[3].s);
194 outlet_anything(x->dataOut, gensym(remoteStr), 5, av);
195 }
196 }*/
197
198 // Motion Sensor
199 //if (x->wiiremote->isMotionSensorEnabled)
200 //{
201 SETSYM(av, gensym("motion"));
202 SETFLOAT(av + 1, x->wiiremote->Acceleration.X);
203 SETFLOAT(av + 2, x->wiiremote->Acceleration.Y);
204 SETFLOAT(av + 3, x->wiiremote->Acceleration.Z);
205 SETFLOAT(av + 4, x->wiiremote->Acceleration.Orientation.Pitch);
206 SETFLOAT(av + 5, x->wiiremote->Acceleration.Orientation.Roll);
207 outlet_anything(x->dataOut, gensym(remoteStr), 6, av);
208
209 if (x->isExtraOutputEnabled) // B7
210 {
211 SETSYM(av, gensym("motion_calibration"));
212 SETLONG(av + 1, x->wiiremote->CalibrationInfo.X0);
213 SETLONG(av + 2, x->wiiremote->CalibrationInfo.Y0);
214 SETLONG(av + 3, x->wiiremote->CalibrationInfo.Z0);
215 SETLONG(av + 4, x->wiiremote->CalibrationInfo.XG);
216 SETLONG(av + 5, x->wiiremote->CalibrationInfo.YG);
217 SETLONG(av + 6, x->wiiremote->CalibrationInfo.ZG);
218 outlet_anything(x->dataOut, gensym(remoteStr), 7, av);
219 }
220 //}
221
222 if (x->wiiremote->MotionPlusEnabled())
223 {
224 SETSYM(av, gensym("motion"));
225 SETFLOAT(av + 1, x->wiiremote->MotionPlus.Speed.Pitch);
226 SETFLOAT(av + 2, x->wiiremote->MotionPlus.Speed.Roll);
227 SETFLOAT(av + 3, x->wiiremote->MotionPlus.Speed.Yaw);
228 outlet_anything(x->dataOut, gensym(motionPlusStr), 4, av);
229 }
230 }
231
232 //--------------------------------------------------------------------------------------------
233
234 void miscwiiremote_connect(t_miscwiiremote *x, long devNumber)
235 {
236 t_atom status;
237 bool result = false;
238
239 if (!x->wiiremote->IsConnected())
240 {
241 result = x->wiiremote->Connect(devNumber ? devNumber : wiimote::FIRST_AVAILABLE);
242 }
243 SETLONG(&status, result);
244 outlet_anything(x->statusOut, gensym("connect"), 1, &status);
245 }
246
247 void miscwiiremote_foundFunc(t_miscwiiremote *x)
248 {
249 }
250
251 void miscwiiremote_disconnect(t_miscwiiremote *x)
252 {
253 bool result = false;
254 t_atom status;
255
256 if (x->wiiremote->IsConnected())
257 {
258 x->wiiremote->Disconnect();
259 result = true;
260 }
261 SETLONG(&status, result);
262 outlet_anything(x->statusOut, gensym("disconnect"), 1, &status);
263
264 //x->connected = !result;
265 }
266
267 //--------------------------------------------------------------------------------------------
268
269 void miscwiiremote_motionsensor(t_miscwiiremote *x, long enable)
270 {
271 Boolean result;
272 t_atom status;
273
274 //result = wiiremote_motionsensor(x->wiiremote, enable);
275 //SETLONG(&status, result);
276 //outlet_anything(x->statusOut, gensym("motion"), 1, &status);
277 }
278
279 void miscwiiremote_irsensor(t_miscwiiremote *x, long enable)
280 {
281 Boolean result;
282 t_atom status;
283
284 //result = wiiremote_irsensor(x->wiiremote, enable);
285 //SETLONG(&status, result);
286 //outlet_anything(x->statusOut, gensym("ir"), 1, &status);
287 }
288
289 void miscwiiremote_extraoutput(t_miscwiiremote *x, long enable) // B7
290 {
291 //x->wiiremote->isExtraOutputEnabled = enable;
292 }
293
294 void miscwiiremote_expansion(t_miscwiiremote *x, long enable)
295 {
296 Boolean result;
297 t_atom status;
298
299 //result = wiiremote_expansion(x->wiiremote, enable);
300 //SETLONG(&status, result);
301 //outlet_anything(x->statusOut, gensym("nunchuk"), 1, &status);
302 }
303
304 void miscwiiremote_vibration(t_miscwiiremote *x, long enable)
305 {
306 bool result = false;
307 t_atom status;
308
309 if (x->wiiremote->IsConnected())
310 {
311 x->wiiremote->SetRumble(enable);
312 result = true;
313 }
314 SETLONG(&status, result);
315 outlet_anything(x->statusOut, gensym("vibration"), 1, &status);
316 }
317
318 void miscwiiremote_led(t_miscwiiremote *x, long enable1, long enable2, long enable3, long enable4)
319 {
320 bool result = false;
321 t_atom status;
322
323 if (x->wiiremote->IsConnected())
324 {
325 byte leds = enable4<<3 | enable3<<2 | enable2<<1 | enable1;
326 x->wiiremote->SetLEDs(leds);
327 result = true;
328 }
329 //result = wiiremote_led(x->wiiremote, enable1, enable2, enable3, enable4);
330 SETLONG(&status, result);
331 outlet_anything(x->statusOut, gensym("led"), 1, &status);
332 }
333
334 //--------------------------------------------------------------------------------------------
335
336 void miscwiiremote_getbattery(t_miscwiiremote *x)
337 {
338 if (!x->wiiremote->IsConnected())
339 {
340 outlet_anything(x->statusOut, gensym("battery"), 0, nil);
341 }
342 else
343 {
344 t_atom status;
345
346 SETFLOAT(&status, x->wiiremote->BatteryRaw * 0.5);
347 outlet_anything(x->statusOut, gensym("battery"), 1, &status);
348 }
349 }
350
351 void miscwiiremote_getexpansion(t_miscwiiremote *x)
352 {
353 /*if (x->wiiremote->device == nil)
354 {
355 outlet_anything(x->statusOut, gensym("expansion"), 0, nil);
356 }
357 else
358 {
359 t_atom status;
360 if (x->wiiremote->isExpansionPortAttached)
361 SETLONG(&status, x->wiiremote->expType);
362 else
363 SETLONG(&status, 0);
364 outlet_anything(x->statusOut, gensym("expansion"), 1, &status);
365 }*/
366 }
367
368 void miscwiiremote_getled(t_miscwiiremote *x)
369 {
370 if (!x->wiiremote->IsConnected())
371 {
372 outlet_anything(x->statusOut, gensym("led"), 0, nil);
373 }
374 else
375 {
376 t_atom list[4];
377
378 SETLONG(list, x->wiiremote->LED.Lit(0));
379 SETLONG(list + 1, x->wiiremote->LED.Lit(1));
380 SETLONG(list + 2, x->wiiremote->LED.Lit(2));
381 SETLONG(list + 3, x->wiiremote->LED.Lit(3));
382 outlet_anything(x->statusOut, gensym("led"), 4, list);
383 }
384 }
385
386 void miscwiiremote_getcalibration(t_miscwiiremote *x)
387 {
388 /*if (x->wiiremote->device == nil)
389 {
390 outlet_anything(x->statusOut, gensym("calibration"), 0, nil);
391 }
392 else
393 {
394 t_atom list[8];
395
396 if (x->wiiremote->isExpansionPortAttached)
397 {
398 SETSYM(list, gensym(nunchukStr));
399 SETSYM(list + 1, gensym("stick"));
400 SETLONG(list + 2, x->wiiremote->nunchukJoyStickCalibData.x_max);
401 SETLONG(list + 3, x->wiiremote->nunchukJoyStickCalibData.x_min);
402 SETLONG(list + 4, x->wiiremote->nunchukJoyStickCalibData.x_center);
403 SETLONG(list + 5, x->wiiremote->nunchukJoyStickCalibData.y_max);
404 SETLONG(list + 6, x->wiiremote->nunchukJoyStickCalibData.y_min);
405 SETLONG(list + 7, x->wiiremote->nunchukJoyStickCalibData.y_center);
406 outlet_anything(x->statusOut, gensym("calibration"), 8, list);
407
408 SETSYM(list + 1, gensym("motion"));
409 SETLONG(list + 2, x->wiiremote->nunchukCalibData.accX_zero);
410 SETLONG(list + 3, x->wiiremote->nunchukCalibData.accY_zero);
411 SETLONG(list + 4, x->wiiremote->nunchukCalibData.accZ_zero);
412 SETLONG(list + 5, x->wiiremote->nunchukCalibData.accX_1g);
413 SETLONG(list + 6, x->wiiremote->nunchukCalibData.accY_1g);
414 SETLONG(list + 7, x->wiiremote->nunchukCalibData.accZ_1g);
415 outlet_anything(x->statusOut, gensym("calibration"), 8, list);
416 }
417
418 SETSYM(list, gensym(remoteStr));
419 SETSYM(list + 1, gensym("motion"));
420 SETLONG(list + 2, x->wiiremote->wiiCalibData.accX_zero);
421 SETLONG(list + 3, x->wiiremote->wiiCalibData.accY_zero);
422 SETLONG(list + 4, x->wiiremote->wiiCalibData.accZ_zero);
423 SETLONG(list + 5, x->wiiremote->wiiCalibData.accX_1g);
424 SETLONG(list + 6, x->wiiremote->wiiCalibData.accY_1g);
425 SETLONG(list + 7, x->wiiremote->wiiCalibData.accZ_1g);
426 outlet_anything(x->statusOut, gensym("calibration"), 8, list);
427 }*/
428 }
429 //--------------------------------------------------------------------------------------------
430
431 /*void miscwiiremote_clock(t_miscwiiremote *x)
432 {
433 Boolean connection;
434 t_atom status;
435
436 //connection = wiiremote_isconnected(x->wiiremote);
437
438 if (x->connected == false && connection == true) // if the device is connected...
439 {
440 //wiiremote_getstatus(x->wiiremote);
441 x->connected = true;
442 SETLONG(&status, 1);
443 outlet_anything(x->statusOut, gensym("connect"), 1, &status);
444 }
445
446 if (x->connected == true && connection == false)
447 {
448 x->connected = false;
449 SETLONG(&status, 0);
450 outlet_anything(x->statusOut, gensym("connect"), 1, &status);
451 }
452
453 clock_delay(x->clock, kInterval); // restart clock
454 }*/
455
456 //--------------------------------------------------------------------------------------------
457
458 void miscwiiremote_assist(t_miscwiiremote *x, void *b, long io, long index, char *s)
459 {
460 switch (io) {
461 case 1:
462 strncpy_zero(s, "our inlet", 512);
463 break;
464 case 2:
465 switch (index) {
466 case 0:
467 strncpy_zero(s, "data messages", 512);
468 break;
469 case 1:
470 strncpy_zero(s, "status messages", 512);
471 break;
472 }
473 break;
474 }
475 }
476
477 void on_state_change (wiimote &remote, state_change_flags changed, const wiimote_state &new_state)
478 {
479 // we use this callback to set report types etc. to respond to key events
480 // (like the wiimote connecting or extensions (dis)connecting).
481
482 // NOTE: don't access the public state from the 'remote' object here, as it will
483 // be out-of-date (it's only updated via RefreshState() calls, and these
484 // are reserved for the main application so it can be sure the values
485 // stay consistent between calls). Instead query 'new_state' only.
486
487 // the wiimote just connected
488 if(changed & CONNECTED)
489 {
490 // ask the wiimote to report everything (using the 'non-continous updates'
491 // default mode - updates will be frequent anyway due to the acceleration/IR
492 // values changing):
493
494 // note1: you don't need to set a report type for Balance Boards - the
495 // library does it automatically.
496
497 // note2: for wiimotes, the report mode that includes the extension data
498 // unfortunately only reports the 'BASIC' IR info (ie. no dot sizes),
499 // so let's choose the best mode based on the extension status:
500 if(new_state.ExtensionType != wiimote::BALANCE_BOARD)
501 {
502 if(new_state.bExtension)
503 remote.SetReportType(wiimote::IN_BUTTONS_ACCEL_IR_EXT); // no IR dots
504 else
505 remote.SetReportType(wiimote::IN_BUTTONS_ACCEL_IR); // IR dots
506 }
507 }
508 // a MotionPlus was detected
509 if(changed & MOTIONPLUS_DETECTED)
510 {
511 // enable it if there isn't a normal extension plugged into it
512 // (MotionPlus devices don't report like normal extensions until
513 // enabled - and then, other extensions attached to it will no longer be
514 // reported (so disable the M+ when you want to access them again).
515 if(remote.ExtensionType == wiimote_state::NONE) {
516 bool res = remote.EnableMotionPlus();
517 }
518 }
519 // an extension is connected to the MotionPlus
520 else if(changed & MOTIONPLUS_EXTENSION_CONNECTED)
521 {
522 // We can't read it if the MotionPlus is currently enabled, so disable it:
523 if(remote.MotionPlusEnabled())
524 remote.DisableMotionPlus();
525 }
526 // an extension disconnected from the MotionPlus
527 else if(changed & MOTIONPLUS_EXTENSION_DISCONNECTED)
528 {
529 // enable the MotionPlus data again:
530 if(remote.MotionPlusConnected())
531 remote.EnableMotionPlus();
532 }
533 // another extension was just connected:
534 else if(changed & EXTENSION_CONNECTED)
535 {
536 // switch to a report mode that includes the extension data (we will
537 // loose the IR dot sizes)
538 // note: there is no need to set report types for a Balance Board.
539 if(!remote.IsBalanceBoard())
540 remote.SetReportType(wiimote::IN_BUTTONS_ACCEL_IR_EXT);
541 }
542 // extension was just disconnected:
543 else if(changed & EXTENSION_DISCONNECTED)
544 {
545 // use a non-extension report mode (this gives us back the IR dot sizes)
546 remote.SetReportType(wiimote::IN_BUTTONS_ACCEL_IR);
547 }
548 }
549
550 //--------------------------------------------------------------------------------------------
551
552 void *miscwiiremote_new(t_symbol *s, short ac, t_atom *av)
553 {
554 t_miscwiiremote *x;
555
556 x = (t_miscwiiremote *)object_alloc(miscwiiremote_class);
557
558 x->wiiremote = new wiimote;
559
560 x->wiiremote->ChangedCallback = on_state_change;
561 // notify us only when the wiimote connected sucessfully, or something
562 // related to extensions changes
563 x->wiiremote->CallbackTriggerFlags = (state_change_flags)(CONNECTED |
564 EXTENSION_CHANGED |
565 MOTIONPLUS_CHANGED);
566
567 //x->clock = clock_new(x, (method)miscwiiremote_clock);// FIXME: only after connect? Is this needed at all?
568
569 x->statusOut = outlet_new(x, 0);
570 x->dataOut = outlet_new(x, 0);
571 //x->connected = false;
572
573 return x;
574 }
575
576 void miscwiiremote_free(t_miscwiiremote *x)
577 {
578 delete x->wiiremote;//also disconnects if connected
579
580 //clock_unset(x->clock);
581 //freeobject((t_object *)x->clock);
582 }
583

tadas_AT_dailyda_DOT_com
ViewVC Help
Powered by ViewVC 1.1.8