-bool FGSoundMgr::init() {
- audio_mixer -> setMasterVolume ( 80 ) ; /* 80% of max volume. */
- audio_sched -> setSafetyMargin ( 1.0 ) ;
-
- sound_map_iterator current = sounds.begin();
- sound_map_iterator end = sounds.end();
- for ( ; current != end; ++current ) {
- FGSimpleSound *s = current->second;
+void FGSoundMgr::init() {
+ safety = FG_MAX_SOUND_SAFETY;
+
+ // audio_mixer -> setMasterVolume ( 80 ) ; /* 80% of max volume. */
+ audio_sched -> setSafetyMargin ( FG_SOUND_SAFETY_MULT * safety ) ;
+
+
+ //
+ // Remove the samples from the sample manager.
+ //
+ sample_map_iterator sample_current = samples.begin();
+ 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;
+ }
+ samples.clear();
+
+ //
+ // Remove the sounds from the sound manager.
+ //
+ sound_map_iterator sound_current = sounds.begin();
+ 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());