]> git.tdb.fi Git - libs/al.git/blob - source/sound.h
Two more atribute setting functions in Source
[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();
32
33         void open_file(const std::string &);
34         void open_memory(const void *, unsigned);
35         void load_data();
36         void load_file(const std::string &);
37         void load_memory(const void *, unsigned);
38         void close();
39         void rewind();
40         unsigned read(char *, unsigned);
41         bool eof() const { return eof_flag; }
42
43         Format get_format() const { return format; }
44         unsigned get_frequency() const { return freq; }
45         unsigned get_size() const { return size; }
46         const char *get_data() const;
47 private:
48         void open_common();
49 };
50
51 } // namespace AL
52 } // namespace Msp
53
54 #endif