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.

75 lines
2.6 KiB

  1. //========= Copyright � 1996-2005, 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. #include "sound_private.h"
  19. #include "snd_wave_source.h"
  20. class IWaveData;
  21. abstract_class CAudioMixerWave : public CAudioMixer
  22. {
  23. public:
  24. CAudioMixerWave( IWaveData *data );
  25. virtual ~CAudioMixerWave( void );
  26. int MixDataToDevice( channel_t *pChannel, int sampleCount, int outputRate, int outputOffset );
  27. int SkipSamples( channel_t *pChannel, int sampleCount, int outputRate, int outputOffset );
  28. bool ShouldContinueMixing( void );
  29. virtual void Mix( channel_t *pChannel, void *pData, int outputOffset, int inputOffset, fixedint fracRate, int outCount, int timecompress ) = 0;
  30. virtual int GetOutputData( void **pData, int sampleCount, char copyBuf[AUDIOSOURCE_COPYBUF_SIZE] );
  31. virtual CAudioSource* GetSource( void );
  32. virtual int GetSamplePosition( void );
  33. virtual float ModifyPitch( float pitch );
  34. virtual float GetVolumeScale( void );
  35. // Move the current position to newPosition
  36. virtual bool IsSetSampleStartSupported() const;
  37. virtual void SetSampleStart( int newPosition );
  38. // End playback at newEndPosition
  39. virtual void SetSampleEnd( int newEndPosition );
  40. virtual void SetStartupDelaySamples( int delaySamples );
  41. // private helper routines
  42. char * LoadMixBuffer( channel_t *pChannel, int sample_load_request, int *psamples_loaded, char copyBuf[AUDIOSOURCE_COPYBUF_SIZE] );
  43. int MixDataToDevice_( channel_t *pChannel, int sampleCount, int outputRate, int outputOffset, bool bSkipAllSamples );
  44. int GetSampleLoadRequest( double rate, int sampleCount, bool bInterpolated_pitch );
  45. virtual bool IsReadyToMix();
  46. virtual int GetPositionForSave() { return GetSamplePosition(); }
  47. virtual void SetPositionFromSaved( int savedPosition ) { SetSampleStart(savedPosition); }
  48. protected:
  49. double m_fsample_index; // index of next sample to output
  50. int64 m_sample_max_loaded; // count of total samples loaded - ie: the index of
  51. // the next sample to be loaded.
  52. int64 m_sample_loaded_index; // index of last sample loaded
  53. IWaveData *m_pData;
  54. double m_forcedEndSample;
  55. bool m_finished;
  56. int m_delaySamples;
  57. };
  58. #endif // SND_WAVE_MIXER_PRIVATE_H