Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

aflibBufferDev.h

Go to the documentation of this file.
00001 /*
00002  * Copyright: (C) 2000-2001 Bruce W. Forsberg
00003  *
00004  *   This library is free software; you can redistribute it and/or
00005  *   modify it under the terms of the GNU Lesser General Public
00006  *   License as published by the Free Software Foundation; either
00007  *   version 2.1 of the License, or any later version.
00008  *
00009  *   This library is distributed in the hope that it will be useful,
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  *   Lesser General Public License for more details.
00013  *
00014  *   You should have received a copy of the GNU Lesser General Public
00015  *   License along with this library; if not, write to the Free Software
00016  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00017  *
00018  *   Bruce Forsberg  forsberg@tns.net
00019  *
00020  */
00021 
00034 #ifndef _AFLIBBUFFERDEV_H
00035 #define _AFLIBBUFFERDEV_H
00036 
00037 #ifdef HAVE_CONFIG_H
00038 #include <config.h>
00039 #endif
00040 
00041 
00042 class aflibBufferDev {
00043 
00044 public:
00045 
00046    aflibBufferDev();
00047 
00048    ~aflibBufferDev();
00049 
00050    bool
00051    init(
00052       int buf_size);
00053 
00055    inline
00056    int
00057    getBufferSize() const {return(_buf_size);};
00058 
00060    inline
00061    int
00062    bytes_available()
00063    {
00064       int bytes_avail;
00065 
00066       if (_w_ptr >= _r_ptr)
00067          bytes_avail = _w_ptr - _r_ptr;
00068       else
00069          bytes_avail = _buf_size - (_r_ptr - _w_ptr);
00070 
00071       return(bytes_avail);
00072    };
00073 
00074    void
00075    write(
00076       unsigned char * buf,
00077       int             num_bytes);
00078 
00079    void
00080    read(
00081       unsigned char * buf,
00082       int             num_bytes);
00083 
00084 private:
00085 
00086 unsigned char *  _buf_ptr;
00087 unsigned char *  _end_ptr;
00088 unsigned char *  _w_ptr;
00089 unsigned char *  _r_ptr;
00090 int              _buf_size;
00091 
00092 
00093 };
00094 
00095 
00096 #endif

Generated on Wed May 8 20:51:05 2002 for Open Source Audio Library Project by doxygen1.2.15