How do you change the 'SaveInPreset' by using code
-
@LeeC My initial thought is to duplicate the controls, have one set that has saveInPreset set to true and is visible on initial load, and another set that has saveInPreset set to false. When the instrument first opens you set both sets of controls to have the same values.
When the user loads a preset you can check the status of the lock button. If it's locked then you show the controls with saveInPreset set to false which should contain the previous settings.
There might be a better way but that's the first thing that came to mind. Try your method too and see if you can change the saveInPreset state on the fly. You need to provide a string as the first parameter to the
set
function. So it will be something likemyControl.set("property", value);
-
@d-healey Yeah I'm struggling to control the 'saveInPreset' value on the fly but really like the solution that you've come up with. Would never have looked at it that way!
How do you check the status of the lock button when the user loads a preset?
Is there an 'engine' function that can be used or something.
Thanks again
-
@LeeC Put
if (lockbutton.getValue() == 1);
in the control callback of one of the controls that has saveInPreset set to true. -
@d-healey I've had a go at this but I've hit a dead end trying to figure this out
Was excited to try the 'duplicate controls' method that you mentioned but couldn't get the two slider pack arpeggiator controls to work independently using a 'lock button' as the slider pack that has savedInPreset disabled will always reflect the current state of the arp.
If you could take a quick look at this code snippet I would be eternally grateful. You've helped out this community massively and we always appreciate you time.
Thanks
HiseSnippet 1639.3oc4XsraabCEkikYPjRThcPPetYfQQgMZhfjyi9HHHRxRNP0uTsbbypFLZFJIBOhbxLbbrZP.5GPWzOg9Kz+frua5eP+E7xhtw8RNijnrdjwpMAEsyBAMWx68b3kWd3PV2maSBB39HizGzyifLtJtQOlnyFcrnLTsJHiqfK46sM29Hy0Qk64YEDPbPFFodrrCFoWDodN8QksbsX1jglPnC4Tax1ztTwPq0KtE00cSKGxAztZ89tEqYyYavc4g.YRgyi7rrOxpMYWKY2V.iLtTUGpf62PXIHAHiEKyc50nC+Ern9eHMf1zkHeo.pADnHyaxccjLVZEsQGpqS89C5.Dx.WeXJHUTJ3l3cnNzA1GlJVR0f4POzyGFKLK5UPmd4SN8VPidKFQukwMr8odhgsDMMUiIH9srfo.cZE0WzB+tAdCNzClHWWqiHa5CuLviUue972x7d4yu1CxlIaFXhHPXdrkuYCWpCwuNLSTv7gl8CPah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wsAwkXKkmdyEFSLPuOduPgWn3envsLdm5UAIP+9AbrTPBK8utLPUYNSIL4KhF+vKvQn3NgtRsY8yUIOLYbCvG6Nhns7PJr.nBQej9V4vVIktKiqSE1clLeWXB7U9cxuk46fsCq1pETcLjrKh27ou8OmpNUtVDU.sU3rbpKSPQj2S8t42BZblOlvH9iu+7nWovukzqTvKwWoPjD6A9Vr.OdvHAtutWftwmD.GTl778kyxi946V9SroSezlvfbh9zvRD5qJWJ0kGxDiTdjJwyIWfq1Xw+Ue0Fu6DGRkL5NgLnQ8wteLPIj10ykTkcLryEXQxwa.mWrkUnqnu0Qqq2gy3dc3Lps9j99DgOscahuN2m3.pjPH2oZfkaVbeXO.K8B3Oo31PgmkOjmHyYtnPxyEyZ95CvQz0TtXz7+Fh5o9+on997P4kYriETnJO2o73CfVJ7otQ63KukIiEj5gQumGEc3cPLk4nd4L3ItwBx2MharP+FemfQWKae9yri9lFYs7kUVfwMSc4xow6He2bvESgw4ykG0ETDelssLceaH+LYeVeN74NygO2cN74dygO2eN74ymCe9hY5ibynRgBd2nkhfg5UitUKipLKnRVU0i9KGaimXA
-
I've probably misinterpreted your method to be honest.... Would be ace if you could steer me in the right direction.
Assuming this is all possible to do in HISE that is
-
Ok I played around with it and had to make a few changes to my initial idea, but it works.
Firstly the lock button needs to have saveInPreset disabled, otherwise it will reset to however the preset was saved and then it's not going to work.
I've never used the arpeggiator before so I didn't realise the sliderpack connected to it via processor ID. A control can't have both a callback function and be connect by processor ID, it's one or the other. So I removed the processor ID on sliderpack2 but kept it on sliderpack1.
So now sliderpack1 controls the arpeggiator and sliderpack2 controls sliderpack1. This means we can hide sliderpack1 all the time, we never need to see it.
When you make a change to sliderpack2 it will be passed on to sliderpack1 through the control callback.
Now the last piece of the puzzle. We need a control that has saveInPreset enabled so that when the preset is changed we can check the lock status and update sliderpack1 or sliderpack2 as needed. For this I added a new button called btnTrigger. You don't have to do it with this control, if you have another control that is more suitable you can use that, you could also do it in a timer but I prefer using control callbac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Fkm7CJbhl6Pu7Q6AKx4pSGGQRjJcY5agBoG49kngcq9aP+D+4e21O8hC4xFcmiGzt8LMkFpDRCB8IMYmAmbARjb7NvWv1yIwWLT5j40GvY7vAbF00LneDQjdiWCtO2ETCgPdR0HIuc8ify.bLSf+C02GR7bh.+DYI8E0xtuXQwq2EooKVtYD++FE0y8+mE0OhmHauxANPhJ7UYpOe.pkBW0UehuruW1qHqGpeup7ccwTlm5kWAOoCVS9tc5f0FN3uJXD33Fw+lzFMKykuoRBrtYp+iN4QGHeGOpUYHT0JUsBfJheiqqzc+Af+Y95r0Rny8WBc9vkPmOZIz4AKgN+okPmGtPcjGF0HQvCzaEAAsap6ylcSc64UMW3GA33xj9F
-
I would recommend a totally different approach: having a second (hidden) UI element is rather weird.
Just take a copy of the current values when you press the lock button and restore this array in the slider pack' callback:
HiseSnippet 1847.3ocsX0sbaTCEVaRDPbvsIcfgKfKD4FblVL1sPggxOt4OvsMsdpSCkggoi7tx1hrVZQq1j5goyvvS.uC7Dva.2yKCWxckij1+bsiqSlhuHSzQme9NGcNGcV0QI8YwwRExa0CGGwPduIt6Xgd3NCobAp8tHuKgOfFqYJhiz1iinwwr.jm2xeigf2pqfr+9mudaZHU3yJHgPGI49r6wGw0ET6z5t7vv8oArC4iJw8G2psuTriLTl.3YYbCTD0+X5.18oF1VBi7ds8B3ZopqlpYw.OaKCF2cn7Tgi+i3w7dgLyhlntfhbjQ6LjGFzIyWiQHuU5T34K6772Be.OfmSuHBrtcCRgDkiAdKMIjVYBH07rfz9xv.iBNC3sTI3shCdaf65q3Q5hcLXaMbaAb3zmBg8xvxwKZo5uNdGIvgPWeD8X19JXQtD0tYiFWi7IMZr0spVoZkO5iHGNjGSNENcHGyXQD8PFYyPo+wrfMImPCSXwUqnXCHNZcC4AL0QV5juj7C+nUMvYXrF3VQb62ANDaBamgiAL8NxQQRArn1lk3YSCLJj9dfM1NQqkhyT3BV1z4BUqvEgbAizOQ3q4fnRQASFknjg07yzv0bN0VUq7K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CrsG0llT8tfWkdu4mSzpD10x2xltqx2rOMLtztlj83oIaJ8bhDOsBomHU.xLehvjRByS.nMYjUna.csdgyxneq0PFevvhu.okrEZ54+qVNKI8SelHuYhw9WddeIRyE+KQJUZtQdo4xmY91kvNTjRJstr36sPKfNphenMwXBUf8lq3tZlz7QyDbZVTJsbErxBpf0vFosX3b3.kTv5VEz8X9TPvaACAfFjJ8cYiO+AxIcjHFK3tBYuBHr1rDd8Tggx9dxskO0JNzhi8yIL3KlyIuXNRIHTE+.eMTF9PyvRm+yxUwcGlzueHadAf4eQAz2hMheHzLqzFSoM2cFuKt4MqO6emC6cDCFbgqG+xs2YbG0BZoqfumc9rE1u5erwNGcGvNOV1wsdAyE1.uCLuqfE1kEx7MMflepvLUx6fePhNJQ+JPUafOnydPyMUlxJTxRKrRtrQI6IBlREqaeFnodhi0wGHCRBMcaK+5KlmYJcCXFtIZCadJCQLjKT9YnNGOISiY9jLMmUe5EDtaf6v09CmMdWZF307ZO+Oi27K31qeeHin.rqf2+wuZeMqYBkGBe5DL9xATshCSuXu+.lt.564RLhyRqRW2HqEVWlHvt34vuzMalkHa1rY1lnQTek7I9tzRySn8FVJ.lD1WObU7Al0jhYYwMp2.MhGvehuuIT7g.1msLW+BHyMt.x7wW.Y9jKfL27BHymdAj4ylqLlGU81IZ4HWYBPnydtYL81y8BD1Ik+OjXiR0K
-
Wow, thanks both for 2 great working solutions to the problem.
Pure gold!!
Hope you're both good
-
or theres this(a combo box listing arp presets, and an arp setting save button):
inline function onSaveSettingsControl(component, value) { //save a setting local arpsetDX = ArpSettings.getValue() - 1; //Console.print("index is:" + arpindx); ArpSettingsArray[arpsetDX] = Arpeggiator1.exportState(); //Console.print("arp settings are:" + ArpSettingsArray[arpsetDX]); ArpSettingsArrayPanel.setValue(ArpSettingsArray); ArpSettingsArray = ArpSettingsArrayPanel.getValue(); //Console.print("retriving:" + ArpSettingsArray[arpsetDX]); component.setValue(0); }; Content.getComponent("SaveSettings").setControlCallback(onSaveSettingsControl); inline function onArpSettingsControl(component, value) { //load an arp setting //Console.print(ArpSettingsArrayPanel.getValue()); local arpLoadDx; arpLoadDx = value -1; ArpSettingsArray = ArpSettingsArrayPanel.getValue(); //Console.print("returned value is:" + ArpSettingsArray[arpLoadDx]); Arpeggiator1.restoreState(ArpSettingsArray[arpLoadDx]); //Console.print("num steps:..........." + Arpeggiator1.getAttribute(Arpeggiator1.NumStepSlider)); ArpSteps.setValue(Arpeggiator1.getAttribute(Arpeggiator1.NumStepSlider)); ArpTempo.setValue(Arpeggiator1.getAttribute(Arpeggiator1.SpeedKnob)); ArpSwing.setValue(Arpeggiator1.getAttribute(Arpeggiator1.Shuffle)); ArpDirection.setValue(Arpeggiator1.getAttribute(Arpeggiator1.SequenceComboBox)); ArpOctave.setValue(Arpeggiator1.getAttribute(Arpeggiator1.OctaveRange)); ArpSteps.setValue(Arpeggiator1.getAttribute(Arpeggiator1.StepSkipSlider)); ArpSteps.setValue(Arpeggiator1.getAttribute(Arpeggiator1.NumStepSlider)); // start it in the off state Arpeggiator1.setAttribute(Arpeggiator1.BypassButton, true); Content.getComponent("ArpBypass").setValue(false); }; Content.getComponent("ArpSettings").setControlCallback(onArpSettingsControl);
-
@Lindon This looks interesting
Would actually make a lot of sense to include the option to 'save' an arpeggiator sequence.Will take a look when I get back to the machine.
Big thanks for this!
-
@Lindon Reviving this old thread. Is combobox still the way forward for Arp / Sliderpack presets?