SGSampleGroup *find( const string& refname, bool create = false );
/**
- * Set the position of the sound manager.
- * This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
+ * Set the Cartesian position of the sound manager.
* @param pos OpenAL listener position
*/
void set_position( const SGVec3d& pos ) {
- _position = pos;
- _changed = true;
+ _base_pos = pos; _changed = true;
+ }
+
+ void set_position_offset( const SGVec3d& pos ) {
+ _offset_pos = pos; _changed = true;
}
/**
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
* @return OpenAL listener position
*/
- SGVec3d& get_position() { return _position; }
+ SGVec3d& get_position() { return _absolute_pos; }
/**
- * Set the velocity vector of the sound manager
- * This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
- * @param vel Velocity vector of the OpenAL listener
+ * Set the velocity vector (in meters per second) of the sound manager
+ * This is the horizontal local frame; x=north, y=east, z=down
+ * @param Velocity vector
*/
- void set_velocity( SGVec3f& vel ) {
+ void set_velocity( const SGVec3f& vel ) {
_velocity = vel; _changed = true;
}
* Set the orientation of the sound manager
* @param ori Quaternation containing the orientation information
*/
- void set_orientation( const SGQuatd& ori, const SGQuatd& offs );
+ void set_orientation( const SGQuatd& ori ) {
+ _orientation = ori; _changed = true;
+ }
/**
* Get the orientation of the sound manager
* @return Quaternation containing the orientation information
*/
inline const SGQuatd& get_orientation() { return _orientation; }
- inline const SGQuatd& get_orientation_offset() { return _orient_offs; }
/**
* Get the direction vector of the sound manager
ALCcontext *_context;
// Position of the listener.
- SGVec3d _position;
+ SGVec3d _absolute_pos;
+ SGVec3d _offset_pos;
+ SGVec3d _base_pos;
// Velocity of the listener.
SGVec3f _velocity;
// Orientation of the listener.
// first 3 elements are "at" vector, second 3 are "up" vector
SGQuatd _orientation;
- SGQuatd _orient_offs;
ALfloat _at_up_vec[6];
sample_group_map _sample_groups;
bool testForALUTError(string s);
bool testForError(void *p, string s);
+ void update_pos_and_orientation();
void update_sample_config( SGSampleGroup *sound );
};