-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsoundlistener.h
51 lines (42 loc) · 1.33 KB
/
soundlistener.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef SOUNDLISTENER_H
#define SOUNDLISTENER_H
#include "innpch.h"
#include "componentdata.h"
/** The ears of the player / camera.
* Global listener and also sound mixer for all sounds.
* @brief The ears of the player / camera.
*/
class SoundListener
{
public:
SoundListener(const gsl::vec3& pos = gsl::vec3(0),
const gsl::vec3& vel = gsl::vec3(0),
const gsl::vec3& dir = gsl::vec3(0.f, 0.f, -1.f),
const gsl::vec3& up = gsl::vec3(0.f, 1.f, 0.f));
/**
* @brief Updates the position of the sound listener with the given position.
*/
void setPosition(const gsl::vec3& pos);
/**
* @brief Updates the velocity of the sound listener with the given velocity.
*/
void setVelocity(const gsl::vec3& vel);
/**
* @brief Updates the direction of the sound listener with the given direction.
*/
void setDirection(const gsl::vec3& dir, const gsl::vec3& up);
/**
* @brief Sets mute to be the given value.
*/
void setMute(bool mute);
/**
* @brief Updates the listener based on the given camera and transform component.
*/
void update(const CameraComponent& camera, const TransformComponent& transform);
private:
gsl::vec3 mPos;
gsl::vec3 mVel;
gsl::vec3 mDir;
gsl::vec3 mUp;
};
#endif // SOUNDLISTENER_H