From ddbf20a23b20c006b8a52fd3739ae9351a72d191 Mon Sep 17 00:00:00 2001 From: discordianfish-bot Date: Fri, 13 Nov 2026 09:57:37 +0100 Subject: [PATCH] Fix default configuration path and mesh size fallback on Linux The default configuration directory was computed from PROJECTMSDL_CONFIG_DIR, which is never set, so it resolved to the install prefix instead of PROJECTMSDL_DATA_DIR (share/projectMSDL), where the configuration file is installed. projectMSDL never loaded its default configuration and ran with built-in defaults, without a message saying so. It now logs a warning when the file isn't there. Without a configuration, RenderFrame() set a 220x125 per-pixel mesh, while initialize() and the property change handler use 48x32. Since RenderFrame() runs every frame, 220x125 won. The per-pixel code runs once per mesh cell on the CPU: on a Raspberry Pi 4 with 40 sample presets, that was ~38 ms of CPU time per frame, against ~6 ms at 32x24 and ~8 ms at 64x36. RenderFrame() now uses 48x32 as well. Co-Authored-By: Claude Opus 5.5 --- CMakeLists.txt | 2 +- src/ProjectMSDLApplication.cpp | 4 ++++ src/ProjectMWrapper.cpp | 6 +++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3ee70505..e9b24bcf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux" AND NOT ENABLE_FLAT_PACKAGE) set(PROJECTMSDL_DESKTOP_DIR "${CMAKE_INSTALL_DATAROOTDIR}/applications" CACHE STRING "Directory to install the .desktop file in, relative to the install prefix.") set(PROJECTMSDL_ICONS_DIR "${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor" CACHE STRING "Directory to install the icons in, relative to the install prefix.") - GNUInstallDirs_get_absolute_install_dir(_config_dir_abs_init PROJECTMSDL_CONFIG_DIR DATAROOTDIR) + GNUInstallDirs_get_absolute_install_dir(_config_dir_abs_init PROJECTMSDL_DATA_DIR DATAROOTDIR) set(DEFAULT_CONFIG_PATH "${_config_dir_abs_init}" CACHE STRING "Optional path to look for the configuration file in addition to PROJECTMSDL_BIN_DIR. May include POCO variables like \${application.dir}.") set(DEFAULT_PRESETS_PATH "${_config_dir_abs_init}/presets" CACHE STRING "Default presets path in the configuration file. May include POCO variables like \${application.dir}.") set(DEFAULT_TEXTURES_PATH "${_config_dir_abs_init}/textures" CACHE STRING "Default textures path in the configuration file. May include POCO variables like \${application.dir}.") diff --git a/src/ProjectMSDLApplication.cpp b/src/ProjectMSDLApplication.cpp index 3d12e582..b71373a4 100644 --- a/src/ProjectMSDLApplication.cpp +++ b/src/ProjectMSDLApplication.cpp @@ -77,6 +77,10 @@ void ProjectMSDLApplication::initialize(Poco::Util::Application& self) { loadConfiguration(configFilePath.toString(), PRIO_DEFAULT); } + else + { + poco_warning_f1(logger(), "Default configuration file %s not found, using built-in defaults.", configFilePath.toString()); + } } } } diff --git a/src/ProjectMWrapper.cpp b/src/ProjectMWrapper.cpp index f176a348..abe8f856 100644 --- a/src/ProjectMWrapper.cpp +++ b/src/ProjectMWrapper.cpp @@ -163,10 +163,10 @@ void ProjectMWrapper::RenderFrame() size_t currentMeshX{0}; size_t currentMeshY{0}; projectm_get_mesh_size(_projectM, ¤tMeshX, ¤tMeshY); - if (currentMeshX != _projectMConfigView->getInt("meshX", 220) || - currentMeshY != _projectMConfigView->getInt("meshY", 125)) + if (currentMeshX != _projectMConfigView->getInt("meshX", 48) || + currentMeshY != _projectMConfigView->getInt("meshY", 32)) { - projectm_set_mesh_size(_projectM, _projectMConfigView->getInt("meshX", 220), _projectMConfigView->getInt("meshY", 125)); + projectm_set_mesh_size(_projectM, _projectMConfigView->getInt("meshX", 48), _projectMConfigView->getInt("meshY", 32)); } // Add new audio data to the instance from the staging buffer