Data Structures
LEAF

The structure of an instance of LEAF. More...

Data Structures

struct  LEAF
 Struct for an instance of LEAF. More...
 
void LEAF_init (LEAF *const leaf, float sampleRate, int blockSize, char *memory, size_t memorySize, float(*random)(void))
 Initialize the LEAF instance. More...
 
void LEAF_setSampleRate (LEAF *const leaf, float sampleRate)
 Set the sample rate of LEAF. More...
 
float LEAF_getSampleRate (LEAF *const leaf)
 Get the sample rate of LEAF. More...
 
void LEAF_defaultErrorCallback (LEAF *const leaf, LEAFErrorType errorType)
 The default callback function for LEAF errors. More...
 
void LEAF_setErrorCallback (LEAF *const leaf, void(*callback)(LEAF *const, LEAFErrorType))
 Set the callback function for LEAF errors. More...
 

Detailed Description

The structure of an instance of LEAF.

Function Documentation

◆ LEAF_init()

void LEAF_init ( LEAF *const  leaf,
float  sampleRate,
int  blockSize,
char *  memory,
size_t  memorySize,
float(*)(void)  random 
)

Initialize the LEAF instance.

Parameters
sampleRateThe audio sample rate.
blockSizeThe audio block size.
memoryA pointer to the memory that will make up the default mempool of a LEAF instance.
memorySizeThe size of the memory that will make up the default mempool of a LEAF instance.
randomA pointer to a random number function. Should return a float >= 0 and < 1.
Examples
basic-oscillators.c.

◆ LEAF_setSampleRate()

void LEAF_setSampleRate ( LEAF *const  leaf,
float  sampleRate 
)

Set the sample rate of LEAF.

Parameters
sampleRateThe new audio sample rate.

◆ LEAF_getSampleRate()

float LEAF_getSampleRate ( LEAF *const  leaf)

Get the sample rate of LEAF.

Returns
The current sample rate as a float.

◆ LEAF_defaultErrorCallback()

void LEAF_defaultErrorCallback ( LEAF *const  leaf,
LEAFErrorType  errorType 
)

The default callback function for LEAF errors.

Parameters
errorTypeThe type of the error that has occurred.

◆ LEAF_setErrorCallback()

void LEAF_setErrorCallback ( LEAF *const  leaf,
void(*)(LEAF *const, LEAFErrorType)  callback 
)

Set the callback function for LEAF errors.

Parameters
callbackA pointer to the callback function.