X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FSound%2Ffg_sound.hxx;h=c1aaa567998b4aa4545257fb3b6707489fe4459f;hb=198b88ca9b4a4b123b2e9ccdc85ea17eeaea70c6;hp=37b2d21241c84c77e1bcf0c8917f22c1489901fb;hpb=60e0204fe8c7d140fe529e887d2888453afe9d2a;p=flightgear.git diff --git a/src/Sound/fg_sound.hxx b/src/Sound/fg_sound.hxx index 37b2d2124..c1aaa5679 100644 --- a/src/Sound/fg_sound.hxx +++ b/src/Sound/fg_sound.hxx @@ -28,39 +28,46 @@ #endif #include +#include + #include
#include
#include "soundmgr.hxx" +static const double MAX_TRANSIT_TIME = 0.1; // 100 ms. + + /** - * Class for handling one sound. + * Class for handling one sound event. * */ -class FGSound : public FGSubsystem +class FGSound { public: - FGSound(const SGPropertyNode *); + FGSound(); virtual ~FGSound(); - virtual void init (); + virtual void init (SGPropertyNode *); virtual void bind (); virtual void unbind (); - virtual void update (int dt); + virtual void update (double dt); + + void stop(); protected: enum { MAXPROP=5 }; - enum { ONCE=0, LOOPED }; - enum { LEVEL=0, INVERTED, FLIPFLOP, RAISE, FALL }; - + enum { ONCE=0, LOOPED, IN_TRANSIT }; + enum { LEVEL=0, INVERTED, FLIPFLOP }; // Sound properties typedef struct { - const SGPropertyNode * prop; + SGPropertyNode * prop; double (*fn)(double); + double *intern; double factor; double offset; double min; @@ -68,30 +75,22 @@ protected: bool subtract; } _snd_prop; -#if 0 - // Sound source (distance, horizontal position in degrees and - // vertical position in degrees) - typedef struct { - float dist; - float hor; - float vert; - } _pos_prop; -#endif - private: - const SGPropertyNode * _node; - + FGSoundMgr * _mgr; FGSimpleSound * _sample; - const SGPropertyNode * _property; - bool _active; + FGCondition * _condition; + SGPropertyNode * _property; - int _mode; - int _type; + bool _active; string _name; - double _factor; - double _offset; + int _mode; + double _prev_value; + double _dt_play; + double _dt_stop; + double _stopping; // time after the sound should have stopped. + // This is usefull for lost packets in in-trasit mode. vector<_snd_prop> _volume; vector<_snd_prop> _pitch;