-// set source position of all managed sounds
-void SGSoundMgr::set_source_pos_all( ALfloat *pos ) {
- if ( isnan(pos[0]) || isnan(pos[1]) || isnan(pos[2]) ) {
- // bail if a bad position is passed in
- return;
+/**
+ * set the orientation of the listener (in opengl coordinates)
+ *
+ * Description: ORIENTATION is a pair of 3-tuples representing the
+ * 'at' direction vector and 'up' direction of the Object in
+ * Cartesian space. AL expects two vectors that are orthogonal to
+ * each other. These vectors are not expected to be normalized. If
+ * one or more vectors have zero length, implementation behavior
+ * is undefined. If the two vectors are linearly dependent,
+ * behavior is undefined.
+ */
+void SGSoundMgr::set_orientation( SGQuatd ori )
+{
+ SGVec3d sgv_up = ori.rotate(SGVec3d::e3());
+ SGVec3d sgv_at = ori.rotate(SGVec3d::e2());
+ for (int i=0; i<3; i++) {
+ _listener_ori[i] = sgv_at[i];
+ _listener_ori[i+3] = sgv_up[i];