diff --git a/src/kits/game/FileGameSound.cpp b/src/kits/game/FileGameSound.cpp index f26c76645b2..085add4b4b7 100644 --- a/src/kits/game/FileGameSound.cpp +++ b/src/kits/game/FileGameSound.cpp @@ -331,27 +331,28 @@ BFileGameSound::Perform(int32 selector, status_t BFileGameSound::SetPaused(bool isPaused, bigtime_t rampTime) { - if (fPaused != isPaused) { - Lock(); - - // Clear any old ramping - delete fPausing; - fPausing = NULL; - - if (rampTime > 100000) { - // Setup for ramping - if (isPaused) - fPausing = InitRamp(&fPauseGain, 0.0, - Format().frame_rate, rampTime); - else - fPausing = InitRamp(&fPauseGain, 1.0, - Format().frame_rate, rampTime); - } + if (fPaused == isPaused) + return EALREADY; + + Lock(); + + // Clear any old ramping + delete fPausing; + fPausing = NULL; - fPaused = isPaused; - Unlock(); + if (rampTime > 100000) { + // Setup for ramping + if (isPaused) + fPausing = InitRamp(&fPauseGain, 0.0, + Format().frame_rate, rampTime); + else + fPausing = InitRamp(&fPauseGain, 1.0, + Format().frame_rate, rampTime); } + fPaused = isPaused; + Unlock(); + return B_OK; }