Functions
tBuffer

Buffer for use in Sampler objects. More...

Functions

void tBuffer_init (tBuffer *const, uint32_t length, LEAF *const leaf)
 Initialize a tBuffer to the default mempool of a LEAF instance. More...
 
void tBuffer_initToPool (tBuffer *const sb, uint32_t length, tMempool *const mp)
 Initialize a tBuffer to a specified mempool. More...
 
void tBuffer_free (tBuffer *const)
 Free a tBuffer from its mempool. More...
 
void tBuffer_tick (tBuffer *const, float sample)
 If recording, add a sample to the buffer. Otherwise do nothing. More...
 
void tBuffer_read (tBuffer *const, float *buff, uint32_t len)
 Read an input buffer into the buffer. More...
 
float tBuffer_get (tBuffer *const, int idx)
 Get the sample recorded at a given position in the buffer. More...
 
void tBuffer_record (tBuffer *const)
 Start recording samples into the buffer. More...
 
void tBuffer_stop (tBuffer *const)
 Stop recordings samples into the buffer. More...
 
int tBuffer_getRecordPosition (tBuffer *const)
 Get the recording position, from where the buffer will next add samples. More...
 
void tBuffer_setRecordPosition (tBuffer *const, int pos)
 Set the recording position, from where the buffer will next add samples. More...
 
void tBuffer_setRecordMode (tBuffer *const, RecordMode mode)
 Set the recording mode. More...
 
void tBuffer_clear (tBuffer *const)
 Clear the buffer. More...
 
uint32_t tBuffer_getBufferLength (tBuffer *const)
 Get the length of the buffer. More...
 
uint32_t tBuffer_getRecordedLength (tBuffer *const sb)
 Get the length of recorded audio in the buffer. More...
 
void tBuffer_setRecordedLength (tBuffer *const sb, int length)
 Set the length of what is considered recorded audio in the buffer. More...
 
int tBuffer_isActive (tBuffer *const sb)
 Check if the buffer is recording. More...
 

Detailed Description

Buffer for use in Sampler objects.

Buffer for use in Sampler objects. Can selectively record audio and keeps track of the length of recorded audio.

Function Documentation

◆ tBuffer_init()

void tBuffer_init ( tBuffer * const  ,
uint32_t  length,
LEAF *const  leaf 
)

Initialize a tBuffer to the default mempool of a LEAF instance.

Parameters
samplerA pointer to the tBuffer to initialize.
lengthThe length of the buffer in samples.
leafA pointer to the leaf instance.

◆ tBuffer_initToPool()

void tBuffer_initToPool ( tBuffer *const  sb,
uint32_t  length,
tMempool *const  mp 
)

Initialize a tBuffer to a specified mempool.

Parameters
samplerA pointer to the tBuffer to initialize.
lengthThe length of the buffer in samples.
mempoolA pointer to the tMempool to use.

◆ tBuffer_free()

void tBuffer_free ( tBuffer * const  )

Free a tBuffer from its mempool.

Parameters
samplerA pointer to the tBuffer to free.

◆ tBuffer_tick()

void tBuffer_tick ( tBuffer * const  ,
float  sample 
)

If recording, add a sample to the buffer. Otherwise do nothing.

Parameters
samplerA pointer to the relevant tBuffer.
inputThe input sample.

◆ tBuffer_read()

void tBuffer_read ( tBuffer * const  ,
float *  buff,
uint32_t  len 
)

Read an input buffer into the buffer.

Parameters
samplerA pointer to the relevant tBuffer.
inputBufferThe input buffer.
lengthThe length of the input buffer.

◆ tBuffer_get()

float tBuffer_get ( tBuffer * const  ,
int  idx 
)

Get the sample recorded at a given position in the buffer.

Parameters
samplerA pointer to the relevant tBuffer.
positionThe position to get a sample from.
Returns
The recorded sample.

◆ tBuffer_record()

void tBuffer_record ( tBuffer * const  )

Start recording samples into the buffer.

Parameters
samplerA pointer to the relevant tBuffer.

◆ tBuffer_stop()

void tBuffer_stop ( tBuffer * const  )

Stop recordings samples into the buffer.

Parameters
samplerA pointer to the relevant tBuffer.

◆ tBuffer_getRecordPosition()

int tBuffer_getRecordPosition ( tBuffer * const  )

Get the recording position, from where the buffer will next add samples.

Parameters
samplerA pointer to the relevant tBuffer.
Returns
The recording position.

◆ tBuffer_setRecordPosition()

void tBuffer_setRecordPosition ( tBuffer * const  ,
int  pos 
)

Set the recording position, from where the buffer will next add samples.

Parameters
samplerA pointer to the relevant tBuffer.
indexThe new recording position.

◆ tBuffer_setRecordMode()

void tBuffer_setRecordMode ( tBuffer * const  ,
RecordMode  mode 
)

Set the recording mode.

Parameters
samplerA pointer to the relevant tBuffer.
modeThe new mode, either RecordOneShot to record one buffer length or RecordLoop to record on loop, overwriting old samples.

◆ tBuffer_clear()

void tBuffer_clear ( tBuffer * const  )

Clear the buffer.

Parameters
samplerA pointer to the relevant tBuffer.

◆ tBuffer_getBufferLength()

uint32_t tBuffer_getBufferLength ( tBuffer * const  )

Get the length of the buffer.

Parameters
samplerA pointer to the relevant tBuffer.
Returns
The length of the buffer.

◆ tBuffer_getRecordedLength()

uint32_t tBuffer_getRecordedLength ( tBuffer *const  sb)

Get the length of recorded audio in the buffer.

Parameters
samplerA pointer to the relevant tBuffer.
Returns
The length in samples of recorded audio.

◆ tBuffer_setRecordedLength()

void tBuffer_setRecordedLength ( tBuffer *const  sb,
int  length 
)

Set the length of what is considered recorded audio in the buffer.

Parameters
samplerA pointer to the relevant tBuffer.
lengthThe new recorded length.

◆ tBuffer_isActive()

int tBuffer_isActive ( tBuffer *const  sb)

Check if the buffer is recording.

Parameters
samplerA pointer to the relevant tBuffer.
Returns
1 if recording, 0 if not.