OALplus (0.52.0) a C++ wrapper for OpenAL

listener.hpp
Go to the documentation of this file.
1 
12 #pragma once
13 #ifndef OALPLUS_LISTENER_1303201647_HPP
14 #define OALPLUS_LISTENER_1303201647_HPP
15 
16 #include <oalplus/config.hpp>
17 #include <oalplus/fwd.hpp>
18 #include <oalplus/alfunc.hpp>
19 #include <oalplus/math/vector.hpp>
20 #include <oalplus/error/basic.hpp>
21 
22 namespace oalplus {
23 
25 class Listener
26 {
27 public:
29 
38  static void Position(const Vec3f& position)
39  {
40  OALPLUS_ALFUNC(Listenerfv)(
41  AL_POSITION,
42  position.Data()
43  );
44  OALPLUS_VERIFY_SIMPLE(Listenerfv);
45  }
46 
48 
57  static void Position(ALfloat x, ALfloat y, ALfloat z)
58 
59  {
60  OALPLUS_ALFUNC(Listener3f)(
61  AL_POSITION,
62  x, y, z
63  );
64  OALPLUS_VERIFY_SIMPLE(Listener3f);
65  }
66 
68 
76  static Vec3f Position(void)
77  {
78  ALfloat result[3];
79  OALPLUS_ALFUNC(GetListenerfv)(
80  AL_POSITION,
81  result
82  );
83  OALPLUS_VERIFY_SIMPLE(GetListenerfv);
84  return Vec3f(result);
85  }
86 
88 
97  static void Velocity(const Vec3f& velocity)
98  {
99  OALPLUS_ALFUNC(Listenerfv)(
100  AL_VELOCITY,
101  velocity.Data()
102  );
103  OALPLUS_VERIFY_SIMPLE(Listenerfv);
104  }
105 
107 
116  static void Velocity(ALfloat x, ALfloat y, ALfloat z)
117  {
118  OALPLUS_ALFUNC(Listener3f)(
119  AL_VELOCITY,
120  x, y, z
121  );
122  OALPLUS_VERIFY_SIMPLE(Listener3f);
123  }
124 
126 
134  static Vec3f Velocity(void)
135  {
136  ALfloat result[3];
137  OALPLUS_ALFUNC(GetListenerfv)(
138  AL_VELOCITY,
139  result
140  );
141  OALPLUS_VERIFY_SIMPLE(GetListenerfv);
142  return Vec3f(result);
143  }
144 
146 
155  static void Orientation(const Vec3f& at, const Vec3f& up)
156  {
157  ALfloat v[6] = {
158  at[0], at[1], at[2],
159  up[0], up[1], up[2],
160  };
161  OALPLUS_ALFUNC(Listenerfv)(AL_ORIENTATION, v);
162  OALPLUS_VERIFY_SIMPLE(Listenerfv);
163  }
164 
166 
177  static void Orientation(
178  ALfloat at_x,
179  ALfloat at_y,
180  ALfloat at_z,
181  ALfloat up_x,
182  ALfloat up_y,
183  ALfloat up_z
184  )
185  {
186  ALfloat v[6] = {at_x, at_y, at_z, up_x, up_y, up_z};
187  OALPLUS_ALFUNC(Listenerfv)(AL_ORIENTATION, v);
188  OALPLUS_VERIFY_SIMPLE(Listenerfv);
189  }
190 
192 
202  static Vec3f OrientationAt(void)
203  {
204  ALfloat v[6];
205  OALPLUS_ALFUNC(GetListenerfv)(AL_ORIENTATION, v);
206  OALPLUS_VERIFY_SIMPLE(GetListenerfv);
207  return Vec3f(v, 3);
208  }
209 
211 
220  static Vec3f OrientationUp(void)
221  {
222  ALfloat v[6];
223  OALPLUS_ALFUNC(GetListenerfv)(AL_ORIENTATION, v);
224  OALPLUS_VERIFY_SIMPLE(GetListenerfv);
225  return Vec3f(v+3, 3);
226  }
227 
229 
235  static void Gain(ALfloat value)
236  {
237  OALPLUS_ALFUNC(Listenerf)(
238  AL_GAIN,
239  value
240  );
241  OALPLUS_VERIFY_SIMPLE(Listenerf);
242  }
243 
245 
251  static ALfloat Gain(void)
252  {
253  ALfloat result;
254  OALPLUS_ALFUNC(GetListenerfv)(
255  AL_GAIN,
256  &result
257  );
258  OALPLUS_VERIFY_SIMPLE(GetListenerfv);
259  return result;
260  }
261 };
262 
263 } // namespace oalplus
264 
265 #endif // include guard
static void Velocity(const Vec3f &velocity)
Specifies the velocity vector of the listener.
Definition: listener.hpp:97
static ALfloat Gain(void)
Returns the current value of gain of the listener.
Definition: listener.hpp:251
static void Gain(ALfloat value)
Specifies the value of gain of the listener.
Definition: listener.hpp:235
Vector< GLfloat, 3 > Vec3f
Forward declarations.
static Vec3f OrientationUp(void)
Returns the orientation up vector of the listener.
Definition: listener.hpp:220
static void Velocity(ALfloat x, ALfloat y, ALfloat z)
Specifies the velocity vector of the listener.
Definition: listener.hpp:116
static void Orientation(const Vec3f &at, const Vec3f &up)
Specifies the orientation vector of the listener.
Definition: listener.hpp:155
static void Position(const Vec3f &position)
Specifies the position of the listener.
Definition: listener.hpp:38
Compile-time configuration options.
Helper macro expanding into OpenAL function name.
static Vec3f Position(void)
Returns the positin of the listener.
Definition: listener.hpp:76
static Vec3f OrientationAt(void)
Returns the orientation vector of the listener.
Definition: listener.hpp:202
An AL context-specific monostate object representing the listener.
Definition: listener.hpp:25
static void Position(ALfloat x, ALfloat y, ALfloat z)
Specifies the position of the listener.
Definition: listener.hpp:57
static void Orientation(ALfloat at_x, ALfloat at_y, ALfloat at_z, ALfloat up_x, ALfloat up_y, ALfloat up_z)
Specifies the orientation vector of the listener.
Definition: listener.hpp:177
static Vec3f Velocity(void)
Returns the velocity vector of the listener.
Definition: listener.hpp:134

Copyright © 2010-2014 Matúš Chochlík, University of Žilina, Žilina, Slovakia.
<matus.chochlik -at- fri.uniza.sk>
<chochlik -at -gmail.com>
Documentation generated on Mon Sep 22 2014 by Doxygen (version 1.8.6).