Can you control module presets with buttons?

  • Does anyone know how you could get a module to turn to specific settings with the press of a button?

  • @Eskano sure you can

  • @Eskano

    simply set the attributes you want to the values you want in the button call back

    HiseSnippet 1185.3oc2W0raaaDDdojYQkbkQSQPQORXzCx.tJTo1oAnnvxV1JPnV1BRNI8V5ZxQVKL4trKW5V4f.zK8gH25g9Rz2h9Jz2f7FzNK+whLgvPRs0EHjW3N+r6reyLe6xgRgCDFJjDiZmMK.HFej43Yb0ztSoLNo+gDiMLGPCUfzJQzAyBnggfKwvn5SzBLpsFI94M6c.0ixcf4hHjmIXNvwLelZtzgc9VlmWOpKbFyOm06zouif2U3Ihv3opoMIf5bI8B3Dp1rJlDiO3HWlRHGqnJHjXr1AB2YimJ9Qdh8OiExN2CzCZSFiSTh3dBOWcDq+lzcJyycX19NjPLLGNGEplfB22b.ykci74nwGGqvZtG4wCiJ2V30dECOibg2ZIg28LG6HYAp4Zzw15l84XhZBESA4CqDaIU9kJlcEnEbUKe5kPOIN3FOZ9Ha6ss101dqutQ8F0wDQnx5JpzZLyOvCFAWAxyaa8MVwkGst.TGMYB3nZtYhAVoVrYh+5WF2iwAqIQbGESvsD7ChTJAusNJjBulNB+.AGimswUxKB1pQ8W1ndsG7fF0svmBqbqPPsuRIYmGoflEUMRH7GytF11t0t5keob94f5X7SOz4GuzNenbVlyOb4cl5Gv3WrskcqczN+pXjKKEgHb2L7o4loH2laomvT7qK0y6brCo4aCr5IKGpehPAmxatU8WVuV8WU25sUMYRo5RmLOPVpZcuq71brIOx+bPlkayLDKhK1kr9h0k3jfK4LTv6yYpSCfzwy6iz5R10YZsI2rYyKZ9dLuz3sVIlMWz61lRRya3WOs+gTEU24lJCsK.jJld2ZbHbERIlzGWy7PH7RkHH11zjMxxoh0tQZWdRxkvb0NjloI+zM7leuemY2L3mGzIjdEzmOTBXkht8mENP3iyKUhlYTg7tzIHolvMxipJxzoo2SUfI1BTJZZCdHSMKO8+RP+YWJ8W6xv0ELbum4PlxYZ4wakRhWL+7ec7ldXRCyDpx4A6Zl89t63SNROdGqoxwAklnKxfWHvxnVSwsN+40+1do7V4gxLRz7xx3FyWh7blqZZdi5IA3Z.yZYqvu95W+66YTsHbTcwfiRxFiDQJLVGPQJXrkw7jH+w30Kb.LYv4fGN4lXOg103w15w5.aLvciG7W3Spx15wFoJamoLeFeiDTdcDR4P7IkwP7mFO154Xmo0S.NH00tsuk6R8GK5coBV36RcpiBW9yjTdXfHrvDOF7YmgbOg4E9zP7FBvOLR2LkWdWAUVpp2rWObSVpOiopHYbW499hHtpPWX0UpzuH4TN6KoOXs+Gtf2+9Lb+yIjqtXg6hwjjQabDG6wwy2hiwOAOPaBMxSkIsXQ9.AWDLUvYN4q.FAXy4EW.x7wdoaH7lT38clK49cFAd.Me07m24XrJjJyQorrXQ6EGKts70mYlDtV5NSq2ONHs56QGjtDgxcwoH2EqgO0QJdgSxsY00xeXrDbeyi+E6Z3+5iisZShuyN5mocKahOxH9BGGMb+EH9TtOObE74KWAe1YE7Y2UvmGsB97UqfOO9V8QeXz9QJgeRqHJX3Qw+cggwQbJVIGW0S9avj8+L+

  • @Lindon Thanks a lot for that. Really helpful script!

  • @Lindon Awesome mate! I've been trying to do this for a while. You hit the nail on the head there. Thanks man!

    I'm experimenting now... I want to try and find a way to make a combo box drop-down menu that will do the same thing. So we could have separate drop downs to change the reverb or delay presets and not have to change the main preset. I'll have a play now and share the code if I manage to work it out!!

    Any advice to make the task a bit quicker though would be mega appreciated. This is my first time back in HISE properly coding since December so I'm a little rusty

  • There's a function (if I'm not mistaken) that is intended for that purpose. You directly save and restore a module's state. I've never tried it though...

  • @ustk That could be pretty useful. I'll have a play around with it. Cheers mate.

  • @SteveRiggs Just tested and it works nicely. Although I can a benefit only for "behind the scene" modules. If the module is controlled by UI, there no need for this function as you have to restore the controls anyway as @Lindon did above, and so is the module consequently.

  • @ustk Awesome. I'm still trying to work out how it would be done using a combo box with a list of presets inside instead of buttons 🤔

  • @SteveRiggs I haven't had a look to it but my guess is (if you have multiple values to recall):

    • Store the values in a 2D array
    • Recall them with the ComboBox index and a for loop

  • @ustk Thanks man! I had a feeling it would be an array of some sort. I'll try and work out how to set up a 2D array and a loop 🙂

  • @SteveRiggs A quick tip:
    You don't necessarily need a for loop, in fact it depends on your structure...

    array = [[val1, val2, val3],
             [val1, val2, val3],
             [val1, val2, val3]];

    then read it like this in the comboBox CB:

    module.setAttribute(attribute, array[value - 1][0]);
    module.setAttribute(attribute, array[value - 1][1]);
    module.setAttribute(attribute, array[value - ][2]);

  • @ustk Ahhh! It's starting to make sense now. Thanks mate. I'll try a few things and see how it goes 🙂 Much appreciated!

Log in to reply