Integer knob value doesn't sets the effect but decimal value does?



  • Hi everyone

    I am seeing this weird thing. If you enter negative integer to the knob (like -4 for example) the linked gain value doesn't update. But if you enter decimal number (like -3.6 for example), the gain sets it. I couldn't figured it out, can anyone help please?

    I am suspecting that I've used 2 nested "for" loops. Maybe that's the cause?

       for (i = 0; i < 2; i++)
          {    
              
            for (j = 0; j < 11; j++)
               {
     
    

    alt text

    HiseSnippet 1474.3oc6YstaaaCElJoZMwatncnO.D4GE1KItR4VWW5VctNDzlVi4danHHPQhNlIRjBRTo0MH+aOX6QY6MnuAaGRIYQaq3lZfVrNTAXqvyM9ctvSNLoUD2kDGyiPFy9rdgDjw2Y1tGSzcqtNTFZusQFWybCazl8BchiIdHCio+UIGiYuFR879GtoiuCykTPBgdAm5RdLMfJJn1p4in99653QdFMPS5UZtmKmsE2mm.nXZSKTni6oNGSdhiTroLQFeyNdTAOpsvQPhADsI2qW6t72vRk+EzX5Q9D4BaTavPoj2k66IQrjJZqtTeuV4daLBrRqBee5Te+1l6S8n8oWDCtohAtPC83gwTiCd15vy5pCOCM3csT3cKy1tQzPQAGI19Vy8XBRTGGHEnCqTYQS8pYL2hCRvDMBbNkraDrnuF0VyxZA7xVV0WuZkpUt6cw6m3Kng9TRDdinHmdwUq.omXA1Qth3c3iX7iN7LG+DRL9mwudwUW.u3JvmkgOKAerW.ClD9FV.z.Vqdv5CaDYMzgEakt8VxRZjUaXKeIMJrAK0.9Z4F2Grqkjgjt8JRh1qAbsZbuCT3OyGZSCB8IX4lf2oSGhqXDuHUDkDvllpcGdDtFEVasNlhe.dI307yWuZkyqVACOipaivj3t0TGXZbLQjtW0lqPf4vyio0kA2KzvmLDVZb8iGKRsRQQdRFvwV7fPNCVTaNI+BPLrluldPiXo7LQD2eKGe+ifyd03Lcgx3p4DTlOkQvcRXtBJmgKU9Zt4nXArJ8V.db5KetqiOlx7HuEbzA7HEwm1ovF4nO8aZGbsGSYmd3lIBAmI84WH2hZ0qmsCvy43hmBpCE.rWTsUpv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3Ao0+.gV6ntFngwNLGnRVcT.8u.BkzvlB
    


  • You're writing crazy code again 😛

    Why do you want -5 - +5 = -29dB - +22.08dB?



  • @d-healey said in Integer knob value doesn't sets the effect but decimal value does?:

    You're writing crazy code again 😛

    Why do you want -5 - +5 = -29dB - +22.08dB?

    Ehehehe 🙂 It's just an example equation, never mind that point 🙂 I think the issue is not about that right? 🙂

    I didn't used .changed() since that can cause cyclic reference because of The link button, right?



  • @orange I think there is a built in thing to prevent cyclic reference when using .changed();

    cfa1aaa7-1402-462f-8c94-7d4250c2ae58-image.png



  • @d-healey Yes cyclic reference tool doesn't detect that also, but as far as I know, it crashes in DAW.

    Is ther another way or is it a nested loop thing?
    If the .changed() is the only way, How can I use it?



  • @orange What are you trying to do?



  • @d-healey EQ - Comp - Preamp combination with Left - Right channels Link/Unlink processing.
    This snippet is the simplest prototype that has the core issue.

    When the user enters negative integer value to the knob, as you see it doesn't update the effect parameter (Simple Gain effect is the example here).
    But negative decimal value updates the effect.



  • Well you're playing with the knob ranges so it's probably not going to do what you want.

    This is a simple way to control two simple gains and have a link button, maybe it'll point you in the right direction.

    HiseSnippet 1184.3oc6X8taaaCDmxNLH1aoncXO.D4SxHsoxY8OaKanowIYvXMIFycYcHnHiVhJlKTjFRTYwqHOHYeZuF6a4QYOB6MXijhJRN0y0w.qaYH5KVGu6386ti7tStSrvmjjHhAN0d4vADfyGB6NjK62pOlxAs2D3bG3N3DIIFkszFCGfSRHA.GmpekdAmZyALO+wy1.yvbeRwR.v9BpO4EzHprX0Nq+0TFaab.4kznRR+n0a6K3sDLQpBOUgdfAX+iwGQ1EqEqBD3L+VAToHtqDKII.m41PDLraewOwyjeeZBsGinIZB5p1nrk2VvBzHVuJnUeJKnStem.T6RmhnP0rnvGC2gFPub8hnwcMLPEZTNd3TYRvq46FddiCdNkf2bYv6dvt9wzAxBNZr8Av1bUhJDqRAkgUlrfJGVE1RnjfKWIBeLY6XEwkZ39DOu6idrmWi0Vr9h0UIhDIJgFMfQz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67uZgNaY9xQGms3X0IYyUAveE5zb9H
    


  • @d-healey Could it about the logic of the "loop"? Because I only used < and >. Not >= or <=.



  • @orange I don't see why the loop would affect it, I still don't understand what you're trying to do though. The simplest solution is to use the knob ranges and to control them like in my snippet.



  • @d-healey

    Yeah that's a good way too, but I will have to rewrite the code. There should be shorter Solution. Maybe If loop

    if ((arrayed_Knob[i].getValue()) > arrayed_Knob_values[j] && (arrayed_Knob[i].getValue()) < arrayed_Knob_values[j+1])
    


  • @orange Ok I figured it out. there should be >=. Thank you @d-healey for your help and advises

    if ((arrayed_Knob[i].getValue()) >= arrayed_Knob_values[j] && (arrayed_Knob[i].getValue()) < arrayed_Knob_values[j+1])
    


  • @orange you need a >= instead of just > otherwise you miss values in the array



  • @ustk Yes, definately 👍


Log in to reply
 

17
Online

1.0k
Users

3.6k
Topics

30.7k
Posts