diff options
author | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-07-20 12:25:22 +0200 |
---|---|---|
committer | Thierry Bultel <thierry.bultel@iot.bzh> | 2018-07-20 12:25:22 +0200 |
commit | 712b3a2cda69422931b26283054e476e3d554a06 (patch) | |
tree | 108906755159da8c87c8d4d3fa0871b134c4c35d /plugins/alsa/alsa-ringbuf.h | |
parent | afc7d62d02c523f3d3adc29f713f5a4395ca3f58 (diff) |
added ringbuffer and time utils
Signed-off-by: Thierry Bultel <thierry.bultel@iot.bzh>
Diffstat (limited to 'plugins/alsa/alsa-ringbuf.h')
-rw-r--r-- | plugins/alsa/alsa-ringbuf.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/plugins/alsa/alsa-ringbuf.h b/plugins/alsa/alsa-ringbuf.h new file mode 100644 index 0000000..5ecc7fe --- /dev/null +++ b/plugins/alsa/alsa-ringbuf.h @@ -0,0 +1,27 @@ +#ifndef __INC_ALSA_RINGBUF_H +#define __INC_ALSA_RINGBUF_H + +#include "ringbuf.h" + +#include <alsa/asoundlib.h> +#include <stdbool.h> + +typedef struct { + ringbuf_t rbuf; + size_t frameSize; +} alsa_ringbuf_t ; + +extern alsa_ringbuf_t * alsa_ringbuf_new(snd_pcm_uframes_t capacity, size_t frameSize); +extern snd_pcm_uframes_t alsa_ringbuf_buffer_size(const alsa_ringbuf_t *rb); +extern void alsa_ringbuf_free(alsa_ringbuf_t *rb); +extern void alsa_ringbuf_reset(alsa_ringbuf_t *rb); +extern snd_pcm_uframes_t alsa_ringbuf_capacity(const alsa_ringbuf_t *rb); +extern snd_pcm_uframes_t alsa_ringbuf_frames_free(const alsa_ringbuf_t *rb); +extern snd_pcm_uframes_t alsa_ringbuf_frames_used(const alsa_ringbuf_t *rb); +extern bool alsa_ringbuf_is_full(const alsa_ringbuf_t *rb); +extern bool alsa_ringbuf_is_empty(const alsa_ringbuf_t *rb); + +extern void alsa_ringbuf_frames_push(alsa_ringbuf_t * rb, const void * buf, snd_pcm_uframes_t nb); +extern void alsa_ringbuf_frames_pop(alsa_ringbuf_t * rb, void * buf, snd_pcm_uframes_t nb); + +#endif /* __INC_ALSA_RINGBUF_H */ |