summaryrefslogtreecommitdiff
path: root/soundsystem/snd_wave_source.h
diff options
context:
space:
mode:
authorFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
committerFluorescentCIAAfricanAmerican <[email protected]>2020-04-22 12:56:21 -0400
commit3bf9df6b2785fa6d951086978a3e66f49427166a (patch)
tree2c0f1f0c63c4832882bc93814ebd2c2b1c6224e5 /soundsystem/snd_wave_source.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'soundsystem/snd_wave_source.h')
-rw-r--r--soundsystem/snd_wave_source.h76
1 files changed, 76 insertions, 0 deletions
diff --git a/soundsystem/snd_wave_source.h b/soundsystem/snd_wave_source.h
new file mode 100644
index 0000000..a335507
--- /dev/null
+++ b/soundsystem/snd_wave_source.h
@@ -0,0 +1,76 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $Workfile: $
+// $Date: $
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef SND_WAVE_SOURCE_H
+#define SND_WAVE_SOURCE_H
+
+#ifdef _WIN32
+#pragma once
+#endif
+
+#include "soundsystem/snd_audio_source.h"
+#include "sentence.h"
+
+class IterateRIFF;
+
+class CAudioSourceWave : public CAudioSource
+{
+public:
+ CAudioSourceWave( void );
+ ~CAudioSourceWave( void );
+
+ void Setup( const char *pFormat, int formatSize, IterateRIFF &walk );
+
+ virtual int SampleRate( void ) { return m_rate; }
+ inline int SampleSize( void ) { return m_sampleSize; }
+ virtual float TrueSampleSize( void );
+
+ void *GetHeader( void );
+
+ // Legacy
+ virtual void ParseChunk( IterateRIFF &walk, int chunkName );
+
+ virtual void ParseSentence( IterateRIFF &walk );
+
+ void ConvertSamples( char *pData, int sampleCount );
+ bool IsLooped( void ) { return (m_loopStart >= 0) ? true : false; }
+ bool IsStreaming( void ) { return false; }
+ int ConvertLoopedPosition( int samplePosition );
+
+ int SampleCount( void );
+
+ virtual float GetRunningLength( void )
+ {
+ if ( m_rate > 0.0 )
+ {
+ return (float)SampleCount() / m_rate;
+ }
+ return 0.0f; }
+
+ CSentence *GetSentence( void );
+
+protected:
+ // returns the loop start from a cue chunk
+ int ParseCueChunk( IterateRIFF &walk );
+ void Init( const char *pHeaderBuffer, int headerSize );
+
+ int m_bits;
+ int m_rate;
+ int m_channels;
+ int m_format;
+ int m_sampleSize;
+ int m_loopStart;
+ int m_sampleCount;
+
+private:
+ char *m_pHeader;
+ CSentence m_Sentence;
+};
+
+#endif // SND_WAVE_SOURCE_H