]> git.tdb.fi Git - libs/al.git/blob - source/sound.h
Add Streamer class
[libs/al.git] / source / sound.h
1 /* $Id$
2
3 This file is part of libmspal
4 Copyright © 2008 Mikko Rasa, Mikkosoft Productions
5 Distributed under the LGPL
6 */
7
8 #ifndef MSP_AL_SOUND_H_
9 #define MSP_AL_SOUND_H_
10
11 #include <string>
12 #include <vorbis/vorbisfile.h>
13 #include "format.h"
14
15 namespace Msp {
16 namespace AL {
17
18 class Sound
19 {
20 private:
21         OggVorbis_File ovfile;
22         unsigned freq;
23         unsigned size;
24         char *data;
25         Format format;
26         unsigned read_pos;
27         bool eof_flag;
28
29 public:
30         Sound();
31         Sound(const std::string &);
32         ~Sound();
33
34         void open(const std::string &);
35         void load_data();
36         void load(const std::string &);
37         void close();
38         void rewind();
39         unsigned read(char *, unsigned);
40         bool eof() const { return eof_flag; }
41
42         Format get_format() const { return format; }
43         unsigned get_frequency() const { return freq; }
44         unsigned get_size() const { return size; }
45         const char *get_data() const;
46 };
47
48 } // namespace AL
49 } // namespace Msp
50
51 #endif