CrystalSpace

Public API Reference

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 CrystalSpace
00027 {
00028 
00032 class SoundCyclicBuffer
00033 {
00034 public:
00036   SoundCyclicBuffer(size_t buffer_size);
00037   ~SoundCyclicBuffer();
00038 
00040   size_t GetFreeBytes();
00041   
00047   void AddBytes(void *bytes_ptr, size_t bytes_length);
00048 
00052   size_t GetStartValue();
00057   size_t GetEndValue();
00062   void AdvanceStartValue (size_t advance_amount);
00063 
00067   void Clear (long value=0);
00068 
00072   void GetDataPointersFromPosition (size_t* position_value, size_t max_length, 
00073     uint8 **buffer1, size_t* buffer1_length, uint8 **buffer2, 
00074     size_t* buffer2_length);
00075 
00079   size_t GetLength() { return length; };
00080 
00081 private:
00083   size_t length;
00085 
00089   size_t start_value;
00090   size_t end_value;
00092 
00094 
00098   uint8 *buffer_base;
00099   uint8 *write_ptr;
00101 };
00102 
00103 } // namespace CrystalSpace
00104 
00105 #endif // __CS_SNDSYS_CYCLICBUF_H__

Generated for Crystal Space by doxygen 1.4.6