Counter Strike : Global Offensive Source Code
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.

76 lines
1.7 KiB

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. // $NoKeywords: $
  8. //=============================================================================//
  9. #ifndef SND_WAVE_SOURCE_H
  10. #define SND_WAVE_SOURCE_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "soundsystem/snd_audio_source.h"
  15. #include "sentence.h"
  16. class IterateRIFF;
  17. class CAudioSourceWave : public CAudioSource
  18. {
  19. public:
  20. CAudioSourceWave( void );
  21. ~CAudioSourceWave( void );
  22. void Setup( const char *pFormat, int formatSize, IterateRIFF &walk );
  23. virtual int SampleRate( void ) { return m_rate; }
  24. inline int SampleSize( void ) { return m_sampleSize; }
  25. virtual float TrueSampleSize( void );
  26. void *GetHeader( void );
  27. // Legacy
  28. virtual void ParseChunk( IterateRIFF &walk, int chunkName );
  29. virtual void ParseSentence( IterateRIFF &walk );
  30. void ConvertSamples( char *pData, int sampleCount );
  31. bool IsLooped( void ) { return (m_loopStart >= 0) ? true : false; }
  32. bool IsStreaming( void ) { return false; }
  33. int ConvertLoopedPosition( int samplePosition );
  34. int SampleCount( void );
  35. virtual float GetRunningLength( void )
  36. {
  37. if ( m_rate > 0.0 )
  38. {
  39. return (float)SampleCount() / m_rate;
  40. }
  41. return 0.0f; }
  42. CSentence *GetSentence( void );
  43. protected:
  44. // returns the loop start from a cue chunk
  45. int ParseCueChunk( IterateRIFF &walk );
  46. void Init( const char *pHeaderBuffer, int headerSize );
  47. int m_bits;
  48. int m_rate;
  49. int m_channels;
  50. int m_format;
  51. int m_sampleSize;
  52. int m_loopStart;
  53. int m_sampleCount;
  54. private:
  55. char *m_pHeader;
  56. CSentence m_Sentence;
  57. };
  58. #endif // SND_WAVE_SOURCE_H