+class SGSoundSampleInfo
+{
+public:
+ SGSoundSampleInfo();
+ ~SGSoundSampleInfo() {}
+
+ /**
+ * Returns the format of this audio sample.
+ * @return SimGear format-id
+ */
+ inline unsigned int get_format() { return (_tracks | _bits | _compressed*256); }
+
+ /**
+ * Get the reference name of this audio sample.
+ * @return Sample name
+ */
+ inline std::string get_sample_name() const { return _refname; }
+
+ /**
+ * Returns the frequency (in Herz) of this audio sample.
+ * @return Frequency
+ */
+ inline unsigned int get_frequency() { return _frequency; }
+
+ /**
+ * Get the current pitch value of this audio sample.
+ * @return Pitch
+ */
+ inline float get_pitch() { return _pitch; }
+
+ /**
+ * Get the final volume value of this audio sample.
+ * @return Volume
+ */
+ inline float get_volume() { return _volume * _master_volume; }
+
+ /**
+ * Returns the size (in bytes) of this audio sample.
+ * @return Data size
+ */
+ inline size_t get_size() const {
+ return (_samples * _tracks * _bits)/8;
+ }
+
+
+ /**
+ * Get the absolute position of this sound.
+ * This is in the same coordinate system as OpenGL; y=up, z=back, x=right.
+ * @return Absolute position
+ */
+ inline SGVec3d& get_position() { return _absolute_pos; }
+
+ /**
+ * Get the orientation vector of this sound.
+ * This is in the same coordinate system as OpenGL; y=up, z=back, x=right
+ * @return Orientaton vector
+ */
+ inline SGVec3f& get_orientation() { return _orivec; }
+
+ /**
+ * Get the inner angle of the audio cone.
+ * @return Inner angle in degrees
+ */
+ inline float get_innerangle() { return _inner_angle; }
+
+ /**
+ * Get the outer angle of the audio cone.
+ * @return Outer angle in degrees
+ */
+ inline float get_outerangle() { return _outer_angle; }
+
+ /**
+ * Get the remaining gain at the edge of the outer cone.
+ * @return Gain
+ */
+ inline float get_outergain() { return _outer_gain; }
+
+ /**
+ * Get velocity vector (in meters per second) of this sound.
+ * This is in the same coordinate system as OpenGL; y=up, z=back, x=right
+ * @return Velocity vector
+ */
+ inline SGVec3f& get_velocity() { return _velocity; }
+
+ /**
+ * Get reference distance ((in meters) of this sound.
+ * This is the distance where the gain will be half.
+ * @return Reference distance
+ */
+ inline float get_reference_dist() { return _reference_dist; }
+
+ /**
+ * Get maximum distance (in meters) of this sound.
+ * This is the distance where this sound is no longer audible.
+ * @return dist Maximum distance
+ */
+ inline float get_max_dist() { return _max_dist; }
+
+ /**
+ * Test if static data of audio sample configuration has changed.
+ * Calling this function will reset the flag so calling it a second
+ * time in a row will return false.
+ * @return Return true is the static data has changed in the mean time.
+ */
+ bool has_static_data_changed() {
+ bool b = _static_changed; _static_changed = false; return b;
+ }
+
+protected:
+ // static sound emitter info
+ std::string _refname;
+ unsigned int _bits;
+ unsigned int _tracks;
+ unsigned int _samples;
+ unsigned int _frequency;
+ bool _compressed;
+ bool _loop;
+
+ // dynamic sound emitter info (non 3d)
+ bool _static_changed;
+ bool _playing;
+
+ float _pitch;
+ float _volume;
+ float _master_volume;
+
+ // dynamic sound emitter info (3d)
+ bool _use_pos_props;
+ bool _out_of_range;
+
+ float _inner_angle;
+ float _outer_angle;
+ float _outer_gain;
+
+ float _reference_dist;
+ float _max_dist;
+
+ SGPropertyNode_ptr _pos_prop[3];
+ SGVec3d _absolute_pos; // absolute position
+ SGVec3d _relative_pos; // position relative to the base position
+ SGVec3d _direction; // orientation offset
+ SGVec3f _velocity; // Velocity of the source sound.
+
+ // The position and orientation of this sound
+ SGQuatd _orientation; // base orientation
+ SGVec3f _orivec; // orientation vector
+ SGVec3d _base_pos; // base position
+
+ SGQuatd _rotation;
+
+private:
+ static std::string random_string();
+};
+
+
+class SGSoundSample : public SGSoundSampleInfo, public SGReferenced {