ringbuffer.h

Go to the documentation of this file.
00001 /* 00002 Copyright (C) 2000 Paul Davis 00003 Copyright (C) 2003 Rohan Drape 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU Lesser General Public License as published by 00007 the Free Software Foundation; either version 2.1 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public License 00016 along with this program; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 00019 $Id: ringbuffer.h,v 1.6 2004/07/08 17:21:03 joq Exp $ 00020 */ 00021 00022 #ifndef _RINGBUFFER_H 00023 #define _RINGBUFFER_H 00024 00025 #ifdef __cplusplus 00026 extern "C" { 00027 #endif 00028 00029 #include <sys/types.h> 00030 00045 typedef struct 00046 { 00047 char *buf; 00048 size_t len; 00049 } 00050 jack_ringbuffer_data_t ; 00051 00052 typedef struct 00053 { 00054 char *buf; 00055 volatile size_t write_ptr; 00056 volatile size_t read_ptr; 00057 size_t size; 00058 size_t size_mask; 00059 int mlocked; 00060 } 00061 jack_ringbuffer_t ; 00062 00073 jack_ringbuffer_t *jack_ringbuffer_create(size_t sz); 00074 00081 void jack_ringbuffer_free(jack_ringbuffer_t *rb); 00082 00103 void jack_ringbuffer_get_read_vector(const jack_ringbuffer_t *rb, 00104 jack_ringbuffer_data_t *vec); 00105 00125 void jack_ringbuffer_get_write_vector(const jack_ringbuffer_t *rb, 00126 jack_ringbuffer_data_t *vec); 00127 00138 size_t jack_ringbuffer_read(jack_ringbuffer_t *rb, char *dest, size_t cnt); 00139 00155 size_t jack_ringbuffer_peek(jack_ringbuffer_t *rb, char *dest, size_t cnt); 00156 00168 void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt); 00169 00177 size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb); 00178 00186 int jack_ringbuffer_mlock(jack_ringbuffer_t *rb); 00187 00195 void jack_ringbuffer_reset(jack_ringbuffer_t *rb); 00196 00206 size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src, 00207 size_t cnt); 00208 00220 void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt); 00221 00229 size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb); 00230 00231 00232 #ifdef __cplusplus 00233 } 00234 #endif 00235 00236 #endif

Generated on Sun Sep 19 10:22:22 2004 for JACK-AUDIO-CONNECTION-KIT by doxygen 1.3.8