SlotFX add rearrange Method along with swap

  • @Christoph-Hart Is it possible to add a re-arrange method for the SlotFX based on an array that contains all SlotFXs?

    The swap method is quite limited when you want more than swapping. I need to re-arrange FXs by drag and drop, and it's easy to swap back and forth when you move an FX in the chain. However, if you move several FXs and save the preset, it becomes hard to re-arrange all the FXs at once on preset load. (maybe with a double for loop that checks all FXs one by one against all the others, but you need to know the names of the FXs that are already loaded)

    It would be possible to use exportState/restoreState along with clear and setEffect, but I would lose the benefit of swapping dynamically (the sound will cut).

    but the re-arrange method has to come along with another method that gathers the FX names which are actually loaded in the slots, so a name comparison would be possible between the two arrays that contain preset FXs order, and actual FXs in slots. (based on the part of the character chain that is not overridden at init of course).

  • @Christoph-Hart In fact, after hours trying to do something, just being able to know what FX is loaded in a slotFX would be sufficient, no need for an extra re-arrange thing...

    Aside of that, how is the scriptFX managed in slotFX? If I have more than one scriptFX loaded, how would I make the difference if I want to swap them?

  • If you use a unique ID for each ScriptFX, you can have multiple ones with the same type.

    Getting the ID of the currently loaded FX is a sensible suggestion, I'll try to add this when I find the time.

  • @Christoph-Hart Cool for the scriptFX 😉

    Getting the ID of the loaded FX is the only thing that prevents me to make multiple FX swapping operational 🙃
    In fact, it is working, even with preset load, but it's an async operation because it's based on the precedent movement, not the actual state. So if an error appears, it's impossible to check the current slot state so you continue swapping in a total disorder 😬

  • Alright, I've just pushed this. I didn't add a getID() function, but a getCurrentEffect() which might be more versatile for future use cases (you can bypass it, or change parameters directly). If you want the ID, just call the method on the returned object:

    const var EffectSlot1 = Synth.getSlotFX("Effect Slot1");
    /** Returns the ID of the effect in the given slot. */
    inline function getIdFromSlot(slot)
        local fx = slot.getCurrentEffect();
            return fx.getId();
        return undefined;

  • @Christoph-Hart Wow thanks, man! Gathering the current FX is cool! 😎

    But sorry, there's still something I don't understand with script FX in the context of swapping.
    How would I differentiate between two different scriptFXs? Because the ID is reset at init, and "getCurrentEffect()" will return the same thing.
    My FX chain will almost only be made of home-made DSP in ScriptFXs...

  • @ustk said in SlotFX add rearrange Method along with swap:

    Because the ID is reset at init, and "getCurrentEffect()" will return the same thing.

    If you restore the scripts using a Base64 encoded state, it will retain the ID (even if the ID is actually stored in the state).

    So if you have only Script FX, just don't use setEffect but ScriptFX.restoreState with predefined states.

Log in to reply