Add .properties config support and audio device selection#17
Open
monsterwendy wants to merge 6 commits intoprojectM-visualizer:masterfrom
Open
Add .properties config support and audio device selection#17monsterwendy wants to merge 6 commits intoprojectM-visualizer:masterfrom
monsterwendy wants to merge 6 commits intoprojectM-visualizer:masterfrom
Conversation
Adds support for loading projectMSDL .properties config files used by the C++ SDL frontend, making migration to the Rust frontend seamless. Changes: - New properties.rs module: parses .properties format in two passes (window.* keys first, then projectM.*/audio.* keys) - Settings struct: added audio_device, shuffle_enabled, transition_duration fields - Config struct: added shuffle, transition, audio device, window geometry fields - Audio: implemented device selection by name (exact match, then substring) - App: window size/position from config, audio device name passthrough - Auto-detect .properties extension via -c flag alongside .toml/.json/.yaml Property mappings: projectM.presetPath -> preset_path projectM.shuffleEnabled -> shuffle_enabled projectM.transitionDuration -> transition_duration projectM.displayDuration -> preset_duration audio.device -> audio_device (SDL device enumeration + name match) window.* -> window geometry config Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…t_duration Three related fixes: 1. Remove default_value = "10" from --preset-duration CLI arg (and "1.0" from --beat-sensitivity). These defaults caused Settings::apply() to always overwrite file-loaded values with CLI defaults, ignoring .properties config. projectM's library defaults apply when neither CLI nor file specifies a value. 2. Reorder apply_config: call set_preset_duration (and set_soft_cut_duration) BEFORE play_next, so the correct durations are in effect when the first preset's timer starts. 3. Map projectM.transitionDuration to set_soft_cut_duration (crossfade blend time), not set_preset_duration. Rename Config::transition_duration to Config::soft_cut_duration to match the projectM API semantics.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for loading
.propertiesconfig files — the format used by the C++ SDL frontend (projectMSDL) — so users can migrate from the C++ frontend without rewriting their config.What's new
.propertiesconfig file support (src/properties.rs)-c config.propertieskey: valueformat used by projectMSDLwindow.*keys first, thenprojectM.*/audio.*keysProperty mappings:
.propertieskeyprojectM.presetPath--preset-pathprojectM.shuffleEnabled--shuffle-enabled(new)projectM.transitionDuration--transition-duration(new)projectM.displayDuration--preset-durationaudio.device--audio-device(new — see below)window.width/height/left/topAudio device selection (
src/app/audio.rs)--audio-deviceCLI flag /PM_AUDIO_INPUTenv varPreset path fix
playlist_play_next()so presets from the configured folder start playing right away instead of waiting for the first transition timerWindow config (
src/app.rs)New CLI flags added to Settings:
--audio-device/PM_AUDIO_INPUT--shuffle-enabled/PM_SHUFFLE--transition-duration/PM_TRANSITION_DURATIONREADME updates
.propertiesformat usage exampleExample config
A Windows projectMSDL config file can be used directly:
Test plan
.propertiesfile loads correctly (unit tests insrc/properties.rs)cargo testpasses.toml/.json/.yamlconfig still works