]> git.tdb.fi Git - libs/al.git/blobdiff - source/sound.h
Drop copyright notices and Id tags from source files
[libs/al.git] / source / sound.h
index e903bcb395acf185df355f444793557a4c590b2f..bbc64e2d3978685dbc3720b947abf808ec9c2cc4 100644 (file)
@@ -1,19 +1,17 @@
-/* $Id$
-
-This file is part of libmspal
-Copyright © 2008 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_AL_SOUND_H_
 #define MSP_AL_SOUND_H_
 
+#include <string>
 #include <vorbis/vorbisfile.h>
 #include "format.h"
 
 namespace Msp {
 namespace AL {
 
+/**
+This class facilitates loading sound files.  Currently only Ogg Vorbis is
+supported.
+*/
 class Sound
 {
 private:
@@ -22,19 +20,29 @@ private:
        unsigned size;
        char *data;
        Format format;
+       unsigned read_pos;
+       bool eof_flag;
 
 public:
        Sound();
        ~Sound();
 
-       void open(const std::string &);
+       void open_file(const std::string &);
+       void open_memory(const void *, unsigned);
        void load_data();
-       void load(const std::string &);
+       void load_file(const std::string &);
+       void load_memory(const void *, unsigned);
+       void close();
+       void rewind();
+       unsigned read(char *, unsigned);
+       bool eof() const { return eof_flag; }
+
        Format get_format() const { return format; }
        unsigned get_frequency() const { return freq; }
        unsigned get_size() const { return size; }
        const char *get_data() const;
-       unsigned read(char *, unsigned);
+private:
+       void open_common();
 };
 
 } // namespace AL