2010-02-09 05:18:39 +01:00
|
|
|
// Copyright (c) 2008-2010 Raynaldo (Wildicv) Rivera, Joshua (Dark_Kilauea) Jones
|
|
|
|
// This file is part of the "cAudio Engine"
|
|
|
|
// For conditions of distribution and use, see copyright notice in cAudio.h
|
|
|
|
|
2009-06-21 05:24:30 +02:00
|
|
|
#ifndef CLISTENER_H_INCLUDED
|
|
|
|
#define CLISTENER_H_INCLUDED
|
2009-08-08 07:51:32 +02:00
|
|
|
|
|
|
|
#include "../include/IListener.h"
|
2009-08-29 13:24:31 +02:00
|
|
|
#include "../Headers/cMutex.h"
|
2009-06-21 05:24:30 +02:00
|
|
|
|
|
|
|
namespace cAudio
|
|
|
|
{
|
2009-08-08 07:51:32 +02:00
|
|
|
class cListener : public IListener
|
2009-06-21 05:24:30 +02:00
|
|
|
{
|
|
|
|
public:
|
2009-08-26 04:19:58 +02:00
|
|
|
cListener() : Direction(cVector3(0.f, 0.f, -1.f)),
|
|
|
|
UpVector(cVector3(0.f, 1.f, 0.f)),
|
2009-08-08 07:51:32 +02:00
|
|
|
MasterGain(1.f) {}
|
|
|
|
virtual ~cListener() {}
|
|
|
|
|
|
|
|
//!Sets the position of the listener
|
|
|
|
//!Note that this will automatically set velocity to 0
|
|
|
|
//!Use move() if you'd like to have cAudio automatically handle velocity for you
|
|
|
|
//!or remember to set it yourself after setPosition
|
|
|
|
virtual void setPosition(const cVector3 pos);
|
|
|
|
//!Sets the direction the listener is facing
|
|
|
|
virtual void setDirection(const cVector3 dir);
|
|
|
|
//!Sets the up vector to use for the listener
|
|
|
|
virtual void setUpVector(const cVector3 up);
|
|
|
|
//!Sets the current velocity of the listener for doppler effects
|
|
|
|
virtual void setVelocity(const cVector3 vel);
|
|
|
|
//!Sets the global volume modifier (will effect all sources)
|
|
|
|
virtual void setMasterVolume(const float volume);
|
|
|
|
//!Convenience function to automatically set the velocity for you on a move
|
|
|
|
//!Velocity will be set to new position - last position
|
|
|
|
virtual void move(const cVector3 pos);
|
|
|
|
|
|
|
|
//!Returns the current position of the listener
|
|
|
|
virtual cVector3 getPosition(void) const { return Position; }
|
|
|
|
//!Returns the current direction of the listener
|
|
|
|
virtual cVector3 getDirection(void) const { return Direction; }
|
|
|
|
//!Returns the current up vector of the listener
|
|
|
|
virtual cVector3 getUpVector(void) const { return UpVector; }
|
|
|
|
//!Returns the current velocity of the listener
|
|
|
|
virtual cVector3 getVelocity(void) const { return Velocity; }
|
|
|
|
//!Returns the global volume modifier for all sources
|
|
|
|
virtual float getMasterVolume(void) const { return MasterGain; }
|
2010-01-11 01:39:08 +01:00
|
|
|
|
|
|
|
#ifdef CAUDIO_EFX_ENABLED
|
|
|
|
//!Sets the meters per user world unit for use with sound effects
|
|
|
|
virtual void setMetersPerUnit(const float& meters);
|
|
|
|
//!Returns the meters per user world unit for use with sound effects
|
|
|
|
virtual float getMetersPerUnit(void) const;
|
|
|
|
#endif
|
|
|
|
|
2009-08-08 07:51:32 +02:00
|
|
|
protected:
|
2009-08-29 13:24:31 +02:00
|
|
|
cAudioMutex Mutex;
|
|
|
|
|
2009-08-08 07:51:32 +02:00
|
|
|
cVector3 Position;
|
|
|
|
cVector3 Direction;
|
|
|
|
cVector3 UpVector;
|
|
|
|
cVector3 Velocity;
|
|
|
|
float MasterGain;
|
|
|
|
private:
|
2009-06-21 05:24:30 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif //! CLISTENER_H_INCLUDED
|