aboutsummaryrefslogtreecommitdiff
path: root/Src/libvp6/include/Aud.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'Src/libvp6/include/Aud.hpp')
-rw-r--r--Src/libvp6/include/Aud.hpp79
1 files changed, 79 insertions, 0 deletions
diff --git a/Src/libvp6/include/Aud.hpp b/Src/libvp6/include/Aud.hpp
new file mode 100644
index 00000000..1dd97687
--- /dev/null
+++ b/Src/libvp6/include/Aud.hpp
@@ -0,0 +1,79 @@
+#ifndef AUD_HPP
+#define AUD_HPP
+
+#include <exception>
+#include <string>
+#include <io.h>
+
+namespace Aud
+{
+ class FileError : public exception
+ {
+ public:
+ explicit FileError(const char* message);
+ const char* what() const;
+ private:
+ const std::string message;
+ };
+
+
+ enum { samplesPerSec = 48000 };
+
+ enum { sampleSizeInBits = 16, sampleSizeInBytes = 2 };
+
+ enum { numberOfChannels = 2 };
+
+ enum { blockAlign = numberOfChannels * sampleSizeInBytes };
+
+
+ class File
+ {
+ public:
+
+ enum mode_t { in, out };
+
+ File();
+ File(const char* name, mode_t mode);
+
+ ~File();
+
+ void open(const char* name, mode_t mode);
+ void close();
+
+ bool isOpen() const;
+ bool eof() const;
+
+ mode_t mode() const;
+ const char* name() const;
+
+ int sampleCount() const;
+
+ void seekSample(int sampleNum) const;
+
+ size_t read(void* buffer, size_t size) const;
+
+ void write(const void* buffer, size_t size);
+
+ typedef __int64 offset_t;
+ offset_t offset() const;
+
+ void seekOffset(offset_t) const;
+
+ private:
+
+ File(const File&);
+ File& operator=(const File&);
+
+ void init();
+
+ int handle_;
+
+ char name_[_MAX_PATH];
+ mode_t mode_;
+
+ int m_sampleCount;
+ };
+
+} //end namespace Aud
+
+#endif