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.

102 lines
2.9 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 int GetScrubPosition( void );
  50. virtual bool SetSamplePosition( int position, bool scrubbing = false );
  51. virtual void SetLoopPosition( int position );
  52. virtual int GetStartPosition( void );
  53. virtual bool GetActive( void );
  54. virtual void SetActive( bool active );
  55. virtual void SetModelIndex( int index );
  56. virtual int GetModelIndex( void ) const;
  57. virtual void SetDirection( bool forward );
  58. virtual bool GetDirection( void ) const;
  59. virtual void SetAutoDelete( bool autodelete );
  60. virtual bool GetAutoDelete( void ) const;
  61. virtual void SetVolume( float volume );
  62. virtual channel_t *GetChannel();
  63. protected:
  64. int m_sample;
  65. int m_absoluteSample;
  66. int m_scrubSample;
  67. int m_startpos;
  68. int m_loop;
  69. int m_fracOffset;
  70. CWaveData *m_pData;
  71. int m_absoluteStartPos;
  72. bool m_bActive;
  73. // Associated playback model in faceposer
  74. int m_nModelIndex;
  75. bool m_bForward;
  76. bool m_bAutoDelete;
  77. channel_t *m_pChannel;
  78. };
  79. #endif // SND_WAVE_MIXER_PRIVATE_H