diff options
| author | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
|---|---|---|
| committer | FluorescentCIAAfricanAmerican <[email protected]> | 2020-04-22 12:56:21 -0400 |
| commit | 3bf9df6b2785fa6d951086978a3e66f49427166a (patch) | |
| tree | 2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /utils/scenemanager/sound.h | |
| download | archived-source-engine-2018-hl2-src-master.tar.xz archived-source-engine-2018-hl2-src-master.zip | |
Diffstat (limited to 'utils/scenemanager/sound.h')
| -rw-r--r-- | utils/scenemanager/sound.h | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/utils/scenemanager/sound.h b/utils/scenemanager/sound.h new file mode 100644 index 0000000..0199701 --- /dev/null +++ b/utils/scenemanager/sound.h @@ -0,0 +1,97 @@ +//========= Copyright Valve Corporation, All rights reserved. ============// +// +// Purpose: +// +// $NoKeywords: $ +// +//=============================================================================// +#ifndef SOUND_H +#define SOUND_H +#pragma once + +class CAudioMixer; + +class CAudioInput +{ +public: + // factory to create a suitable audio input for this system + static CAudioInput *Create( void ); + + // base class needs virtual destructor + virtual ~CAudioInput( void ) {} + + // ------------------- interface ------------------------ + + // Returns the current count of available samples + virtual int SampleCount( void ) = 0; + + // returns the size of each sample in bytes + virtual int SampleSize( void ) = 0; + + // returns the sampling rate of the data + virtual int SampleRate( void ) = 0; + + // returns a pointer to the available data + virtual void *SampleData( void ) = 0; + + // release the available data (mark as done) + virtual void SampleRelease( void ) = 0; + + // returns the mono/stereo status of this device (true if stereo) + virtual bool IsStereo( void ) = 0; + + // begin sampling + virtual void Start( void ) = 0; + + // stop sampling + virtual void Stop( void ) = 0; +}; + +class CAudioSource; + +class CAudioOutput +{ +public: + // factory to create a suitable audio output for this system + static CAudioOutput *Create( void ); + + // base class needs virtual destructor + virtual ~CAudioOutput( void ) {} + + // ------------------- interface ------------------------ + + // returns the size of each sample in bytes + virtual int SampleSize( void ) = 0; + + // returns the sampling rate of the data + virtual int SampleRate( void ) = 0; + + // returns the mono/stereo status of this device (true if stereo) + virtual bool IsStereo( void ) = 0; + + // move up to time (time is absolute) + virtual void Update( float dt ) = 0; + + virtual void Flush( void ) = 0; + + // Hook up a filter to the input channel + virtual void AddSource( CAudioMixer *pSource ) = 0; + + virtual void StopSounds( void ) = 0; + + virtual void FreeChannel( int channel ) = 0; + + virtual int FindSourceIndex( CAudioMixer *pSource ) = 0; + + virtual float GetAmountofTimeAhead( void ) = 0; + + virtual int GetNumberofSamplesAhead( void ) = 0; + + virtual CAudioMixer *GetMixerForSource( CAudioSource *pDevice ) = 0; +}; + + +int AudioResample( void *pInput, int inCount, int inSize, bool inStereo, int inRate, + void *pOutput, int outCount, int outSize, bool outStereo, int outRate ); + +#endif // SOUND_H |