/[soapbox]/misc.wiiremote/trunk/wiimote_common.h
ViewVC logotype

Contents of /misc.wiiremote/trunk/wiimote_common.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3118 - (show annotations) (download)
Sat May 14 12:26:33 2011 UTC (11 years, 1 month ago) by tadas
File MIME type: text/plain
File size: 3844 byte(s)
Skeleton of the whole thing
1 // _______________________________________________________________________________
2 //
3 // - WiiYourself! - native C++ Wiimote library v1.15 RC
4 // (c) gl.tter 2007-9 - http://gl.tter.org
5 //
6 // see License.txt for conditions of use. see History.txt for change log.
7 // _______________________________________________________________________________
8 //
9 // wiimote_common.h (tab = 4 spaces)
10
11 // speaker support:
12 enum speaker_freq
13 {
14 // (keep in sync with FreqLookup in wiimote.cpp)
15 FREQ_NONE = 0,
16 // my PC can't keep up with these using bUseHIDwrite, so I haven't
17 // been able to tune them yet
18 FREQ_4200HZ = 1,
19 FREQ_3920HZ = 2,
20 FREQ_3640HZ = 3,
21 FREQ_3360HZ = 4,
22 // these were tuned until the square-wave was glitch-free on my remote -
23 // may not be exactly right
24 FREQ_3130HZ = 5, // +190
25 FREQ_2940HZ = 6, // +180
26 FREQ_2760HZ = 7, // +150
27 FREQ_2610HZ = 8, // +140
28 FREQ_2470HZ = 9,
29 };
30
31 // wiimote_sample - holds the audio sample in the native wiimote format
32 struct wiimote_sample
33 {
34 wiimote_sample() : samples(NULL), length(0), freq(FREQ_NONE) {}
35 BYTE* samples;
36 DWORD length;
37 speaker_freq freq;
38 };
39
40 // flags & masks that indicate which part(s) of the wiimote state have changed
41 enum state_change_flags
42 {
43 // state didn't change at all
44 NO_CHANGE = 0,
45
46 // Wiimote specific:
47 CONNECTED = 1<<0, // wiimote just connected
48 CONNECTION_LOST = 1<<1,
49 BATTERY_CHANGED = 1<<2,
50 BATTERY_DRAINED = 1<<3, // close to empty
51 LEDS_CHANGED = 1<<4, // (probably redudant as wiimmote never
52 BUTTONS_CHANGED = 1<<5, // changes them unless requested)
53 ACCEL_CHANGED = 1<<6,
54 ORIENTATION_CHANGED = 1<<7,
55 IR_CHANGED = 1<<8,
56 // all wiimote flags
57 WIIMOTE_CHANGED = CONNECTION_LOST|BATTERY_CHANGED|BATTERY_DRAINED|
58 LEDS_CHANGED|BUTTONS_CHANGED|ACCEL_CHANGED|
59 ORIENTATION_CHANGED|IR_CHANGED,
60 // - Extensions -:
61 // Nunchuk:
62 NUNCHUK_CONNECTED = 1<<9,
63 NUNCHUK_BUTTONS_CHANGED = 1<<10,
64 NUNCHUK_ACCEL_CHANGED = 1<<11,
65 NUNCHUK_ORIENTATION_CHANGED = 1<<12,
66 NUNCHUK_JOYSTICK_CHANGED = 1<<13,
67 // all flags
68 NUNCHUK_CHANGED = NUNCHUK_CONNECTED|NUNCHUK_BUTTONS_CHANGED|
69 NUNCHUK_ACCEL_CHANGED|NUNCHUK_ORIENTATION_CHANGED|
70 NUNCHUK_JOYSTICK_CHANGED,
71 // Classic Controller (inc. Guitars etc):
72 CLASSIC_CONNECTED = 1<<14,
73 CLASSIC_BUTTONS_CHANGED = 1<<15,
74 CLASSIC_JOYSTICK_L_CHANGED = 1<<16,
75 CLASSIC_JOYSTICK_R_CHANGED = 1<<17,
76 CLASSIC_TRIGGERS_CHANGED = 1<<18,
77 // all flags
78 CLASSIC_CHANGED = CLASSIC_CONNECTED|CLASSIC_BUTTONS_CHANGED|
79 CLASSIC_JOYSTICK_L_CHANGED|
80 CLASSIC_JOYSTICK_R_CHANGED|
81 CLASSIC_TRIGGERS_CHANGED,
82 // Balance Board:
83 BALANCE_CONNECTED = 1<<19,
84 BALANCE_WEIGHT_CHANGED = 1<<20,
85 // all flags
86 BALANCE_CHANGED = BALANCE_CONNECTED|BALANCE_WEIGHT_CHANGED,
87
88 // Motion Plus
89 MOTIONPLUS_DETECTED = 1<<21, // attached but not enabled
90 MOTIONPLUS_ENABLED = 1<<22,
91 MOTIONPLUS_SPEED_CHANGED = 1<<23,
92 MOTIONPLUS_EXTENSION_CONNECTED = 1<<24, // an extension is found in the
93 // MotionPlus port
94 MOTIONPLUS_EXTENSION_DISCONNECTED = 1<<25, // it was disconnected
95 // all flags
96 MOTIONPLUS_CHANGED = MOTIONPLUS_DETECTED|MOTIONPLUS_ENABLED|
97 MOTIONPLUS_SPEED_CHANGED|
98 MOTIONPLUS_EXTENSION_CONNECTED|
99 MOTIONPLUS_EXTENSION_DISCONNECTED,
100 // General:
101 EXTENSION_DISCONNECTED = 1<<26,
102 EXTENSION_PARTIALLY_INSERTED = 1<<27,
103 EXTENSION_CONNECTED = NUNCHUK_CONNECTED|CLASSIC_CONNECTED|
104 BALANCE_CONNECTED|MOTIONPLUS_ENABLED,
105 EXTENSION_CHANGED = EXTENSION_DISCONNECTED|NUNCHUK_CHANGED|
106 CLASSIC_CHANGED|BALANCE_CHANGED|MOTIONPLUS_CHANGED,
107 // ALL flags:
108 CHANGED_ALL = WIIMOTE_CHANGED|EXTENSION_CHANGED,
109 };

tadas_AT_dailyda_DOT_com
ViewVC Help
Powered by ViewVC 1.1.8