JackUtils 0.5
Provides simplified Jack API for clients :)
Loading...
Searching...
No Matches
Data Structures | Macros | Typedefs | Functions
ju_buffer.h File Reference

Functions for fixed-size threadsafe FIFO buffer. More...

#include <ju_defs.h>
#include <threads.h>

Go to the source code of this file.

Data Structures

struct  ju_buff_s
 FIFO Buffer internal structure. More...
 

Typedefs

typedef struct ju_buff_s ju_buff_t
 typedef wrapper around buffer structure
 

Functions

JBU_API void() ju_buff_init (ju_buff_t *b, size_t s)
 Initializes buffer structure. More...
 
JBU_API void() ju_buff_uninit (ju_buff_t *b)
 Deinitializes buffer structure. More...
 
JBU_API void() ju_buff_resize (ju_buff_t *b, size_t s)
 Resizes buffer structure. More...
 
JBU_API void() ju_buff_check_size (ju_buff_t *b, size_t s)
 Check size of buffer with requested, and resizes if there is not enough spce. More...
 
JBU_API void ju_buff_except (ju_buff_t *b, int(*cb)(ju_buff_t *, ju_ssize_t))
 Underflow/owerflow exception handling. More...
 
JBU_API size_t() ju_buff_size (ju_buff_t *b)
 Returns buffer summary size (used and unused). More...
 
JBU_API size_t() ju_buff_used (ju_buff_t *b)
 Returns size of buffer busy part. More...
 
JBU_API size_t() ju_buff_space (ju_buff_t *b)
 Returns size of buffer empity part. More...
 
JBU_API size_t() ju_buff_append (ju_buff_t *b, const void *src, size_t size)
 Adds data from array to te end of the buffer. More...
 
JBU_API size_t() ju_buff_fill (ju_buff_t *b, const void *src, size_t size, size_t n)
 Adds data from src array copied N times to the end of the buffer. More...
 
JBU_API size_t() ju_buff_remove (ju_buff_t *, void *dst, size_t size)
 Removes data from start of buffer to the dst array. More...
 
JBU_API void() ju_buff_move (ju_buff_t *, ju_ssize_t v)
 Moves buffer data forwards or backwards... More...
 
JBU_API size_t() ju_buff_read (ju_buff_t *, int fd, size_t)
 Similar to ju_buff_append(), but reads values from the file by descriptor.
 
JBU_API size_t() ju_buff_write (ju_buff_t *, int fd, size_t)
 Similar to ju_buff_remove(), but writes values to the the file by descriptor.
 
JBU_API void *() ju_buff_data (ju_buff_t *b)
 Returns buffer data from the beginning. More...
 
JBU_API void() ju_buff_lock (ju_buff_t *b)
 Locks buffer. More...
 
JBU_API void() ju_buff_unlock (ju_buff_t *b)
 Unlocks buffer. More...
 

Detailed Description

Functions for fixed-size threadsafe FIFO buffer.

This buffer uses char as data type! So use not sample buffers length, but sample buffers sizes.

Sample buffer size == Sample buffer Length * sizeof(ju_sample_t)