]> git.tdb.fi Git - libs/al.git/blob - source/source.h
Bump version for release
[libs/al.git] / source / source.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_SOURCE_H_
9 #define MSP_AL_SOURCE_H_
10
11 #include <vector>
12 #include <AL/al.h>
13 #include "types.h"
14
15 namespace Msp {
16 namespace AL {
17
18 class Buffer;
19
20 enum SourceState
21 {
22         INITIAL = AL_INITIAL,
23         PLAYING = AL_PLAYING,
24         PAUSED  = AL_PAUSED,
25         STOPPED = AL_STOPPED
26 };
27
28 /**
29 Represents an audio source in the 3D environment.
30 */
31 class Source
32 {
33 private:
34         uint id;
35
36 public:
37         Source();
38         ~Source();
39
40         void attribute(ALenum, int);
41         void attribute(ALenum, float);
42         void attribute(ALenum, float, float, float);
43         void attribute(ALenum, const float *);
44         void get_attribute(ALenum, int *) const;
45         void get_attribute(ALenum, float *) const;
46
47         SourceState get_state() const;
48         void set_position(float, float, float);
49         void set_gain(float);
50
51         void set_rolloff_factor(float);
52         void set_buffer(const Buffer &);
53         void queue_buffers(const std::vector<const Buffer *> &);
54         void queue_buffer(const Buffer &);
55         void unqueue_buffers(const std::vector<const Buffer *> &);
56         void unqueue_buffer(const Buffer &);
57         void clear_buffers();
58         unsigned get_buffers_queued() const;
59         unsigned get_buffers_processed() const;
60
61         void set_looping(bool);
62         void play();
63         void pause();
64         void stop();
65         void rewind();
66 };
67
68 } // namespace AL
69 } // namespace Msp
70
71 #endif