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.5 2004/01/15 06:35:49 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 00151 void jack_ringbuffer_read_advance(jack_ringbuffer_t *rb, size_t cnt); 00152 00160 size_t jack_ringbuffer_read_space(const jack_ringbuffer_t *rb); 00161 00169 int jack_ringbuffer_mlock(jack_ringbuffer_t *rb); 00170 00178 void jack_ringbuffer_reset(jack_ringbuffer_t *rb); 00179 00189 size_t jack_ringbuffer_write(jack_ringbuffer_t *rb, const char *src, 00190 size_t cnt); 00191 00203 void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt); 00204 00212 size_t jack_ringbuffer_write_space(const jack_ringbuffer_t *rb); 00213 00214 00215 #ifdef __cplusplus 00216 } 00217 #endif 00218 00219 #endif

Generated on Thu Sep 2 16:56:28 2004 for JACK-AUDIO-CONNECTION-KIT by doxygen 1.3.7