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.4 2003/12/21 02:40:46 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(jack_ringbuffer_t *rb,
00104                                      jack_ringbuffer_data_t *vec);
00105 
00125 void jack_ringbuffer_get_write_vector(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(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, char *src, size_t cnt);
00190 
00202 void jack_ringbuffer_write_advance(jack_ringbuffer_t *rb, size_t cnt);
00203 
00211 size_t jack_ringbuffer_write_space(jack_ringbuffer_t *rb);
00212 
00213 
00214 #ifdef __cplusplus
00215 }
00216 #endif
00217 
00218 #endif

Generated on Sun Feb 29 14:33:03 2004 for JACK-AUDIO-CONNECTION-KIT by doxygen 1.3.6-20040222