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.

103 lines
2.8 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_MIXER_PRIVATE_H
  10. #define SND_WAVE_MIXER_PRIVATE_H
  11. #ifdef _WIN32
  12. #pragma once
  13. #endif
  14. #include "soundsystem/snd_audio_source.h"
  15. #include "soundsystem/snd_device.h"
  16. #include "snd_wave_mixer.h"
  17. //-----------------------------------------------------------------------------
  18. // Purpose: Linear iterator over source data.
  19. // Keeps track of position in source, and maintains necessary buffers
  20. //-----------------------------------------------------------------------------
  21. class CWaveData
  22. {
  23. public:
  24. virtual ~CWaveData( void ) {}
  25. virtual CAudioSourceWave &Source( void ) = 0;
  26. virtual int ReadSourceData( void **pData, int sampleIndex, int sampleCount, bool forward = true ) = 0;
  27. };
  28. class CAudioMixerWave : public CAudioMixer
  29. {
  30. public:
  31. CAudioMixerWave( CWaveData *data );
  32. virtual ~CAudioMixerWave( void );
  33. virtual bool MixDataToDevice( IAudioDevice *pDevice, channel_t *pChannel, int startSample, int sampleCount, int outputRate, bool forward = true );
  34. virtual void IncrementSamples( channel_t *pChannel, int startSample, int sampleCount,int outputRate, bool forward = true );
  35. virtual bool SkipSamples( IAudioDevice *pDevice, channel_t *pChannel, int startSample, int sampleCount,int outputRate, bool forward = true );
  36. virtual void Mix( IAudioDevice *pDevice,
  37. channel_t *pChannel,
  38. void *pData,
  39. int outputOffset,
  40. int inputOffset,
  41. fixedint fracRate,
  42. int outCount,
  43. int timecompress,
  44. bool forward = true ) = 0;
  45. virtual int GetOutputData( void **pData, int samplePosition, int sampleCount, bool forward = true );
  46. virtual CAudioSource *GetSource( void );
  47. virtual int GetSamplePosition( void );
  48. virtual int GetScubPosition( void );
  49. virtual bool SetSamplePosition( int position, bool scrubbing = false );
  50. virtual void SetLoopPosition( int position );
  51. virtual int GetStartPosition( void );
  52. virtual bool GetActive( void );
  53. virtual void SetActive( bool active );
  54. virtual void SetModelIndex( int index );
  55. virtual int GetModelIndex( void ) const;
  56. virtual void SetDirection( bool forward );
  57. virtual bool GetDirection( void ) const;
  58. virtual void SetAutoDelete( bool autodelete );
  59. virtual bool GetAutoDelete( void ) const;
  60. virtual void SetVolume( float volume );
  61. virtual channel_t *GetChannel();
  62. protected:
  63. int m_sample;
  64. int m_absoluteSample;
  65. int m_scubSample;
  66. int m_startpos;
  67. int m_loop;
  68. int m_fracOffset;
  69. CWaveData *m_pData;
  70. int m_absoluteStartPos;
  71. bool m_bActive;
  72. // Associated playback model in faceposer
  73. int m_nModelIndex;
  74. bool m_bForward;
  75. bool m_bAutoDelete;
  76. channel_t *m_pChannel;
  77. };
  78. #endif // SND_WAVE_MIXER_PRIVATE_H