Skip to content

Commit

Permalink
Fix background music effect
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Feb 8, 2024
1 parent e1b3287 commit 45839e9
Show file tree
Hide file tree
Showing 3 changed files with 12 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
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 45839e9

Please sign in to comment.