Listener uses const references now...
This commit is contained in:
parent
6aa25ad03d
commit
5d3848dc94
|
@ -18,12 +18,12 @@ namespace cAudio
|
|||
MasterGain(1.f) {}
|
||||
virtual ~cListener() {}
|
||||
|
||||
virtual void setPosition(const cVector3 pos);
|
||||
virtual void setDirection(const cVector3 dir);
|
||||
virtual void setUpVector(const cVector3 up);
|
||||
virtual void setVelocity(const cVector3 vel);
|
||||
virtual void setMasterVolume(const float volume);
|
||||
virtual void move(const cVector3 pos);
|
||||
virtual void setPosition(const cVector3& pos);
|
||||
virtual void setDirection(const cVector3& dir);
|
||||
virtual void setUpVector(const cVector3& up);
|
||||
virtual void setVelocity(const cVector3& vel);
|
||||
virtual void setMasterVolume(const float& volume);
|
||||
virtual void move(const cVector3& pos);
|
||||
|
||||
virtual cVector3 getPosition(void) const { return Position; }
|
||||
virtual cVector3 getDirection(void) const { return Direction; }
|
||||
|
|
|
@ -8,39 +8,39 @@
|
|||
|
||||
namespace cAudio
|
||||
{
|
||||
void cListener::setPosition(const cVector3 pos)
|
||||
void cListener::setPosition(const cVector3& pos)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
Position = pos;
|
||||
alListener3f(AL_POSITION, Position.x, Position.y, Position.z);
|
||||
}
|
||||
void cListener::setDirection(const cVector3 dir)
|
||||
void cListener::setDirection(const cVector3& dir)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
Direction = dir;
|
||||
float orient[6] = {Direction[0], Direction[1], Direction[2], UpVector[0], UpVector[1], UpVector[2]};
|
||||
alListenerfv(AL_ORIENTATION, orient);
|
||||
}
|
||||
void cListener::setUpVector(const cVector3 up)
|
||||
void cListener::setUpVector(const cVector3& up)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
UpVector = up;
|
||||
float orient[6] = {Direction[0], Direction[1], Direction[2], UpVector[0], UpVector[1], UpVector[2]};
|
||||
alListenerfv(AL_ORIENTATION, orient);
|
||||
}
|
||||
void cListener::setVelocity(const cVector3 vel)
|
||||
void cListener::setVelocity(const cVector3& vel)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
Velocity = vel;
|
||||
alListener3f(AL_VELOCITY, Velocity.x, Velocity.y, Velocity.z);
|
||||
}
|
||||
void cListener::setMasterVolume(const float volume)
|
||||
void cListener::setMasterVolume(const float& volume)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
MasterGain = volume;
|
||||
alListenerf(AL_GAIN, MasterGain);
|
||||
}
|
||||
void cListener::move(const cVector3 pos)
|
||||
void cListener::move(const cVector3& pos)
|
||||
{
|
||||
cAudioMutexBasicLock lock(Mutex);
|
||||
Velocity = pos - Position;
|
||||
|
|
|
@ -22,32 +22,32 @@ namespace cAudio
|
|||
Use move() if you'd like to have cAudio automatically handle velocity for you. */
|
||||
/**
|
||||
\param pos: New position for the listener. */
|
||||
virtual void setPosition(const cVector3 pos) = 0;
|
||||
virtual void setPosition(const cVector3& pos) = 0;
|
||||
|
||||
//! Sets the direction the listener is facing
|
||||
/**
|
||||
\param dir: New direction vector for the listener. */
|
||||
virtual void setDirection(const cVector3 dir) = 0;
|
||||
virtual void setDirection(const cVector3& dir) = 0;
|
||||
|
||||
//! Sets the up vector to use for the listener
|
||||
/** Default up vector is Y+, same as OpenGL.
|
||||
\param up: New up vector for the listener. */
|
||||
virtual void setUpVector(const cVector3 up) = 0;
|
||||
virtual void setUpVector(const cVector3& up) = 0;
|
||||
|
||||
//! Sets the current velocity of the listener for doppler effects
|
||||
/**
|
||||
\param vel: New velocity for the listener. */
|
||||
virtual void setVelocity(const cVector3 vel) = 0;
|
||||
virtual void setVelocity(const cVector3& vel) = 0;
|
||||
|
||||
//! Sets the global volume modifier (will effect all sources)
|
||||
/**
|
||||
\param volume: Volume to scale all sources by. Range: 0.0 to +inf. */
|
||||
virtual void setMasterVolume(const float volume) = 0;
|
||||
virtual void setMasterVolume(const float& volume) = 0;
|
||||
|
||||
//! Convenience function to automatically set the velocity and position for you in a single call
|
||||
/** Velocity will be set to new position - last position
|
||||
\param pos: New position to move the listener to. */
|
||||
virtual void move(const cVector3 pos) = 0;
|
||||
virtual void move(const cVector3& pos) = 0;
|
||||
|
||||
//! Returns the current position of the listener
|
||||
virtual cVector3 getPosition(void) const = 0;
|
||||
|
|
Loading…
Reference in New Issue