From 0f77c59319de6d7c6b1ac49df7683e5bdf758dda Mon Sep 17 00:00:00 2001 From: Calcitem Date: Sun, 24 Oct 2021 18:31:52 +0800 Subject: [PATCH] qt: Replace QSound with QSoundEffect --- src/ui/qt/game.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ui/qt/game.cpp b/src/ui/qt/game.cpp index ca55ddae..de6d0ed4 100644 --- a/src/ui/qt/game.cpp +++ b/src/ui/qt/game.cpp @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include #include @@ -571,7 +571,10 @@ void Game::playSound(GameSound soundType, Color c) } if (hasSound) { - QSound::play(soundPath); + QSoundEffect *effect = new QSoundEffect; + effect->setSource(QUrl::fromLocalFile(soundPath)); + effect->setLoopCount(1); + effect->play(); } #endif /* ! DONOT_PLAY_SOUND */ }