JACK-AUDIO-CONNECTION-KIT 0.125.0

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
25 extern "C" {
26 #endif
27
28 #include <sys/types.h>
29
44 typedef struct
45 {
46 char *buf;
47 size_t len;
48 }
49 jack_ringbuffer_data_t ;
50
51 typedef struct
52 {
53 char *buf;
54 volatile size_t write_ptr;
55 volatile size_t read_ptr;
56 size_t size;
57 size_t size_mask;
58 int mlocked;
59 }
60 jack_ringbuffer_t ;
61
72 jack_ringbuffer_t *jack_ringbuffer_create(size_t sz);
73
80 void jack_ringbuffer_free(jack_ringbuffer_t *rb);
81
102 void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb,
103 jack_ringbuffer_data_t *vec);
104
124 void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb,
125 jack_ringbuffer_data_t *vec);
126
137 size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt);
138
154 size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt);
155
167 void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt);
168
176 size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb);
177
185 int jack_ringbuffer_mlock(jack_ringbuffer_t *rb);
186
194 void jack_ringbuffer_reset(jack_ringbuffer_t *rb);
195
205 size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src,
206 size_t cnt);
207
219 void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt);
220
228 size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb);
229
230
231 #ifdef __cplusplus
232 }
233 #endif
234
235 #endif
jack_ringbuffer_read_space
size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb)
jack_ringbuffer_write_advance
void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt)
jack_ringbuffer_create
jack_ringbuffer_t * jack_ringbuffer_create(size_t sz)
jack_ringbuffer_t::size_mask
size_t size_mask
Definition: ringbuffer.h:57
jack_ringbuffer_write_space
size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb)
jack_ringbuffer_free
void jack_ringbuffer_free(jack_ringbuffer_t *rb)
jack_ringbuffer_reset
void jack_ringbuffer_reset(jack_ringbuffer_t *rb)
jack_ringbuffer_t::write_ptr
volatile size_t write_ptr
Definition: ringbuffer.h:54
jack_ringbuffer_t::mlocked
int mlocked
Definition: ringbuffer.h:58
jack_ringbuffer_t::buf
char * buf
Definition: ringbuffer.h:53
jack_ringbuffer_get_read_vector
void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
jack_ringbuffer_get_write_vector
void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
jack_ringbuffer_write
size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src, size_t cnt)
jack_ringbuffer_mlock
int jack_ringbuffer_mlock(jack_ringbuffer_t *rb)
jack_ringbuffer_read_advance
void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt)
jack_ringbuffer_read
size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt)
jack_ringbuffer_t::read_ptr
volatile size_t read_ptr
Definition: ringbuffer.h:55
jack_ringbuffer_t::size
size_t size
Definition: ringbuffer.h:56
jack_ringbuffer_data_t
Definition: ringbuffer.h:44
jack_ringbuffer_data_t::len
size_t len
Definition: ringbuffer.h:47
jack_ringbuffer_data_t::buf
char * buf
Definition: ringbuffer.h:46
jack_ringbuffer_peek
size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt)
jack_ringbuffer_t
Definition: ringbuffer.h:51