AkiDemoのソースを公開しました。 http://akihiko.shirai.as/modules/mydownloads/viewcat.php?cid=6

WiiYourself!で使える小さなサンプルコードです。 書籍「WiiRemoteプログラミング」で紹介したコードがもとになっています。

-HelloWiiRemote 32行のC/C++言語で書かれた「Hello World」スタイルのシンプルなサンプルです。Bボタンを押すとバイブレーターが鳴ります。

-Thermin-Btn ボタンでMIDIをならすテルミン的な電子楽器です。

-Theremin-Acc 加速度センサーによるMIDI演奏です。カッコよく演奏してください。

-Speaker スピーカーを鳴らすデモです。特殊な形式のWAVファイルが必要です(書籍では詳しく解説しています)。

-Measurement WiiRemotenoパフォーマンス(処理能力・動作周波数)を測るデモです。

★WiiMotionPlusが使える「WiiYourself!v1.13beta」で動作確認しています。

おまけ。

本当に32行で書いているHello, WiiRemoteのコードを引用しておきます。

// [Hello, WiiRemote!] // A simple sample by Akihiko SHIRAI (http://akihiko.shirai.as/projects/WiiRemote/ )

#include “../wiimote.h” int _tmain(int argc, _TCHAR* argv[]) { wiimote cWiiRemote; _tprintf(_T(“Hello, WiiRemote! by Akihiko SHIRAI\n”)); _tprintf(_T(“ contains WiiYourself! wiimote code by gl.tter\nhttp://gl.tter.org\n”)); //Connecting to WiiRemote (WiiRemoteと接続) while(!cWiiRemote.Connect(wiimote::FIRST_AVAILABLE)) { _tprintf(_T(“Connecting to a WiiRemote.\n”)); Sleep(1000); } _tprintf(_T(“connected.\n Press [B] to Rumble…\n”)); cWiiRemote.SetLEDs(0x0f); //Turn on all LEDs (LEDを全点灯) Sleep(1000); cWiiRemote.SetReportType(wiimote::IN_BUTTONS); //Home to Quit (Homeボタンで終了) while(!cWiiRemote.Button.Home()) { while(cWiiRemote.RefreshState() == NO_CHANGE) { Sleep(1); } //Rumle when [B] is pressed (Bボタンでバイブレーターが振動) cWiiRemote.SetRumble(cWiiRemote.Button.B()); } //Disconnect and Exit (切断・終了) cWiiRemote.Disconnect(); _tprintf(_T(“Disconnected.\n”)); return 0; }

あ、コメント抜いたら30行切るね…。