Switching sample maps with radio buttons.
-
@lalalandsynth said in Switching sample maps with radio buttons.:
@andioak I think you can tidy up and just use this to get the array.
const var Buttons = [Content.getComponent("0Btn"), Content.getComponent("accBtn"), Content.getComponent("soloBtn"), Content.getComponent("orchBtn"), Content.getComponent("organBtn")];
If you rename your buttons you can do it in two lines.
for (i = 0; i < num_buttons; i++) buttons[i] = Content.getComponent("button"+i);
-
@d-healey I dont need any different fx or modulators , so this is perfect , will have a look at this , thanks !
Btw , is it then possible to switch without any interruptions ? -
@lalalandsynth said in Switching sample maps with radio buttons.:
Btw , is it then possible to switch without any interruptions ?
Yep
-
@d-healey Awesome , redesign time !
Finally understood the Defer script thing as well .Thanks mate !
-
ok, So I have set the instrument up with velocity switching but a bit unsure of how to implement the buttons since I am not using the keyswitching , should I set up 4 buttons in the Midi processor On Init and then link to those buttons for the main interface or do I do the whole thing from the main interface script ?
not sure if this is the right approach ?
-
Your interface script is non-realtime, so it can't change the velocity of incoming notes. So your first idea is right, you need to add 4 buttons (or a slider pack) to your velocity changing script, and then link the interface controls to them.
-
@d-healey This seems to work , wonder if you could have a quick look and see if I am breaking any practices here ?
HiseSnippet 3261.3oc6bszbbabDFKIgkHsoSriSUtRkTEJ5KTkUTviAO1njxjbIoLiIEYQJq7vQkJncGRhHr.aAfkRLpzkbH+Kx+gbLGyOgbLGyOAeOGRlAOVLX3vkX6rijcRVxCKlA8L82zyzS2eCVbTRbebZZbhRmkezkivJcdO0StLJ67dm6GDor21zBReQPV+yChNyQYqKG4mlhGnzoyhOfdGcVdIk7Oe8mskeneTebcQJJONNnOd+fgAY0kdzFeQPX3t9CvOJXHyci1Xu9wQ8hCiGSzlEU0UF42+49mgenO81VPUoy6ryffr3jSx7yvoJcVZq3AWdx4wuHp39ebPZvyBwzKLTNgzPEEuab3.pFS+tRuyCBGbTEpSUHM5Q0iAKVLF7QpGDLHXR40iEe27Jzpkfc7nyBSS8L.pdcXTukJTuOP8j9IAixpqgpauq5dQY3jS8Il.V0p3dUV3et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f3s3J7HoaZCzag7v0b3QKzTWb17sviQav0OCBt.40v1nYphFtVP8ZHQfAwhgZtukogAzyHPZyD2ET.t7FLwjk0hyIPd3Bxdxbj.ZpKbhXaNq.oMQD14Ezkyf4X.8g3Uh.Cz4j5vYwLrAdlARalHjyMv1tI+EF1lV.O2.4gKPO2AHN6kNzyNPZSDAd9ANbFLOGfmefDA1rawHwXzbOLccg.qMmgfzlIB4bDr6xsByAA8bDjGt.EygN2JLOnOrrRCWfNOAt4gFN1t.OOA4gKP6fwYuL7zAdlBRywArGhVilKvz6Z5A7bEjHvf7j+XXyk2rvmEv1b1BRalHnGpVGNFoLMLAd9BxCWf9A3v4o20AA7LFj1DQXOjsH9fesg9KkRh.CxJLDeThB+Qg1lyZPdLtAIlCGKtmJZ5ONTleG02t32Q8OP8AgwOyOr9WScbTlePT4abqeTY0ZSpWaxMLs23c+s4+a7N92qWy76eLQ+bs6rzagWOZy+e36euqXlR++uRF9V2qjg2Du5.dSzGC86mD+z9Eu+cnKxtcdIDbGk6DbY0CnWqM4kTrpp98zUFRVb8z98oC2+Xx3iXYLAHiE.YP.jwFfLN.jwEfLdSUFpesMGmEOrXoHofi1o3MJQmIaxzYQk+8dgUgd
Also, Say I need to change the velocity switching for 3 samplers in a synth group at once...do I duplicate the code from the Midi script in each sampler or can I do it in the midi script for the group ?
-
It looks fine, but I have some suggestions. I'm just putting a snippet together.
-
@d-healey Just noticed that it does 2 switches ...one for the button it is turning off and one for the button that is turned on , which makes sense I guess but could be fixed ...hmm. Console print reveals this.
It does not have any effect as such as the one it it turning off is the one selected already but might be a performance issue.
-
This is probably how I'd do it
HiseSnippet 3031.3oc6b0sbaabEFPRH1hINsIMclLcZmAiyMTQpp3mE+vwoSjDkjsZjr3H539iqGOvjqDQMH.GPPaq5wuF8t9NzK6kc5SPeD5iPdCZ2E+PrXEjB3oZscRptQb2EKv4a+NmydNmkD8hiFfmNMJVRd0Gb9Drj7Gnz+7vjQcG44GJcvtzNl9B+jAi7COyVZ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7ZXoWMUQcGSndMDHvfvXnp6aYnqC8LBDll39fBvkmvpuXYM3bBDGtfrmLWQ.MzpUQrImUfvTDgcdAc3HLacneIdEHv.cNo1bLltEvyLPXZhPN2.Kqp0uP2xvD34FHNbA56c.hiuzfd1ABSQD34GXyQXt1.O+.ABrEmwHwXTcOLMsZAVSNCAgoIB4bDr5vYgYifdNBhCWfh4PiyByE5WVVggKPmm.mdntskCvySPb3BzNXb7ktqFvyTPXNNf8knUupAlVGCWfmqf.AFju4O5Vb4MW62Evlb1BBSSDzWpVatJRYna.77EDGt.8CvgySuiMB3YLHLEQXeIaQ7A+ZA8WJk.AFDKLDeTh09iBsIm0f3p3FjXNrM49VQS+wgx76n9lY+Np+YJ2MH5odAk+ZpiBS77CyeC97KxGVc93pyufq5sl0+55+slE+6InUZ1a6fuk2Oqq7N8qO1l9Ce+mbAZZ5++Uxv24dkL7l3UGvahmwXuAwQOYP16eGpQ1MS6gf6vTmfqpbDss57W5OJJZapIMlXb8jACnK2+Rx5S8yw.vbLALGDf4XAXN1.liCf43dkyg5Wa6YIQiyLEIczaur2nDxy2jQdYo+KPMeIr.�
-
@d-healey said in Switching sample maps with radio buttons.:
Yep, that is much,.....much neater :)
Thanks !EDIT: is it safe to have a loop in the Oninit of the midi scriptprocessor ?
Also, what is the exec for in this.
velocity.setAttribute(exec("velocity").button+index, value);
-
is it safe to have a loop in the Oninit of the midi scriptprocessor ?
Yes, the
init
callback is not real time so we're safe there.Also, what is the exec for in this.
My secret sauce :D It executes strings as if they are code. I posted a video about this on Patreon a few weeks ago.
-
Actually the secret sauce isn't needed here, I was trying something else and left that in by mistake. :p
-
@d-healey This is turning out pretty smooth .
Btw I am using the Midi processor at the top of a synth group , works very nicely and switches all samplers in the group. -
@d-healey found a small problem with this , I am now velocity switching a synth group with the buttons and that works perfectly , but when I recall presets , it loads the correct button but does not do the switching ?
I can see it also switching the buttons in the Midi processor.I can also see that it always goes to the sound represented by the last button ?
BTW> same thing happens with my earlier version of the script ?
Any ideas ?
-
When the preset is changed you need to update the variable that tracks the velocity offset.
-
@d-healey How can I track when a preset has been changed ?
-
All control callbacks (for controls that have saveInPreset enabled) are triggered after a preset is loaded.
-
@d-healey This seems to have solved it.
reg mapSelector = 0; const var maps = [0, 2, 4, 6]; const var buttons = []; for (i = 0; i < 4; i++) { buttons[i] = Content.addButton("button"+i, 150*i, 10); buttons[i].setControlCallback(buttonCallback); } inline function buttonCallback(component, value) { **if (value == 1) { local index = buttons.indexOf(component); mapSelector = maps[index];** } }