+
+#ifndef ALC_ALL_DEVICES_SPECIFIER
+# define ALC_ALL_DEVICES_SPECIFIER 0x1013
+#endif
+
+class SGSoundMgr::SoundManagerPrivate
+{
+public:
+ SoundManagerPrivate() :
+ _device(NULL),
+ _context(NULL),
+ _absolute_pos(SGVec3d::zeros()),
+ _base_pos(SGVec3d::zeros()),
+ _orientation(SGQuatd::zeros())
+ {
+
+
+ }
+
+ void init()
+ {
+ _at_up_vec[0] = 0.0; _at_up_vec[1] = 0.0; _at_up_vec[2] = -1.0;
+ _at_up_vec[3] = 0.0; _at_up_vec[4] = 1.0; _at_up_vec[5] = 0.0;
+ }
+
+ void 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;
+ }
+
+ ALCdevice *_device;
+ ALCcontext *_context;
+
+ std::vector<ALuint> _free_sources;
+ std::vector<ALuint> _sources_in_use;
+
+ SGVec3d _absolute_pos;
+ SGVec3d _base_pos;
+ SGQuatd _orientation;
+ // Orientation of the listener.
+ // first 3 elements are "at" vector, second 3 are "up" vector
+ ALfloat _at_up_vec[6];
+
+ sample_group_map _sample_groups;
+ buffer_map _buffers;
+};
+
+