frontend-sdl2
frontend-sdl2 copied to clipboard
Prevent Application Crash when Numeric Config Entries Contain Dynamic String Interpolations
I figured out how to run a separate instance of the visualizer on each screen by leveraging dynamic ${application.argv[n]} options in the projectMSDL.properties file, however this was causing the GUI to crash as it expects to read integer values for the screen, width, and height fields. This change prevents the GUI from crashing, ignores the setting, and logs a warning about the errant property.
There is also a change renaming a reference from a "device" property ⇒ "audio.device", this may be incorrect but the application seems to accept it and it's consistent with appearances of "audio.device" elsewhere in the repository.
This PR allows me to... (toggle pattern)
killall projectMSDL || (projectMSDL 1 2560 1440 & projectMSDL 2 1920 1080 & projectMSDL 3 1920 1080 &)
...with properties...
window.monitor = ${application.argv[1]}
window.width = ${application.argv[2]}
window.height = ${application.argv[3]}
Running 3 instances seems lightweight enough, my rig isn't even breaking a sweat at ~5% CPU usage, GPU load is ~35% on an RTX 3090.
This PR allows me to... (toggle pattern)
killall projectMSDL || (projectMSDL 1 2560 1440 & projectMSDL 2 1920 1080 & projectMSDL 3 1920 1080 &)...with properties...
window.monitor = ${application.argv[1]} window.width = ${application.argv[2]} window.height = ${application.argv[3]}
Revisiting this PR, and just realizing: why taking the complicated path via the config file and not simply use the proper command line arguments? It's slightly more verbose, but will exactly do what you want:
killall projectMSDL || (
projectMSDL --monitor=1 --width=2560 --height=1440 &
projectMSDL --monitor=2 --width=1920 --height=1080 &
projectMSDL --monitor=3 --width=1920 --height=1080 &
)
You can also use --left, --top and --fullscreen/-f to further control the window position. I'd also point out that passing additional arguments like this will most probably be interpreted as filename (e.g. presets/playlists) in the near future, so that approach will then stop working anyways.
Run projectMSDL --help or use the in-app help menu to see a list of supported command line arguments. Most configuration options can be set/overridden.
Thank you for all the helpful feedback! I will revisit this via your latest comment (above) and see if I can achieve the same goal.
No further feedback since June, so I'll close this PR for now as the external approach mentioned above is probably the easiest way without requiring code changes.
If you feel that there's still something missing, feel free to open a new issue or PR!