]> git.mxchange.org Git - flightgear.git/blobdiff - src/Sound/soundmgr.cxx
Major overhaul:
[flightgear.git] / src / Sound / soundmgr.cxx
index 41947bb0f8703172e8f7f129dcaf25fe4433bf0e..2b7e25576c4dee1eb1686c4fe3eb14c3d7f2cfad 100644 (file)
@@ -41,8 +41,7 @@
 // constructor
 FGSimpleSound::FGSimpleSound( string file )
   : pitch(1.0),
-    volume(1.0),
-    requests(0)
+    volume(1.0)
 {
     SGPath slfile( globals->get_fg_root() );
     slfile.append( file );
@@ -55,8 +54,7 @@ FGSimpleSound::FGSimpleSound( string file )
 
 FGSimpleSound::FGSimpleSound( unsigned char *buffer, int len )
   : pitch(1.0),
-    volume(1.0),
-    requests(0)
+    volume(1.0)
 {
     sample = new slSample ( buffer, len );
     pitch_envelope = new slEnvelope( 1, SL_SAMPLE_ONE_SHOT );
@@ -74,14 +72,12 @@ FGSimpleSound::~FGSimpleSound() {
 
 void FGSimpleSound::play( slScheduler *sched, bool looped ) {
     
-    requests++;
-
     // make sure sound isn't already playing
     if ( sample->getPlayCount() > 0 ) {
-        return;
+       sched->stopSample(sample);
+    //   return;
     }
 
-    // sched->stopSample(sample);
     if ( looped ) {
         sched->loopSample(sample);
     } else {
@@ -94,18 +90,6 @@ void FGSimpleSound::play( slScheduler *sched, bool looped ) {
 
 void FGSimpleSound::stop( slScheduler *sched, bool quick ) {
 
-    if ( quick ) {
-        requests = 0;
-    } else {
-        if ( --requests < 0 ) {
-            requests = 0;
-        }
-    }
-
-    if ( requests > 0 ) {
-       return;
-    }
-
     sched->stopSample( sample );
 }
 
@@ -207,7 +191,8 @@ void FGSoundMgr::unbind ()
 
 
 // run the audio scheduler
-void FGSoundMgr::update(int dt) {
+void FGSoundMgr::update(double dt) {
+                               // FIXME: use dt supplied (seconds)
     SGTimeStamp current;
     current.stamp();