Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

RageSoundMixBuffer.h

Go to the documentation of this file.
00001 /* RageSoundMixBuffer - Simple audio mixing */ 00002 00003 #ifndef RAGE_SOUND_MIX_BUFFER_H 00004 #define RAGE_SOUND_MIX_BUFFER_H 00005 00006 class RageSoundMixBuffer 00007 { 00008 public: 00009 /* Mix the given buffer of samples. */ 00010 void write( const int16_t *buf, unsigned size ); 00011 00012 /* Extend the buffer as if write() was called with a buffer of silence. */ 00013 void Extend( unsigned iSamples ); 00014 00015 void read( int16_t *pBuf ); 00016 void read( float *pBuf ); 00017 unsigned size() const { return m_iBufUsed; } 00018 void SetVolume( float f ); 00019 void SetWriteOffset( int iOffset ); 00020 00021 RageSoundMixBuffer(); 00022 ~RageSoundMixBuffer(); 00023 00024 private: 00025 int32_t *m_pMixbuf; 00026 unsigned m_iBufSize; /* actual allocated samples */ 00027 unsigned m_iBufUsed; /* used samples */ 00028 int m_iVolumeFactor; /* vol * 256 */ 00029 int m_iOffset; 00030 }; 00031 00032 #endif 00033 00034 /* 00035 * Copyright (c) 2002-2004 Glenn Maynard 00036 * All rights reserved. 00037 * 00038 * Permission is hereby granted, free of charge, to any person obtaining a 00039 * copy of this software and associated documentation files (the 00040 * "Software"), to deal in the Software without restriction, including 00041 * without limitation the rights to use, copy, modify, merge, publish, 00042 * distribute, and/or sell copies of the Software, and to permit persons to 00043 * whom the Software is furnished to do so, provided that the above 00044 * copyright notice(s) and this permission notice appear in all copies of 00045 * the Software and that both the above copyright notice(s) and this 00046 * permission notice appear in supporting documentation. 00047 * 00048 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 00049 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00050 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF 00051 * THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS 00052 * INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT 00053 * OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS 00054 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 00055 * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00056 * PERFORMANCE OF THIS SOFTWARE. 00057 */

Generated on Thu Jan 27 20:57:28 2005 for StepMania by doxygen 1.3.7