Team Fortress 2 Source Code as on 22/4/2020
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.5 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef SND_WAVE_DATA_H
  8. #define SND_WAVE_DATA_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. #include "snd_audio_source.h"
  13. //-----------------------------------------------------------------------------
  14. // Purpose: Linear iterator over source data.
  15. // Keeps track of position in source, and maintains necessary buffers
  16. //-----------------------------------------------------------------------------
  17. abstract_class IWaveData
  18. {
  19. public:
  20. virtual ~IWaveData( void ) {}
  21. virtual CAudioSource &Source( void ) = 0;
  22. virtual int ReadSourceData( void **pData, int sampleIndex, int sampleCount, char copyBuf[AUDIOSOURCE_COPYBUF_SIZE] ) = 0;
  23. virtual bool IsReadyToMix() = 0;
  24. };
  25. abstract_class IWaveStreamSource
  26. {
  27. public:
  28. virtual int UpdateLoopingSamplePosition( int samplePosition ) = 0;
  29. virtual void UpdateSamples( char *pData, int sampleCount ) = 0;
  30. virtual int GetLoopingInfo( int *pLoopBlock, int *pNumLeadingSamples, int *pNumTrailingSamples ) = 0;
  31. };
  32. class IFileReadBinary;
  33. class CSfxTable;
  34. extern IWaveData *CreateWaveDataStream( CAudioSource &source, IWaveStreamSource *pStreamSource, const char *pFileName, int dataStart, int dataSize, CSfxTable *pSfx, int startOffset );
  35. extern IWaveData *CreateWaveDataMemory( CAudioSource &source );
  36. void PrefetchDataStream( const char *pFileName, int dataOffset, int dataSize );
  37. #endif // SND_WAVE_DATA_H