JACK-AUDIO-CONNECTION-KIT
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 }
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 }
61 
73 
81 
104 
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 
177 
186 
195 
205 size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src,
206  size_t cnt);
207 
220 
229 
230 
231 #ifdef __cplusplus
232 }
233 #endif
234 
235 #endif
size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb)
void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt)
jack_ringbuffer_t * jack_ringbuffer_create(size_t sz)
size_t size_mask
Definition: ringbuffer.h:57
size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb)
void jack_ringbuffer_free(jack_ringbuffer_t *rb)
void jack_ringbuffer_reset(jack_ringbuffer_t *rb)
volatile size_t write_ptr
Definition: ringbuffer.h:54
int mlocked
Definition: ringbuffer.h:58
char * buf
Definition: ringbuffer.h:53
void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb, jack_ringbuffer_data_t *vec)
size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src, size_t cnt)
int jack_ringbuffer_mlock(jack_ringbuffer_t *rb)
void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt)
size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt)
volatile size_t read_ptr
Definition: ringbuffer.h:55
size_t size
Definition: ringbuffer.h:56
Definition: ringbuffer.h:44
size_t len
Definition: ringbuffer.h:47
char * buf
Definition: ringbuffer.h:46
size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt)
Definition: ringbuffer.h:51