caudio/Headers/cListener.h
Joshua Jones 28a22c7f73 Fixed problem with the msvc project not outputting a .lib file.
Updated tutorials to fix minor bugs and pathing issues.  Also fixed crash bug on failure to create the audio object.
Added msvc projects for all tutorials.
Updated the listener class to be self contained and only handle stuff related to the OpenAL listener.  It does NOT init OpenAL anymore, that has been moved to cAudioManager.
Extended the listener class to support all settings that native OpenAL supports.
Cleaned up cFileSource and fixed a crash bug on NULL file handle
Fixed returning bad audio buffer chunk sizes from the cOggDecoder on errors in the ogg stream
Seeking can now be down in fractions of a second now, changed the seconds field from int to float
Fixed various odd formatting.
Fixed potential crash bug in cMemorySource if memory could not be allocated.
cMemorySource will no longer clear the buffer you give to it before filling it with data.  This prevents an overwrite from happening in case of error but the user should provide a zeroed buffer to cMemorySource anyway for safety.
Relative seeking is now supported by cOggDecoder.
2009-08-08 05:51:32 +00:00

59 lines
2.4 KiB
C++

#ifndef CLISTENER_H_INCLUDED
#define CLISTENER_H_INCLUDED
#include "../include/IListener.h"
namespace cAudio
{
class cListener : public IListener
{
public:
cListener() : Direction(0.f, 0.f, -1.f),
UpVector(0.f, 1.f, 0.f),
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 float x, const float y, const float z) { setPosition(cVector3(x,y,z)); }
virtual void setPosition(const cVector3 pos);
//!Sets the direction the listener is facing
virtual void setDirection(const float x, const float y, const float z) { setDirection(cVector3(x,y,z)); }
virtual void setDirection(const cVector3 dir);
//!Sets the up vector to use for the listener
virtual void setUpVector(const float x, const float y, const float z) { setUpVector(cVector3(x,y,z)); }
virtual void setUpVector(const cVector3 up);
//!Sets the current velocity of the listener for doppler effects
virtual void setVelocity(const float x, const float y, const float z) { setVelocity(cVector3(x,y,z)); }
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 float x, const float y, const float z) { move(cVector3(x,y,z)); }
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; }
protected:
cVector3 Position;
cVector3 Direction;
cVector3 UpVector;
cVector3 Velocity;
float MasterGain;
private:
};
}
#endif //! CLISTENER_H_INCLUDED