19#define FAUN_VERSION_STR "0.2.5"
20#define FAUN_VERSION 0x000205
59#define FAUN_PROGRAM_MAX 64
66 FAUN_FMT_22050 = 0x10,
80#define FAUN_PAIR(a,b) (((b+1) << 10) | a)
81#define FAUN_TRIO(a,b,c) (((c+1) << 20) | ((b+1) << 10) | a)
82#define FAUN_PID_SOURCE(pid) (pid & 0xff)
103const char*
faun_startup(
int bufferLimit,
int sourceLimit,
104 int streamLimit,
int progLimit,
const char* appName);
112void faun_pan(
int si,
float finalVolL,
float finalVolR,
float period);
113void faun_program(
int ei,
const uint8_t* bytecode,
int len);
115float faun_loadBuffer(
int bi,
const char* file, uint32_t offset, uint32_t size);
125 uint32_t size,
int mode);
127uint32_t
faun_feedStream(
int si,
int (*func)(
float*,
int,
void*),
void* user);
void faun_setParameter(int si, int count, uint8_t param, float value)
Set source or stream parameter.
Definition faun.c:2652
void faun_setErrorStream(FILE *)
Redirect error messages from stderr.
Definition faun.c:2560
uint32_t faun_playSourceVol(int si, int bi, int mode, float volL, float volR)
Begin playback of a buffer from a source and set channel volumes.
Definition faun.c:2981
void faun_waitSignal(FaunSignal *sigbuf)
Block calling thread until a signal is emitted.
Definition faun.c:2603
float faun_loadBufferPcm(int bi, int format, const void *samples, uint32_t frames)
Load PCM audio data from memory into a buffer.
Definition faun.c:2832
FaunParameter
Definition faun.h:84
@ FAUN_VOLUME
This is the volume (or fade in target) used when playback begins.
Definition faun.h:85
@ FAUN_FADE_PERIOD
Duration in seconds for fading in & out.
Definition faun.h:87
@ FAUN_END_TIME
Used to end playback of a source or stream before the buffer or stream file ends.
Definition faun.h:88
@ FAUN_VOLUME_APPLY
This sets the volume parameter like FAUN_VOLUME and also immediately changes the current volume.
Definition faun.h:86
uint32_t faun_playSource(int si, int bi, int mode)
Begin playback of a buffer from a source.
Definition faun.c:2946
int faun_isPlaying(uint32_t pid)
Check if a source or stream is still playing.
Definition faun.c:3138
uint32_t faun_playStream(int si, const char *file, uint32_t offset, uint32_t size, int mode)
Open a file and optionally begin streaming.
Definition faun.c:3023
uint32_t faun_feedStream(int si, int(*func)(float *, int, void *), void *user)
Begin streaming user generated samples via a callback function.
Definition faun.c:3102
float faun_loadBufferF(int bi, FILE *file, uint32_t size)
Load audio data from FILE into a PCM buffer.
Definition faun.c:2800
void faun_shutdown()
Called once when the program exits.
Definition faun.c:2510
float faun_loadBuffer(int bi, const char *file, uint32_t offset, uint32_t size)
Load a file into a PCM buffer.
Definition faun.c:2761
void faun_control(int si, int count, int command)
Send a single command to sources or streams.
Definition faun.c:2620
FaunCommand
Definition faun.h:22
@ FC_STOP
Halt playback and deactivate source.
Definition faun.h:24
@ FC_FADE_OUT
Fade volume to zero from the current play position over the FAUN_FADE_PERIOD.
Definition faun.h:27
@ FC_START
Start playing from the beginning of the source buffer or stream.
Definition faun.h:23
@ FC_RESUME
Continue playback from the point when FC_PAUSE was last used.
Definition faun.h:26
@ FC_PAUSE
Halt playback but keep source active to resume later.
Definition faun.h:25
void faun_pan(int si, float finalVolL, float finalVolR, float period)
Change volume of stereo channels over a period of time.
Definition faun.c:2674
void faun_freeBuffers(int bi, int count)
Free the memory used by a contiguous group of buffers.
Definition faun.c:2896
int faun_pollSignals(FaunSignal *sigbuf, int count)
Check for signals from sources and streams.
Definition faun.c:2574
FaunPlayMode
Definition faun.h:70
@ FAUN_PLAY_LOOP
Used to initiate playback of a source or stream and repeat it forever.
Definition faun.h:72
@ FAUN_SIGNAL_DONE
Used to generate a FaunSignal when the source or stream is finished playing.
Definition faun.h:75
@ FAUN_SIGNAL_PROG
The FaunSignal::signal identifier of a signal generated by the FO_SIGNAL program opcode.
Definition faun.h:76
@ FAUN_PLAY_FADE
Used to set both FAUN_PLAY_FADE_IN & FAUN_PLAY_FADE_OUT.
Definition faun.h:77
@ FAUN_PLAY_ONCE
Used to initiate playback of a source or stream a single time.
Definition faun.h:71
@ FAUN_PLAY_FADE_OUT
Decreases gain to 0.0 gradually just before the source or stream ends.
Definition faun.h:74
@ FAUN_PLAY_FADE_IN
Increase gain from 0.0 gradually when playing begins.
Definition faun.h:73
const char * faun_startup(int bufferLimit, int sourceLimit, int streamLimit, int progLimit, const char *appName)
Called once at program startup.
Definition faun.c:2392
void faun_playStreamPart(int si, double start, double duration, int mode)
Begin playing a segment from a stream.
Definition faun.c:3069
void faun_suspend(int halt)
Pause or resume mixing.
Definition faun.c:2550
int faun_idleSource(int start, int end, int it)
Find a source that is not playing.
Definition faun.c:3160
float faun_loadBufferSfx(int bi, const void *sfxParam)
Load audio data generated from SfxParams into a PCM buffer.
Definition faun.c:2876
void faun_program(int ei, const uint8_t *bytecode, int len)
Execute a Faun program.
Definition faun.c:2704
This struct is used for faun_pollSignals() & faun_waitSignal().
Definition faun.h:92
uint16_t signal
This is the FaunPlayMode event (FAUN_SIGNAL_DONE, FAUN_SIGNAL_PROG) which occurred.
Definition faun.h:94
uint32_t id
This is the playback identifier of the source generating the signal.
Definition faun.h:93