Skip to content

Commit

Permalink
Fix background music effect (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev authored Feb 8, 2024
1 parent 033b422 commit 5af3e18
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/actions/codeql/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ runs:
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

env:
CODEQL_EXTRACTOR_CPP_AUTOINSTALL_DEPENDENCIES: false
# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- Fix background music effect #761 (v20 beta2 🆕)
- Fix typo #762 Thanks @laurens94 (v20 beta2 🆕)
- Yeelight: Wizard now supports more models, workaround for music-mode reset, auto-resume support #750 Thanks @ratawhisk (v20 beta2 🆕)
- Fix verbose command line option #737 (v20 beta2 🆕)
- Add native build for Apple M1 / M2 (arm64) architecture #973 (v20 beta2 🆕)
Expand Down
13 changes: 9 additions & 4 deletions sources/effectengine/AnimationBaseMusic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@
#include <utils/GlobalSignals.h>

AnimationBaseMusic::AnimationBaseMusic(QString name) :
AnimationBase(name)
AnimationBase(name),
_soundCapture(nullptr),
_soundHandle(0)
{
_myTarget.Clear();

emit GlobalSignals::getInstance()->SignalGetSoundCapture(_soundCapture);
if (_soundCapture != nullptr)
SAFE_CALL_0_RET(_soundCapture.get(), open, uint32_t, _soundHandle)
else
if (_soundCapture == nullptr)
setStopMe(true);
};

Expand All @@ -49,6 +49,11 @@ AnimationBaseMusic::~AnimationBaseMusic()

bool AnimationBaseMusic::isSoundEffect()
{
if (_soundHandle == 0 && _soundCapture != nullptr)
{
SAFE_CALL_0_RET(_soundCapture.get(), open, uint32_t, _soundHandle)
}

return true;
};

Expand Down
2 changes: 1 addition & 1 deletion sources/effectengine/Effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void Effect::start()

_timer.setInterval(_effect->GetSleepTime());

Info(_log, "Begin playing the effect with priority: %i", _priority);
Info(_log, "Begin playing the %s with priority: %i", (_effect->isSoundEffect()) ? "music effect" : "effect", _priority);

run();
_timer.start();
Expand Down

0 comments on commit 5af3e18

Please sign in to comment.