X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fsound%2Fsample_group.hxx;h=d2d47394d4530a32a33f68db431e4212f5e6638b;hb=1f37095087fa7aa3d210ba134058b86c3bd6d69e;hp=7a3dff70be25ae0be6baa9a023d7c6eb073076f6;hpb=feba9024eb791f3fca56405bdff728cd103ace28;p=simgear.git diff --git a/simgear/sound/sample_group.hxx b/simgear/sound/sample_group.hxx index 7a3dff70..d2d47394 100644 --- a/simgear/sound/sample_group.hxx +++ b/simgear/sound/sample_group.hxx @@ -56,8 +56,7 @@ using std::map; using std::string; -typedef SGSharedPtr SGSoundSample_ptr; -typedef map < string, SGSoundSample_ptr > sample_map; +typedef map < string, SGSharedPtr > sample_map; typedef sample_map::iterator sample_map_iterator; typedef sample_map::const_iterator const_sample_map_iterator; @@ -106,7 +105,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. @@ -129,6 +128,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. */ @@ -187,23 +191,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 @@ -216,20 +226,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 _removed_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 ); };