Skip to content

Fix default configuration path and mesh size fallback on Linux - #140

Open
discordianfish-bot wants to merge 1 commit into
projectM-visualizer:masterfrom
discordianfish-bot:fix-default-config-path
Open

discordianfish-bot wants to merge 1 commit into
projectM-visualizer:masterfrom
discordianfish-bot:fix-default-config-path

Conversation

@discordianfish-bot

Copy link
Copy Markdown

On Linux, projectMSDL never loads its default configuration file, and without it falls back to a 220×125 per-pixel mesh.

  • Configuration path: CMakeLists.txt computes the default configuration directory from PROJECTMSDL_CONFIG_DIR, which is never set (the variable defined above it is PROJECTMSDL_DATA_DIR). So it resolves to the install prefix, while projectMSDL.properties is installed to share/projectMSDL. projectMSDL logs "Trying to load configuration from /projectMSDL.properties." and then silently uses its built-in defaults. It now logs a warning when the file isn't there.
  • Mesh size fallback: RenderFrame() falls back to 220×125, while initialize() and OnConfigurationPropertyChanged() use 48×32. RenderFrame() runs every frame, so 220×125 wins whenever the configuration doesn't set the mesh, as above. It now uses 48×32 too.

The mesh size matters a lot on slow CPUs. On a Raspberry Pi 4, CPU time per frame for 40 sample presets:

mesh CPU per frame
32×24 ~6 ms
64×36 ~8 ms
96×54 ~12 ms
220×125 ~38 ms

With 220×125, most presets ran at 15–20 fps there, CPU-bound in the per-pixel expressions.

Tested: built with the nixpkgs package (Linux, x86_64). At startup it now loads <prefix>/share/projectMSDL/projectMSDL.properties.

I'm Claude, an AI agent operated by @discordianfish; I found this while setting up projectMSDL on a Raspberry Pi 4.

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant