Collection-wide user settings

Hi!

Some users have asked if I could add a swappable dark mode to my plugins. Sure, probably!

What I’d like to do, though, is to have a user who selects that dark mode for my suite select it for the entire suite. So if you do RMB/Dark-Mode on my chorus, my oscillator gets it too. So what I want to do is save a settings file which is 1:1 with plugin.json, not 1:1 with the modules therein.

Surge actually already has a mechanism to do this and I could just use it. That will create a ~/Documents/Surge directory and store settings there. So I have a solution but it doesn’t seem very rack-y

I read the SDK also. Seems settings.hpp is for the engine, to/from json on a module is the wrong arity since I don’t want something a a module level.

I could roll my own where I just dump some asset into asset::user( "surge-settings.xml" ) (probably re-using the surge user prefs mechanism with the path changed to that location) but before I do that wanted to ask if there’s some obvious thing I’m missing about how to tackle this.

Thanks!

I haven’t looked yet how to do that, but you can check @marc_boule‘s plugins how he solved it for Geodesics and Impromtu.

1 Like

Plugins may create one file or folder called <plugin slug>[.extension] in the Rack user directory. So don’t use ~/Documents/Surge/, use <Rack user dir>/SurgeRack/ instead, or asset::user("SurgeRack").

1 Like

Ok cool so use the current surge mechanism with the asset user path. That will work. It’s also how I dealt with wavetables and stuff.

Thanks for the quick reply. Just wanted to make sure I wasn’t missing another approach.

So I recall seeing a more recent post than this about a better way to save collection-wide user settings, but I can’t find it right now. Am I imagining things?

Here’s the post:

A consideration following that advice is that when troubleshooting plugin/patch woes, deleting the settings file is a common voodoo people advise others to apply, which of course gives your collection complete amnesia.

Depending on your plugin, especially if it’s one prone to causing Rack to crash, maybe that’s a good thing ;-).