summaryrefslogtreecommitdiff
path: root/public/vaudio/ivaudio.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 /public/vaudio/ivaudio.h
downloadarchived-source-engine-2018-hl2-src-master.tar.xz
archived-source-engine-2018-hl2-src-master.zip
Diffstat (limited to 'public/vaudio/ivaudio.h')
-rw-r--r--public/vaudio/ivaudio.h64
1 files changed, 64 insertions, 0 deletions
diff --git a/public/vaudio/ivaudio.h b/public/vaudio/ivaudio.h
new file mode 100644
index 0000000..8b23e1d
--- /dev/null
+++ b/public/vaudio/ivaudio.h
@@ -0,0 +1,64 @@
+//========= Copyright Valve Corporation, All rights reserved. ============//
+//
+// Purpose:
+//
+// $NoKeywords: $
+//=============================================================================//
+
+#ifndef IVAUDIO_H
+#define IVAUDIO_H
+#ifdef _WIN32
+#pragma once
+#endif
+
+class IAudioStreamEvent
+{
+public:
+ // called by the stream to request more data
+ // seek the source to position "offset"
+ // -1 indicates previous position
+ // copy the data to pBuffer and return the number of bytes copied
+ // you may return less than bytesRequested if the end of the stream
+ // is encountered.
+ virtual int StreamRequestData( void *pBuffer, int bytesRequested, int offset ) = 0;
+};
+
+
+class IAudioStream
+{
+public:
+ virtual ~IAudioStream() {}
+
+ // Decode another bufferSize output bytes from the stream
+ // returns number of bytes decoded
+ virtual int Decode( void *pBuffer, unsigned int bufferSize ) = 0;
+
+ // output sampling bits (8/16)
+ virtual int GetOutputBits() = 0;
+ // output sampling rate in Hz
+ virtual int GetOutputRate() = 0;
+ // output channels (1=mono,2=stereo)
+ virtual int GetOutputChannels() = 0;
+
+ // seek
+ virtual unsigned int GetPosition() = 0;
+
+ // NOTE: BUGBUG: Only supports seeking forward currently!
+ virtual void SetPosition( unsigned int position ) = 0;
+
+ // reset?
+};
+
+
+#define VAUDIO_INTERFACE_VERSION "VAudio002"
+class IVAudio
+{
+public:
+ virtual ~IVAudio() {}
+
+ virtual IAudioStream *CreateMP3StreamDecoder( IAudioStreamEvent *pEventHandler ) = 0;
+ virtual void DestroyMP3StreamDecoder( IAudioStream *pDecoder ) = 0;
+};
+
+
+#endif // IVAUDIO_H