add <delay-sec> parameter that defines how many seconds after triggering

the sound should be played (default: 0)
This commit is contained in:
mfranz
2008-05-21 14:47:06 +00:00
parent 77fb93bb61
commit b20b3229bf
2 changed files with 8 additions and 0 deletions

View File

@@ -70,6 +70,7 @@ SGXmlSound::SGXmlSound()
_prev_value(0),
_dt_play(0.0),
_dt_stop(0.0),
_delay(0.0),
_stopping(0.0)
{
}
@@ -120,6 +121,8 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node, SGSoundMgr *sndmgr,
SG_LOG(SG_GENERAL, SG_WARN,
" Neither a condition nor a property specified");
_delay = node->getDoubleValue("delay-sec", 0.0);
//
// set volume properties
//
@@ -348,6 +351,9 @@ SGXmlSound::update (double dt)
_stopping = 0.0;
}
if (_dt_play < _delay)
return;
//
// Update the volume
//

View File

@@ -76,6 +76,7 @@ public:
* <path/> The relative path to the audio file.
* <property/> Take action if this property becomes true.
* <condition/> Take action if this condition becomes true.
* <delay-sec/> Time after which the sound should be played.
* <volume> or <pitch> Define volume or pitch settings.
* <property/> Take the value of this property as a refference for the
* result.
@@ -144,6 +145,7 @@ private:
double _prev_value;
double _dt_play;
double _dt_stop;
double _delay; // time after which the sound should be started (default: 0)
double _stopping; // time after the sound should have stopped.
// This is usefull for lost packets in in-trasit mode.