diff --git a/ScStwLibraries/headers/scstwsoundplayer.h b/ScStwLibraries/headers/scstwsoundplayer.h index 82a8436..3356a51 100644 --- a/ScStwLibraries/headers/scstwsoundplayer.h +++ b/ScStwLibraries/headers/scstwsoundplayer.h @@ -112,6 +112,8 @@ public slots: */ bool cancel(); + bool isPlaying(); + private slots: signals: diff --git a/ScStwLibraries/sources/scstwrace.cpp b/ScStwLibraries/sources/scstwrace.cpp index be715c1..86a60af 100644 --- a/ScStwLibraries/sources/scstwrace.cpp +++ b/ScStwLibraries/sources/scstwrace.cpp @@ -556,6 +556,7 @@ QVariantMap ScStwRace::getCurrentStartDelay() { currentStartDelay["progress"] = 0; return currentStartDelay; } + break; case PREPAIRING: { if(!this->startSoundSettings[ScStwSoundPlayer::AtYourMarks]["Enabled"].toBool()) return currentStartDelay; @@ -571,10 +572,11 @@ QVariantMap ScStwRace::getCurrentStartDelay() { // get the total delay and the delay progress of the next action timer double remaining = this->startDelayTimer->remainingTime(); + + if(remaining < 0) + return currentStartDelay; + currentStartDelay["total"] = this->startDelayTimer->interval(); - if(remaining < 0) { - remaining = currentStartDelay["total"].toDouble(); - } currentStartDelay["progress"] = 1 - (remaining / currentStartDelay["total"].toDouble()); if(currentStartDelay["progress"].toDouble() < 0) diff --git a/ScStwLibraries/sources/scstwsoundplayer.cpp b/ScStwLibraries/sources/scstwsoundplayer.cpp index 943513b..e68caee 100644 --- a/ScStwLibraries/sources/scstwsoundplayer.cpp +++ b/ScStwLibraries/sources/scstwsoundplayer.cpp @@ -115,3 +115,7 @@ bool ScStwSoundPlayer::waitForSoundFinish(double *timeOfStop) { return true; } + +bool ScStwSoundPlayer::isPlaying() { + return this->soundEffect->isPlaying(); +}