sample_map_iterator sample_end = samples.end();
for ( ; sample_current != sample_end; ++sample_current ) {
sample_ref *sr = sample_current->second;
+
+ audio_sched->stopSample(sr->sample);
delete sr->sample;
delete sr;
}
sound_map_iterator sound_end = sounds.end();
for ( ; sound_current != sound_end; ++sound_current ) {
FGSimpleSound *s = sound_current->second;
+
+ audio_sched->stopSample(s->get_sample());
+ delete s->get_sample();
delete s;
}
// initialize the sound manager
void FGSoundMgr::init() {
- last.stamp();
safety = FG_MAX_SOUND_SAFETY;
// audio_mixer -> setMasterVolume ( 80 ) ; /* 80% of max volume. */
sample_map_iterator sample_end = samples.end();
for ( ; sample_current != sample_end; ++sample_current ) {
sample_ref *sr = sample_current->second;
+
+ audio_sched->stopSample(sr->sample);
delete sr->sample;
delete sr;
}
sound_map_iterator sound_end = sounds.end();
for ( ; sound_current != sound_end; ++sound_current ) {
FGSimpleSound *s = sound_current->second;
+
+ audio_sched->stopSample(s->get_sample());
delete s->get_sample();
delete s;
}
}
+
void FGSoundMgr::bind ()
{
// no properties yet
}
+
void FGSoundMgr::unbind ()
{
// no properties yet
// run the audio scheduler
-void FGSoundMgr::update(double dt) {
- // FIXME: use dt supplied (seconds)
- SGTimeStamp current;
- current.stamp();
-
- double elapsed = (double)(current - last) / 1000000.0;
- last = current;
-
- if ( elapsed > safety ) {
- safety = elapsed;
+void FGSoundMgr::update( double dt ) {
+ if ( dt > safety ) {
+ safety = dt;
} else {
- safety = safety * 0.99 + elapsed * 0.01;
+ safety = safety * 0.99 + dt * 0.01;
}
if ( safety > FG_MAX_SOUND_SAFETY ) {
safety = FG_MAX_SOUND_SAFETY;