Faun 0.2.5
A high-level C audio library
Loading...
Searching...
No Matches
basic.c

This is a basic example of how to use the API.

#include <stdio.h>
#include "faun.h"
#define SRC_LIMIT 8
#define MUSIC_ID SRC_LIMIT
int main()
{
const char* err;
err = faun_startup(32, SRC_LIMIT, 2, 0, "Faun Example");
if (err) {
printf("%s\n", err);
return 1;
}
// Start some music.
faun_playStream(MUSIC_ID, "data/vintage_education.ogg", 0, 0,
// Load and play a sound.
faun_loadBuffer(0, "data/sa_enchant.rfx", 0, 0);
faun_playSource(0, 0, FAUN_PLAY_ONCE);
// Wait for music to finish.
faun_waitSignal(&sig);
faun_shutdown();
return 0;
}
The Faun programmer interface.
@ FAUN_SIGNAL_DONE
Used to generate a FaunSignal when the source or stream is finished playing.
Definition faun.h:75
@ FAUN_PLAY_ONCE
Used to initiate playback of a source or stream a single time.
Definition faun.h:71
This struct is used for faun_pollSignals() & faun_waitSignal().
Definition faun.h:92