From b07163dd516202516fbb4a47984ea153095fae57 Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Mon, 24 Jul 2023 11:13:14 +0200 Subject: [PATCH] Check active preset after the preset switch event, as this might have failed. Another option would be skipping the rendering if there's no active preset instead of displaying the idle preset. --- src/libprojectM/ProjectM.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libprojectM/ProjectM.cpp b/src/libprojectM/ProjectM.cpp index 1454bc575..d3eeca823 100644 --- a/src/libprojectM/ProjectM.cpp +++ b/src/libprojectM/ProjectM.cpp @@ -138,18 +138,6 @@ void ProjectM::RenderFrame() return; } - // If no preset is active, load the idle preset. - if (!m_activePreset) - { - LoadIdlePreset(); - if (!m_activePreset) - { - return; - } - - m_activePreset->Initialize(GetRenderContext()); - } - m_timeKeeper->UpdateTimers(); m_beatDetect->CalculateBeatStatistics(); @@ -176,6 +164,18 @@ void ProjectM::RenderFrame() } } + // If no preset is active, load the idle preset. + if (!m_activePreset) + { + LoadIdlePreset(); + if (!m_activePreset) + { + return; + } + + m_activePreset->Initialize(GetRenderContext()); + } + // ToDo: Encapsulate preset loading check and transition in Renderer? if (m_timeKeeper->IsSmoothing() && m_transitioningPreset != nullptr) {