Hello World

This is a very simple example of using Cinnamon. Also see sine_test.c in the source repository for a fully working demo application (including proper error handling).

struct Cin_Driver *const driver = malloc(Cin_StructDriverSize());
if(driver == NULL || Cin_CreateDriver(driver) != Cin_eDriverSuccess){
    /* Handle error... */

/* Load a sound into memory. Cinnamon doesn't provide this capability itself.
 * You can load the sound in parts, see below. */
unsigned sound_size;
const void *sound_data = LoadSound(&sound_size);

/* Create an audio Loader. This is used solely to load the sound, and then will
 * be used to create a playable sound. */
struct Cin_Loader *const loader = malloc(Cin_StructLoaderSize());
if(loader == NULL || Cin_CreateLoader(loader, driver, 44100, 2, Cin_eFormatS16) != Cin_eDriverSuccess){
    /* Handle error... */

/* Load the sound. If the sound is loaded in parts (as is the case for manually
 * parsing some formats like Ogg) you can call this function multiple times to
 * append more data to the loader. */
Cin_LoaderPut(loader, sound_data, sound_size);

struct Cin_Sound *const sound = malloc(Cin_StructSoundSize());
if(sound == NULL || Cin_LoaderFinalize(loader, sound) != Cin_eLoaderSuccess){
    /* Handle error... */

/* You can now play your sound. */

/* Obviously Cin_SoundPlay doesn't block, so some other processing can occur
 * here... */

/* Clean up. It is safe to call Cin_SoundStop regardless of if the sound is
 * still playing or not. */