1 | //************************************ bs::framework - Copyright 2018 Marko Pintera **************************************// |
2 | //*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********// |
3 | #pragma once |
4 | |
5 | #include "BsOAPrerequisites.h" |
6 | #include "Audio/BsAudioListener.h" |
7 | |
8 | namespace bs |
9 | { |
10 | /** @addtogroup OpenAudio |
11 | * @{ |
12 | */ |
13 | |
14 | /** OpenAL implementation of an AudioListener. */ |
15 | class OAAudioListener : public AudioListener |
16 | { |
17 | public: |
18 | OAAudioListener(); |
19 | virtual ~OAAudioListener(); |
20 | |
21 | /** @copydoc SceneActor::setTransform */ |
22 | void setTransform(const Transform& transform) override; |
23 | |
24 | /** @copydoc AudioListener::setVelocity */ |
25 | void setVelocity(const Vector3& velocity) override; |
26 | |
27 | private: |
28 | friend class OAAudio; |
29 | |
30 | /** Re-applies stored properties to the listener. */ |
31 | void rebuild(); |
32 | |
33 | /** Returns forward and up direction as a single vector. */ |
34 | inline std::array<float, 6> getOrientation() const; |
35 | |
36 | /** Updates internal position of the listener. */ |
37 | inline void updatePosition(); |
38 | |
39 | /** Updates internal forward and up directions of the listener. */ |
40 | inline void updateOrientation(const std::array<float, 6>& orientation); |
41 | |
42 | /** Updates internal velocity of the listener. */ |
43 | inline void updateVelocity(); |
44 | |
45 | /** Updates internal volume of the listener. */ |
46 | inline void updateVolume(float volume); |
47 | }; |
48 | |
49 | /** @} */ |
50 | } |