Proper referencing of my effects in the Effect Slots
-
Hi everyone,
I am working on a swappable effect chain with Effect Slots, and everything works great so far, except saving my chains in the presets.
I have "Hardcoded Master FX" in almost all slots and separate panels for each effect with the controls. The effects are referenced separately:
const var EffectSlot1_HardcodedMasterFX = Synth.getEffect("EffectSlot1_Hardcoded Master FX");
and then I use this reference for the control callbacks.
I use "Engine.addModuleStateToUserPreset('EffectSlot1') for all slots.The problem I am facing is that if I save some presets with different chains, and then reload those presets, it gives the error message:
EffectSlot6_Hardcoded Master FX does not exist.The reason is that if the effect is changed in the slot, the reference is also broken because it automatically renames the beginning of the effect name from EffectSlot1 to EffectSlot6 for example.
Maybe I'm just using the wrong method, but any help would be appreciated.
Is there any solution to make this work?
Thanks!
Gabor -
@Gabor-K said in Proper referencing of my effects in the Effect Slots:
Engine.addModuleStateToUserPreset
This function saves the state of the EffectSlot module itself to the preset, so loading a new preset should call it's state and whatever network you have loaded into it per preset. Your Fx network (the .xml) remains the same in all cases (there shouldn't be any renaming here).
I recently made a similar mistake and it may help if you share a snippet, but how I came to think about it is your UI should reflect changes happening in the modules. Start from there and update the UI accordingly.
How I ended up approaching this was to make a series of panels (with sliders, buttons, other components, etc.) linked to the state of the Effect Slots (ex. Panel1 == EffectSlot1).
First establish a method for loading networks dynamically into the FX Slot (
getCurrentEffectId, setEffect, swap,
the SlotFx API is your best friend here). I personally developed an "Fx Browser" from a panel to do this, but you could just as well use comboboxes. You then proceed with updating the components in the corresponding panel (getParameterProperties
).You could either use a timer or preferably a broadcaster to update the components that exist in your Panels. Conversely you could make panel templates (Panel1 is for your Compressor, Panel2 is for Reverb, etc.) and call those up when loading a network into the EffectSlot.
My first prototype involves the former method, where I used a timer and panels linked to corresponding EffectSlots. The panels were populated with just sliders.
I made a json archive of the FxNetwork macro controls based on each effect network (assigning them ID numbers for their order). Then I would update my UI sliders (with the timer) based on the network loaded, the id tag of the macro control, and the FxNetwork's macrocontrol (JSON) parameters. (
ScriptSlider.setPropertiesFromJSON( var jsonData)
).If you find a better methodology than this I would highly recommend it. There are two major disadvantages:
-
It was quite tedious to extract the JSON data for each effect network, and their probably exist a more streamlined approach to this.
-
The timer is highly inefficient since it is constantly checking the state of x amount of sliders, x amount of panels, and x amount of EffectSlots. A broadcaster is definitley the way to go here.
My second prototype I am working on is to create panel templates based on the effect and to call these when a network is loaded into a specific Effect Slot, using a broadcaster.
Not sure if this answers your inquiry directly but hope it helps in the development of your network.
-
-
@HISEnberg
Oh, I thought there is an easy way, and I'm just overlooking something.
Nevertheless, thank you very much for your tips! I will do some experimentation to see what can I achieve. -