Jack2: ringbuffer.h Source File

Jack2 1.9.22

ringbuffer.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2000 Paul Davis
3 Copyright (C) 2003 Rohan Drape
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19*/
20
21#ifndef _RINGBUFFER_H
22#define _RINGBUFFER_H
23
24#ifdef __cplusplus
25extern "C"
26{
27#endif
28
29#include <sys/types.h>
30
44
45typedef struct {
46 char *buf;
47 size_t len;
48}
49jack_ringbuffer_data_t ;
50
51typedef struct {
52 char *buf;
53 size_t write_ptr;
54 size_t read_ptr;
55 size_t size;
56 size_t size_mask;
57 int mlocked;
58}
59jack_ringbuffer_t ;
60
71jack_ringbuffer_t *jack_ringbuffer_create(size_t sz);
72
79 void jack_ringbuffer_free(jack_ringbuffer_t *rb);
80
101 void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb,
102 jack_ringbuffer_data_t *vec);
103
123 void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb,
124 jack_ringbuffer_data_t *vec);
125
136 size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt);
137
153 size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt);
154
166 void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt);
167
175 size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb);
176
184 int jack_ringbuffer_mlock(jack_ringbuffer_t *rb);
185
193 void jack_ringbuffer_reset(jack_ringbuffer_t *rb);
194
203 void jack_ringbuffer_reset_size (jack_ringbuffer_t * rb, size_t sz);
204
214 size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src,
215 size_t cnt);
216
228 void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt);
229
237 size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb);
238
239#ifdef __cplusplus
240}
241#endif
242
243#endif
jack_ringbuffer_write_space
size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb)
jack_ringbuffer_get_write_vector
void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
jack_ringbuffer_reset
void jack_ringbuffer_reset(jack_ringbuffer_t *rb)
jack_ringbuffer_read
size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt)
jack_ringbuffer_read_space
size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb)
jack_ringbuffer_write
size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src, size_t cnt)
jack_ringbuffer_write_advance
void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt)
jack_ringbuffer_get_read_vector
void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
jack_ringbuffer_free
void jack_ringbuffer_free(jack_ringbuffer_t *rb)
jack_ringbuffer_read_advance
void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt)
jack_ringbuffer_reset_size
void jack_ringbuffer_reset_size(jack_ringbuffer_t *rb, size_t sz)
jack_ringbuffer_peek
size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt)
jack_ringbuffer_mlock
int jack_ringbuffer_mlock(jack_ringbuffer_t *rb)