Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix background music effect #761

Merged
merged 2 commits into from
Feb 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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