cAudio 2.3.0
3d Audio Engine
Loading...
Searching...
No Matches
cListener.h
1// Copyright (c) 2008-2011 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones, Murat (wolfmanfx) Sari
2// This file is part of the "cAudio Engine"
3// For conditions of distribution and use, see copyright notice in cAudio.h
4
5#pragma once
6
7#include "IListener.h"
8#include "cMutex.h"
9
10namespace cAudio
11{
12 class cListener : public IListener
13 {
14 public:
15 cListener() : Direction(cVector3(0.f, 0.f, -1.f)),
16 UpVector(cVector3(0.f, 1.f, 0.f)),
17 MasterGain(1.f) {}
18 virtual ~cListener() {}
19
20 virtual void setPosition(const cVector3& pos);
21 virtual void setDirection(const cVector3& dir);
22 virtual void setUpVector(const cVector3& up);
23 virtual void setVelocity(const cVector3& vel);
24 virtual void setMasterVolume(const float& volume);
25 virtual void move(const cVector3& pos);
26
27 virtual cVector3 getPosition(void) const { return Position; }
28 virtual cVector3 getDirection(void) const { return Direction; }
29 virtual cVector3 getUpVector(void) const { return UpVector; }
30 virtual cVector3 getVelocity(void) const { return Velocity; }
31 virtual float getMasterVolume(void) const { return MasterGain; }
32
33#if CAUDIO_EFX_ENABLED == 1
34 virtual void setMetersPerUnit(const float& meters);
35 virtual float getMetersPerUnit(void) const;
36#endif
37
38 protected:
39 cAudioMutex Mutex;
40
41 cVector3 Position;
42 cVector3 Direction;
43 cVector3 UpVector;
44 cVector3 Velocity;
45 float MasterGain;
46 private:
47 };
48}
Interface for the listener in cAudio. This class provides abilities to move and orient where your cam...
Definition: IListener.h:14
virtual void setPosition(const cVector3 &pos)
Sets the position of the listener.
Definition: cListener.cpp:11
virtual void setMasterVolume(const float &volume)
Sets the global volume modifier (will effect all sources)
Definition: cListener.cpp:41
virtual float getMasterVolume(void) const
Returns the global volume modifier for all sources.
Definition: cListener.h:31
virtual cVector3 getDirection(void) const
Returns the current direction of the listener.
Definition: cListener.h:28
virtual cVector3 getVelocity(void) const
Returns the current velocity of the listener.
Definition: cListener.h:30
virtual void setUpVector(const cVector3 &up)
Sets the up vector to use for the listener.
Definition: cListener.cpp:26
virtual void setVelocity(const cVector3 &vel)
Sets the current velocity of the listener for doppler effects.
Definition: cListener.cpp:34
virtual void move(const cVector3 &pos)
Convenience function to automatically set the velocity and position for you in a single call.
Definition: cListener.cpp:48
virtual cVector3 getPosition(void) const
Returns the current position of the listener.
Definition: cListener.h:27
virtual void setDirection(const cVector3 &dir)
Sets the direction the listener is facing.
Definition: cListener.cpp:18
virtual cVector3 getUpVector(void) const
Returns the current up vector of the listener.
Definition: cListener.h:29
Class for manipulating vectors in 3D space.
Definition: cVector3.h:23
Main namespace for the entire cAudio library.
Definition: cAudioCapture.h:16