home *** CD-ROM | disk | FTP | other *** search
/ Game Audio Programming / GameAudioProgramming.iso / Game_Audio / audio_sdk / src / AudioLib / BufferCache.h < prev    next >
Encoding:
C/C++ Source or Header  |  2002-07-16  |  1.2 KB  |  52 lines

  1. /***********************************************************\
  2. Copyright (C) James Boer, 2002. 
  3. All rights reserved worldwide.
  4.  
  5. This software is provided "as is" without express or implied
  6. warranties. You may freely copy and compile this source into
  7. applications you distribute provided that the copyright text
  8. below is included in the resulting source code, for example:
  9. "Portions Copyright (C) James Boer, 2002"
  10. \***********************************************************/
  11. #ifndef BUFFER_CACHE_H__
  12. #define BUFFER_CACHE_H__
  13.  
  14. #include "Audio.h"
  15. #include "AudioCommon.h"
  16.  
  17. namespace Audio
  18. {
  19.  
  20. struct BufferInfo
  21. {
  22.     IDirectSoundBuffer8*    m_pBuffer;
  23.     DSBUFFERDESC            m_Desc;
  24.     WAVEFORMATEX            m_Format;
  25. };
  26.  
  27. typedef std::vector<BufferInfo*> BufferInfoVector;
  28.  
  29. class BufferCache
  30. {
  31. public:
  32.     BufferCache();
  33.     ~BufferCache();
  34.     void Clear();
  35.  
  36.     void Init();
  37.     void Term();
  38.  
  39.     bool Acquire(const DSBUFFERDESC& desc, IDirectSoundBuffer8*& pBuffer, bool bUseCache = true);
  40.     void Free(IDirectSoundBuffer8* pBuffer);
  41.  
  42. private:
  43.  
  44.     BufferInfoVector    m_Master;
  45.     BufferInfoVector    m_Free;
  46.     BufferInfoVector    m_Used;
  47. };
  48.  
  49.  
  50. }; // namespace Audio
  51.  
  52. #endif // BUFFER_CACHE_H__