Persistence values - still cant get this to work



  • OK so I abandoned any attempt to get any other sort of persistent storage - and at least for the timer being I will store values in interface widgets.

    I'm mindful that @Dave said:

    "All widgets with their SaveInPreset property set to true will have their values restored after the init callback has completed. Following that they all have their onControl callbacks triggered. So if you want to access a saved value after initialisation you need to do it inside an onControl callback."

    OK so my function call is now in the onControl call back and I made sure all my widgets have saveInPreset = Enabled

    When I check these in the user preset XML I see this:

    <Control type="ScriptLabel" id="AuthNumber1" value="12345"/>
    <Control type="ScriptLabel" id="AuthNumber2" value="12345"/>
    <Control type="ScriptLabel" id="AuthNumber3" value="12345"/>
    <Control type="ScriptLabel" id="AuthNumber4" value="12345"/>
    

    Yet when I load my plug in it tells me the numbers are:
    0-0-0-0

    I am accessing these numbers in this way:

    var num1 = parseInt(AuthNumber1.getValue(),10);
    

    So I'm doing something wrong , any ideas?



  • @Lindon Hard to say what's going on here without seeing the entire script. Can you make a minimal project that demonstrates the issue and share it?



  • ok here goes:

    HiseSnippet 4304.3oc6c0DababElqkYrkhThRpCPJPRKyhzz0H1q0tjx+j+Ls9yVMVVJZUriuTapcmcWFy+BIW4rMwsJtH.8VJ5sf1CAn2KRQOUfBTg9ysbHn4PKPu3qEsG7kbpGZmeH49FRtq3JIqHmP4.Gwgy6Mu2adya9l2LC8Jt10Qdd1tBEFcstNHgBiKVqqke6YaqoaIr3bjBdqtF10zMcLPByz0QyyC0PnPgQtHoFEF8vBzet+4mQyPypNpWQBBW0VuN5x5l598JcE0WW2vXAsFn0zMA0VQcw51VyZaX2AKMiHNkfiV8ao0BcEMR0NjnPgGY9F591t0707QdBEN7L1M5Vqs8ssX0+p5d5qiER7CUDpgYDq3ErMZPjXRoBy1V2nwJgZsm.t8WomMXDlM3XhKo2POp7d1hIouPpGEP6QgCMHwqBT7lJ6hWAf3cXl38Dh0p6p6326MDY6QEWzxG41TqNe2DqtBG56OoXyNV080ssj1PyPuAVJuPG+1kN96MwXj+HIgK2UxpiYEoWUxQy0Cg4XIRctRGy0QtUJ2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zqrk5LcvqYzkuzOUk1TWvDC0hqsBzhUQNHMe9IHNp5pqdQL1Lm3TgQzQVv7ZtXvabScb+yurEB2yxMCvrt1ddMwpCkWdbH7531Bwg4iBH0iuLR93A8ojtILxQh2jd8vt+d0l1JSsFKuoYadVJIUFdRpN7jHO7jnL7jL8vSxoGdRNyPQRzWm.1zJw9FJj3Z4djrM0FlezzyAp4L5shZKVIvHIQdiTgG74UaaRBxAuucZ6eYiajrItoXAOTxkaLY.fovcGMPFicrBfx3R1VTWE857QJvi7a0B4Bk7TUmK36iCTAA3Ft2qf6H3k0sPZt7A.GJKw1.3pPF6sdZQl3JQB9evBUP.h2wDuJtmpNo0YccgOlRWWpBJN3cPjCPtCvc+t97w8Ct2N78IIy85NeEC6E4GdjuQle3rZ5dLQVnXIVBTNXircbQ5zZRDnWecFUa8PVg0sfemcNLFAYQFWR21CCLPLCnKc3cg6PhBCMtXtDLdH9TIdubbw43hywEmNt3p43hywECOfo6m3hoe1KxwEu2fKtZNt3bbw43hywECwEK2Obwzu.X43hywEmiKNUbwx43hywECupQ6m3hoeI2xwEu2fKVNGWbNt3bbw43hg3hU5GtX52y1bbw43hywEmJtXkbbw43hgW578SbwzONw43h2avEqjiKNGWbNt3bbwTS5nhgO0+CRw8yAFmCLNGXLCXL4eOkyQB+0PjvExHRXxEApoVGC+vR2eOSwzOQP4Xgev8cYHGuXNdwuwgWb+PJM0p6Zei5r+4agHqGkVBVJsn2o9QEWh7rTz+z4Prtl3YptQ85jgAmrhfP5TTcnoPdnoPYnoX5glhSOzTblglhyN.JHvBHW.aSVPQbAqLOyQpv7QNRiH7+4l9LNH
    


  • @Lindon Oh I meant a really simple example with one control that won't restore from a preset. It'll probably be harder to debug the issue in a larger project like this but I'll have a look.



  • Just some general points based on my first look:

    Don't use var use const var, reg, local, or midilist depending on context. The only time to use var is inside paint routines. There is a little bit of info about that here.

        var num1 = parseInt(AuthNumber1.getValue(),10);
        var num2 = parseInt(AuthNumber2.getValue(),10);
        var num3 = parseInt(AuthNumber3.getValue(),10);
        var num4 = parseInt(AuthNumber4.getValue(),10);
    

    This could be done with an array const var num = [] and will probably have a positive knock on effect in other parts of your code where you want to access these values.

    For example this if ((num1== 0) || (num2 == 0) || (num3 == 0) || (num4 == 0)) could instead be written as if (num.indexOf(0) != -1)

    A minor thing but because CR_Auth is tested for your if statement you could remove the else clause and use AuthPanel.showControl(CR_Auth); This won't make a difference to how the script runs but just reduces the number of lines of code.

    Voice1.asSampler().loadSampleMap("XylophoneVoice1");
    Voice2.asSampler().loadSampleMap("XylophoneVoice2");
    Voice3.asSampler().loadSampleMap("XylophoneVoice3");
    Voice4.asSampler().loadSampleMap("XylophoneVoice4");
    

    Another place where an array could make things a bit simpler to read. Then you could do something like:

    for (i = 0; i < 4; i++)
    {
       Voice[i].asSampler().loadSampleMap("XylophoneVoice"+i);
    }
    

    Again nothing wrong with this but I'll offer an alternative that will reduce the lines of code.

    if (CR_Auth != true){
        Message.ignoreEvent(true);
    }
    
    Message.ignoreEvent(1-CR_Auth);
    

    I see your still using the master onControl callback, I avoid this now and use the setControlCallback for individual controls, it also helps when you have multiple controls that all do the same thing but just have a different number, because you can set them all to the same callback function in a loop. But sometimes the master callback is the way to go.



  • @d-healey Dave thanks for those suggestions, heres a snippet that is considerably reduced - just the authorisation widgets really... and its still failing to work when exported as a VST

    HiseSnippet 2623.3oc4ZrzaabbdWKswRxVA1oo.8VGPjFPgXQK9vIowwUqkDYLazCVRY63SVq1cH4.u6Na1cIkYcLfA5kdK+HxefBzq8fQK5Menn4P5Q+SvWxoVf1uYl8wr7kHipMhZIAj39My26mytaCepINHf5qnt7gC7vJpWVq0.2vta20f3pTeGFfuXfMsEwwyFqr0.Oif.rkhp5BeFaGpKunB+yq1bKCaCWSbJHEk6QIl3cINjvTnMz+bhscMCK7gDGocWQutI0capMsGHMKnsghmg4iL5f22fssKnon9VUsHgT+VgFg3.E0E2hZMnUW5Ith8eOR.4XPHgKJpzBHj.bMpsEShYPU1tKw1pQrV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W2xazyJbUspsaiMCSE1E0p8EuAdvfukjrbIgrbQX7PaiAQO118Hl9TA.YogCgc2n1E2NNV+4u3EepdxBMkyB9tu4SzqgwVGCCDHggd4x+kMigKivQe8e9ut4tzSZ.LrlO9KS7I+9uU+NjQfpri9dDo36Wt4gXH6n0.WyLdyExZBWX1N95X7fMo8BItc1y.JTvlzDJd1BphYhAGnKTEgc1X0KvpcItdi3hYsvtV7K92vmnEKxtVMZwhwKJGkb03nDXz99T6d7fWl+4mJCA0D2G6ebwrNJ+AYeD6JJ2GGJARu7eb8muKXPbMyD5W2wqmc.3ec6HUeCxgijq5td8Bkge2.oI1OrqO1vRldPUMKdXjDr6P1VhFfucGCGOvtJumZSYFyVg8rHTTSJ0AsQwBmXzWwgoXBasiA+P.60TUwlR8.uteRSEFfpvrwQq++GQFkluHC3yCNeDYTXjHi6SgwxcEQFEeXoafZgMotVASHFQ+epL0XD15maiQVN9X+a2yuOt5WxiOVRKZvK4PBPP.iJbPmfXhtkAmibiN5a+6umNCPwziP80b.kx9F73ZUdX.U9eh5vWI1R1pqgGFZPKrj22v2AxDjsjbSsh5uPqTkBY+z+.3Os+.1O+kayuVYKhQfTWQ9GFrlYmVlkUzoKq4m7P1QcISmZ+Dc1sRIcK+L8Cfj+.H+wNSBz6pmIW+Yk0ahs5k8UuBFej1Yn2PK9ah0P43PGXeR+Lnl1P94ee9+zlma84WL4MZi+xq8YwCnsh1dFAPpxPioIYSQu3EK97cFtx18ybdAkGnOza7128Mus9+0LVYduzl9rwLAGctYV92QLj54IAl63O+HvWQCNO7OBD22Do6uI3giAbPpGF831YolKwg.5sKeFlkg5Iv0njGwBy13PrHOzzjcbv0KpnLdLJM2XTdtwnxbiwMlaL9v4FiOZtw3imBFr2JWVCOGQ7N.nQU9yTQUspK69yxC8U9O.+WSGaA
    


  • @Lindon A variable usually will be initialized (so the value = 0) and if you write a code where a variable never be initialized it will return weird values, that's the basics of correct programming.



  • @ossian1961 Thank you - I bow to your superior programming skills, can you point out which of the variables I have declared has not got an initial value?

    heres the init variable definition section

    
    const var AuthPanel = Content.getComponent("AuthPanel");
    const var AuthInstructions = Content.getComponent("AuthInstructions");
    const var AuthNumber1 = Content.getComponent("AuthNumber1");
    const var AuthNumber2 = Content.getComponent("AuthNumber2");
    const var AuthNumber3 = Content.getComponent("AuthNumber3");
    const var AuthNumber4 = Content.getComponent("AuthNumber4");
    const var AuthoriseButton = Content.getComponent("AuthoriseButton");
    const var FactoryPresetFlag = Content.getComponent("FactoryPresetFlag");
    const var AuthValues = Content.getComponent("AuthValues");
    
    
    
    var CR_Auth = false;
    var doingValidation = false;
    
    


  • @Lindon said in Persistence values - still cant get this to work:

    @ossian1961 Thank you - I bow to your superior programming skills, can you point out which of the variables I have declared has not got an initial value?

    heres the init variable definition section

    
    const var AuthPanel = Content.getComponent("AuthPanel");
    const var AuthInstructions = Content.getComponent("AuthInstructions");
    const var AuthNumber1 = Content.getComponent("AuthNumber1");
    const var AuthNumber2 = Content.getComponent("AuthNumber2");
    const var AuthNumber3 = Content.getComponent("AuthNumber3");
    const var AuthNumber4 = Content.getComponent("AuthNumber4");
    const var AuthoriseButton = Content.getComponent("AuthoriseButton");
    const var FactoryPresetFlag = Content.getComponent("FactoryPresetFlag");
    const var AuthValues = Content.getComponent("AuthValues");
    
    
    
    var CR_Auth = false;
    var doingValidation = false;
    
    

    Oh you don't need to bow because I get not a superior programming skill at all πŸ˜‰



  • @ossian1961 OK, but where is this variable that remains un-initialised that you mentioned?



  • @Lindon said in Persistence values - still cant get this to work:

    @ossian1961 OK, but where is this variable that remains un-initialised that you mentioned?

    When I wrote "A variable usually will be initialized (so the value = 0) and if you write a code where a variable never be initialized it will return weird values, that's the basics of correct programming." I wrote something is related to programming I'mnot talking about your code, you was talking about your plugin returned a 0-0-0-0 value, not me πŸ˜‰



  • @ossian1961 whA?

    Did you look at the snippet at all?

    You will see its configuring a text for display that shows
    0-0-0-0
    when it should show
    12345-12345-0-0



  • @Lindon said in Persistence values - still cant get this to work:

    @ossian1961 whA?

    Did you look at the snippet at all?

    You will see its configuring a text for display that shows
    0-0-0-0
    when it should show
    12345-12345-0-0

    Yes I saw that and you right that it's weird, but I really don't understand just one thing that is why you chosen the preset to relate a protection of the whole plugin and so you asked for a persistent storage of an authorisation in the preset and not in the whole plugin. My first question is started by that.



  • @Lindon I write you that because, just to make that a label shows the current preset it has been hard and I needed many comments exchanges before a solution πŸ™‚



  • Frankly Im not bothered about using presets right now I just want HISE to save and recall the state of a widget.



  • @Lindon said in Persistence values - still cant get this to work:

    Frankly Im not bothered about using presets right now I just want HISE to save and recall the state of a widget.

    I'd like it too. I remember, for exemple, that in the old release when you put a widget on the GUI you created, the code of that appeared on the script, that was like a "RAD" programming ide, but Christoph took off this feature in the new release we use and now I feel the widget palette a bit "weird" because when you add a widget through the script, obviously the properties used in the script are not available to modify in the palette, but only through the script, so at the moment the script-Widgets palette looks a bit "ambiguous" system. Anyway, Hise is under costant development and I have faith in Christoph skills, I'm sure he will give a more logic and stable nature to his wonderful creature πŸ™‚



  • but Christoph took off this feature in the new release

    Do you mean this change: https://github.com/christophhart/hise_documentation/blob/master/NewInterfaceDesigner.md

    In retrospective this is one of the best improvements I made to HISE, the old boilerplate JSON code was terrible and ugly.

    Sure there are a few hiccups, but I still think it's the best way to combine a WYSIWYG editor with scripting.



  • @Christoph-Hart said in Persistence values - still cant get this to work:

    In retrospective this is one of the best improvements I made to HISE, the old boilerplate JSON code was terrible and ugly.

    Took me some getting used to but definitely an improvement.



  • @Christoph-Hart said in Persistence values - still cant get this to work:

    Sure there are a few hiccups, but I still think it's the best way to combine a WYSIWYG editor with scripting.

    I think that the few hiccups could have not a solution for the nature itself of the way or I wrong? πŸ˜‰



  • But what exactly is the hiccup weβ€˜re talking about here? As soon as you set properties with a script, you obviously canβ€˜t change it on the interface designer anymore because it would get overwritten each time you recompile the script.

    If you want to batch process widgets once via script but then keep on editing the properties, wrap the property changes into a function and call it once, then comment it out so you can access them in the interface designer again.


Log in to reply
 

8
Online

491
Users

1.7k
Topics

13.0k
Posts