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.

94 lines
2.7 KiB

  1. //========= Copyright Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. // $Workfile: $
  6. // $Date: $
  7. //
  8. //-----------------------------------------------------------------------------
  9. // $Log: $
  10. //
  11. // $NoKeywords: $
  12. //=============================================================================//
  13. #ifndef SND_WAVE_MIXER_PRIVATE_H
  14. #define SND_WAVE_MIXER_PRIVATE_H
  15. #pragma once
  16. #include "snd_audio_source.h"
  17. #include "snd_wave_mixer.h"
  18. //-----------------------------------------------------------------------------
  19. // Purpose: Linear iterator over source data.
  20. // Keeps track of position in source, and maintains necessary buffers
  21. //-----------------------------------------------------------------------------
  22. class CWaveData
  23. {
  24. public:
  25. virtual ~CWaveData( void ) {}
  26. virtual CAudioSourceWave &Source( void ) = 0;
  27. virtual int ReadSourceData( void **pData, int sampleIndex, int sampleCount, bool forward = true ) = 0;
  28. };
  29. class CAudioMixerWave : public CAudioMixer
  30. {
  31. public:
  32. CAudioMixerWave( CWaveData *data );
  33. virtual ~CAudioMixerWave( void );
  34. virtual bool MixDataToDevice( IAudioDevice *pDevice, channel_t *pChannel, int startSample, int sampleCount, int outputRate, bool forward = true );
  35. virtual void IncrementSamples( channel_t *pChannel, int startSample, int sampleCount,int outputRate, bool forward = true );
  36. virtual bool SkipSamples( channel_t *pChannel, int startSample, int sampleCount,int outputRate, bool forward = true );
  37. virtual void Mix( IAudioDevice *pDevice,
  38. channel_t *pChannel,
  39. void *pData,
  40. int outputOffset,
  41. int inputOffset,
  42. fixedint fracRate,
  43. int outCount,
  44. int timecompress,
  45. bool forward = true ) = 0;
  46. virtual int GetOutputData( void **pData, int samplePosition, int sampleCount, bool forward = true );
  47. virtual CAudioSource *GetSource( void );
  48. virtual int GetSamplePosition( void );
  49. virtual bool SetSamplePosition( int position );
  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. protected:
  61. int m_sample;
  62. int m_absoluteSample;
  63. int m_startpos;
  64. int m_loop;
  65. int m_fracOffset;
  66. CWaveData *m_pData;
  67. int m_absoluteStartPos;
  68. bool m_bActive;
  69. // Associated playback model in faceposer
  70. int m_nModelIndex;
  71. bool m_bForward;
  72. bool m_bAutoDelete;
  73. };
  74. #endif // SND_WAVE_MIXER_PRIVATE_H