- sample->no_valid_buffer();
- buffer_it->second.refctr--;
- if (buffer_it->second.refctr == 0) {
- ALuint buffer = buffer_it->second.id;
- _buffers.erase( buffer_it );
- alDeleteBuffers(1, &buffer);
- testForALError("release buffer");
- }
+void SGSoundMgr::update_pos_and_orientation() {
+ /**
+ * 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.
+ *
+ * This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
+ */
+ SGVec3d sgv_at = _orientation.backTransform(-SGVec3d::e3());
+ SGVec3d sgv_up = _orientation.backTransform(SGVec3d::e2());
+ _at_up_vec[0] = sgv_at[0];
+ _at_up_vec[1] = sgv_at[1];
+ _at_up_vec[2] = sgv_at[2];
+ _at_up_vec[3] = sgv_up[0];
+ _at_up_vec[4] = sgv_up[1];
+ _at_up_vec[5] = sgv_up[2];
+
+ _absolute_pos = _base_pos;