X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fsound%2Fsample_group.hxx;h=ccf1e85db1f4ede870f4d48ef6b553f63cd9b9c9;hb=bcb320b537b6f7e5e3724e8a30d309322171eb43;hp=a4e7b6533d00c3a476c6ac7e731d7ceee2cb0c0c;hpb=7287509feff5372057cbfda468c841fa0a8cdef6;p=simgear.git diff --git a/simgear/sound/sample_group.hxx b/simgear/sound/sample_group.hxx index a4e7b653..ccf1e85d 100644 --- a/simgear/sound/sample_group.hxx +++ b/simgear/sound/sample_group.hxx @@ -35,11 +35,14 @@ #if defined(__APPLE__) # include +#elif defined(OPENALSDK) +# include #else # include #endif #include +#include #include #include @@ -49,6 +52,7 @@ #include #include "sample_openal.hxx" +#include "sample_queue.hxx" using std::map; using std::string; @@ -81,7 +85,7 @@ public: /** * Destructor */ - ~SGSampleGroup (); + virtual ~SGSampleGroup (); /** * Set the status of this sample group to active. @@ -102,7 +106,7 @@ public: * @param refname Name of this audio sample for reference purposes * @return return true if successful */ - bool add( SGSoundSample *sound, const string& refname ); + bool add( SGSharedPtr sound, const string& refname ); /** * Remove an audio sample from this group. @@ -125,6 +129,11 @@ public: */ SGSoundSample *find( const string& refname ); + /** + * Stop all playing samples and set the source id to invalid. + */ + void stop(); + /** * Request to stop playing all audio samples until further notice. */ @@ -183,23 +192,29 @@ public: /** * Set the velocity vector of this sample group. - * This is in the same coordinate system as OpenGL; y=up, z=back, x=right. + * This is in the local frame coordinate system; x=north, y=east, z=down * @param vel Velocity vector */ - void set_velocity( const SGVec3d& vel ); + void set_velocity( const SGVec3d& vel ) { + _velocity = vel; _changed = true; + } /** * Set the position of this sample group. * This is in the same coordinate system as OpenGL; y=up, z=back, x=right. * @param pos Base position */ - void set_position( const SGGeod& pos ); + void set_position_geod( const SGGeod& pos ) { + _base_pos = pos; _changed = true; + } /** * Set the orientation of this sample group. * @param ori Quaternation containing the orientation information */ - void set_orientation( const SGQuatd& ori ); + void set_orientation( const SGQuatd& ori ) { + _orientation = ori; _changed = true; + } /** * Tie this sample group to the listener position, orientation and velocity @@ -212,18 +227,22 @@ protected: bool _active; private: + bool _changed; + bool _pause; float _volume; bool _tied_to_listener; SGVec3d _velocity; + SGGeod _base_pos; SGQuatd _orientation; - SGGeod _position; sample_map _samples; + std::vector< SGSharedPtr > _removed_samples; bool testForALError(string s); bool testForError(void *p, string s); + void update_pos_and_orientation(); void update_sample_config( SGSoundSample *sound ); };