csplugincommon/sndsys/cyclicbuf.h
Go to the documentation of this file.00001 /* 00002 Copyright (C) 2004 by Andrew Mann 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License as published by the Free Software Foundation; either 00007 version 2 of the License, or (at your option) 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 Library General Public License for more details. 00013 00014 You should have received a copy of the GNU Library General Public 00015 License along with this library; if not, write to the Free 00016 Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00017 */ 00018 00019 #ifndef __CS_SNDSYS_CYCLICBUF_H__ 00020 #define __CS_SNDSYS_CYCLICBUF_H__ 00021 00026 namespace CS 00027 { 00028 namespace SndSys 00029 { 00030 00034 class CS_CRYSTALSPACE_EXPORT SoundCyclicBuffer 00035 { 00036 public: 00038 SoundCyclicBuffer(size_t buffer_size); 00039 ~SoundCyclicBuffer(); 00040 00042 size_t GetFreeBytes(); 00043 00049 void AddBytes(void *bytes_ptr, size_t bytes_length); 00050 00054 size_t GetStartValue(); 00059 size_t GetEndValue(); 00064 void AdvanceStartValue (size_t advance_amount); 00065 00069 void Clear (long value=0); 00070 00074 void GetDataPointersFromPosition (size_t* position_value, size_t max_length, 00075 uint8 **buffer1, size_t* buffer1_length, uint8 **buffer2, 00076 size_t* buffer2_length); 00077 00081 size_t GetLength() { return length; }; 00082 00083 private: 00085 size_t length; 00087 00091 size_t start_value; 00092 size_t end_value; 00094 00096 00100 uint8 *buffer_base; 00101 uint8 *write_ptr; 00103 }; 00104 00105 } // namespace SndSys 00106 } // namespace CS 00107 00108 #endif // __CS_SNDSYS_CYCLICBUF_H__
Generated for Crystal Space by doxygen 1.4.7