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 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
|
/**
* OpenAL++ - an object oriented toolkit for spatial sound
* Copyright (C) 2002 VRlab, Ume University
*
* OpenAL++ was created using the libraries:
* OpenAL (http://www.openal.org),
* PortAudio (http://www.portaudio.com/), and
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
#ifndef LISTENER_H_INCLUDED_C419EF1E
#define LISTENER_H_INCLUDED_C419EF1E
#include "openalpp/export.h"
#include "openalpp/positionedobject.h"
namespace openalpp {
/**
* Class for listeners.
*/
class OPENALPP_API Listener : public PositionedObject {
float position_[3];
float orientation_[6];
float velocity_[3];
static Listener *selectedlistener_;
void init(float x,float y,float z,
float vx,float vy,float vz,
float directionx, float directiony, float directionz,
float upx, float upy, float upz);
protected:
/**
* Destructor.
*/
virtual ~Listener();
public:
/**
* Constructor.
* Creates the listener at the default position.
*/
Listener();
/**
* Copy constructor.
*/
Listener(const Listener &listener);
/**
* Constructor.
* Creates the listener at the specified position and orientation.
* @param x x coordinate
* @param y y coordinate
* @param z z coordinate
* @param directionx x value of the direction vector
* @param directiony y value of the direction vector
* @param directionz z value of the direction vector
* @param upx x value of the up vector
* @param upy y value of the up vector
* @param upz z value of the up vector
*/
Listener(float x,float y,float z,
float directionx,float directiony,float directionz,
float upx,float upy,float upz);
/**
* Constructor.
* Creates the listener at the specified position.
* @param x x coordinate
* @param y y coordinate
* @param z z coordinate
*/
Listener(float x, float y, float z);
/**
* Select this listener.
*/
void select();
/**
* Check if this listener is currently selected.
* @return true if this listener is selected, false otherwise.
*/
bool isSelected();
/**
* Set the current orientation of this listener.
* @param directionx x value of the direction vector
* @param directiony y value of the direction vector
* @param directionz z value of the direction vector
* @param upx x value of the up vector
* @param upy y value of the up vector
* @param upz z value of the up vector
*/
void setOrientation(float directionx,float directiony,float directionz,
float upx, float upy, float upz);
/**
* Get the current orientation of this listener.
* @param directionx x value of the direction vector
* @param directiony y value of the direction vector
* @param directionz z value of the direction vector
* @param upx x value of the up vector
* @param upy y value of the up vector
* @param upz z value of the up vector
*/
void getOrientation(float &directionx,float &directiony,float &directionz,
float &upx, float &upy, float &upz) const;
/**
* Assignment operator.
* @param listener is the object to make a copy of.
*/
Listener &operator=(const Listener &listener);
/**
* Inherited from PositionedObject.
*/
void setPosition(float x, float y, float z);
/**
* Inherited from PositionedObject.
*/
void getPosition(float &x, float &y, float &z) const;
/**
* Inherited from PositionedObject.
*/
void setVelocity(float vx, float vy, float vz);
/**
* Inherited from PositionedObject.
*/
void getVelocity(float &vx, float &vy, float &vz) const;
};
}
#endif /* LISTENER_H_INCLUDED_C419EF1E */
|