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 "BsCorePrerequisites.h" |
6 | #include "Scene/BsSceneActor.h" |
7 | #include "Math/BsVector3.h" |
8 | |
9 | namespace bs |
10 | { |
11 | /** @addtogroup Audio |
12 | * @{ |
13 | */ |
14 | |
15 | /** |
16 | * Represents a listener that hears audio sources. For spatial audio the volume and pitch of played audio is determined |
17 | * by the distance, orientation and velocity differences between the source and the listener. |
18 | */ |
19 | class BS_CORE_EXPORT AudioListener : public IReflectable, public SceneActor |
20 | { |
21 | public: |
22 | virtual ~AudioListener() = default; |
23 | |
24 | /** Sets the velocity of the listener. */ |
25 | virtual void setVelocity(const Vector3& velocity); |
26 | |
27 | /** Retrieves the velocity of the listener. */ |
28 | Vector3 getVelocity() const { return mVelocity; } |
29 | |
30 | /** Creates a new audio listener. */ |
31 | static SPtr<AudioListener> create(); |
32 | |
33 | protected: |
34 | AudioListener() = default; |
35 | |
36 | Vector3 mVelocity = BsZero; |
37 | |
38 | /************************************************************************/ |
39 | /* RTTI */ |
40 | /************************************************************************/ |
41 | public: |
42 | friend class AudioListenerRTTI; |
43 | static RTTITypeBase* getRTTIStatic(); |
44 | RTTITypeBase* getRTTI() const override; |
45 | }; |
46 | |
47 | /** @} */ |
48 | } |
49 | |