Example code

Hello Cricket

The "hellocricket" example, in src/samples/hellocricket, is a very simple example that plays a single bank sound when it starts.  There are several versions:

Game

The "game" example is a simple demonstration of how to use Cricket Audio with C++ to write cross-platform iOS and Android OpenGL apps.  Most of the code, in src/samples/game, is cross-platform; the platform-specific code and data files are in the android and ios subdirectories.

To build the game for iOS, use the Xcode project in src/samples/game/ios.

To build the game for Android, first build the native code by executing ndk-build in the src/samples/game/android directory; then build and run the app from Eclipse.

Navigate around by moving your finger on the screen; drag left or right to turn, and drag forward or back to move forward or backward.  Try to poke the spinning cubes with the orange pointer.

DspTouch

The "dsptouch" example is a simple app that demonstrates how to use DSP effects and how to share C++ code across platforms.  The code that uses Cricket Audio is a cross-platform C++ file, DspTouch.cpp, which is used by each platform.

Note that unlike the "game" example, this is not an OpenGL (or DirectX) app, so there is no explicit render loop.  Instead, CkUpdate() is called from a timer callback on each platform, on the main thread.

When the app starts, a sound starts looping.  When you touch the screen, the effects are applied.  Moving your finger along the X or Y axes adjusts one of two parameters.  You can edit the code in DspTouch.cpp to change which sample is played, which effect is applied, and which effect parameters are modified.

To build for iOS, use the Xcode project in src/samples/dsptouch/ios.
To build for Android, first build the native code by executing ndk-build in the src/samples/dsptouch/android directory; then build and run the app from Eclipse.
To build for Windows Phone 8, use the solution file in src/samples/dsptouch/wp8.