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 
00038 
00039 class aflibBufferDev {
00040 
00041 public:
00042 
00043    aflibBufferDev();
00044 
00045    ~aflibBufferDev();
00046 
00047    bool
00048    init(
00049       int buf_size);
00050 
00052    inline
00053    int
00054    getBufferSize() const {return(_buf_size);};
00055 
00057    inline
00058    int
00059    bytes_available()
00060    {
00061       int bytes_avail;
00062 
00063       if (_w_ptr >= _r_ptr)
00064          bytes_avail = _w_ptr - _r_ptr;
00065       else
00066          bytes_avail = _buf_size - (_r_ptr - _w_ptr);
00067 
00068       return(bytes_avail);
00069    };
00070 
00071    void
00072    write(
00073       unsigned char * buf,
00074       int             num_bytes);
00075 
00076    void
00077    read(
00078       unsigned char * buf,
00079       int             num_bytes);
00080 
00081 private:
00082 
00083 unsigned char *  _buf_ptr;
00084 unsigned char *  _end_ptr;
00085 unsigned char *  _w_ptr;
00086 unsigned char *  _r_ptr;
00087 int              _buf_size;
00088 
00089 
00090 };
00091 
00092 
00093 #endif

Generated at Tue Aug 7 22:18:05 2001 for Open Source Audio Library Project by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001