]> git.tdb.fi Git - libs/al.git/blob - source/listener.cpp
Make sound format support optional
[libs/al.git] / source / listener.cpp
1 #include "listener.h"
2
3 namespace Msp {
4 namespace AL {
5
6 Listener::Listener()
7 {
8         orientation[0] = 0;
9         orientation[1] = 0;
10         orientation[2] = -1;
11         orientation[3] = 0;
12         orientation[4] = 1;
13         orientation[5] = 0;
14 }
15
16 Listener &Listener::instance()
17 {
18         static Listener listener;
19         return listener;
20 }
21
22 void Listener::set_position(float x, float y, float z)
23 {
24         alListener3f(AL_POSITION, x, y, z);
25 }
26
27 void Listener::set_forward_direction(float x, float y, float z)
28 {
29         orientation[0] = x;
30         orientation[1] = y;
31         orientation[2] = z;
32         alListenerfv(AL_ORIENTATION, orientation);
33 }
34
35 void Listener::set_up_direction(float x, float y, float z)
36 {
37         orientation[3] = x;
38         orientation[4] = y;
39         orientation[5] = z;
40         alListenerfv(AL_ORIENTATION, orientation);
41 }
42
43 void Listener::set_velocity(float x, float y, float z)
44 {
45         alListener3f(AL_VELOCITY, x, y, z);
46 }
47
48 void Listener::set_gain(float g)
49 {
50         alListenerf(AL_GAIN, g);
51 }
52
53 } // namespace AL
54 } // namespace Msp