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.

67 lines
1.6 KiB

  1. //========= Copyright (c) 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $NoKeywords: $
  6. //=============================================================================//
  7. #ifndef IVAUDIO_H
  8. #define IVAUDIO_H
  9. #ifdef _WIN32
  10. #pragma once
  11. #endif
  12. class IAudioStreamEvent
  13. {
  14. public:
  15. // called by the stream to request more data
  16. // seek the source to position "offset"
  17. // -1 indicates previous position
  18. // copy the data to pBuffer and return the number of bytes copied
  19. // you may return less than bytesRequested if the end of the stream
  20. // is encountered.
  21. virtual int StreamRequestData( void *pBuffer, int bytesRequested, int offset ) = 0;
  22. };
  23. class IAudioStream
  24. {
  25. public:
  26. virtual ~IAudioStream() {}
  27. // Decode another bufferSize output bytes from the stream
  28. // returns number of bytes decoded
  29. virtual int Decode( void *pBuffer, unsigned int bufferSize ) = 0;
  30. // output sampling bits (8/16)
  31. virtual int GetOutputBits() = 0;
  32. // output sampling rate in Hz
  33. virtual int GetOutputRate() = 0;
  34. // output channels (1=mono,2=stereo)
  35. virtual int GetOutputChannels() = 0;
  36. // seek
  37. virtual unsigned int GetPosition() = 0;
  38. // NOTE: BUGBUG: Only supports seeking forward currently!
  39. virtual void SetPosition( unsigned int position ) = 0;
  40. // reset?
  41. };
  42. #define VAUDIO_INTERFACE_VERSION "VAudio002"
  43. class IVAudio
  44. {
  45. public:
  46. virtual ~IVAudio() {}
  47. virtual IAudioStream *CreateMP3StreamDecoder( IAudioStreamEvent *pEventHandler ) = 0;
  48. virtual void DestroyMP3StreamDecoder( IAudioStream *pDecoder ) = 0;
  49. virtual void *CreateMilesAudioEngine() = 0;
  50. virtual void DestroyMilesAudioEngine( void *pEngine ) = 0;
  51. };
  52. #endif // IVAUDIO_H