Separation of design and function



  • For example, in my application I have found that a random function with a running arpeggiator
    is only executed if you click several times or the arp stops.

    I have read here several times in the last weeks how useful it is to separate the graphical part (GUI) from the realtime functions.

    The concept makes sense to me.

    My question is how do I implement this practically in HISE?

    Are there any examples here?



  • Use two scripts, defer the callbacks in the ui script.



  • @d-healey
    An example please David.
    I need to see this - I don't understand it otherwise.



  • HiseSnippet 1024.3oc0V0saaaCElzIJa1qIXcqO.D8JWfrT4s1tATTz1XmDXzkTi4jhsqJnknhILEo.IUZbK5c6AXOI6UXOK6MXWt61NjRxRcPHK0aEXyWXHd9g7iG98cHmnUQLiQoQ3tmtLigv2HX5Roc9v4TtDMdDBuSvwTikoIEl1eYF0XXwHLdiibFvc2D4+8aOdepfJiX0lPnWn3Qrukmxs0Vm7jmwEhCowrS4oMh9dOYbjRNTIT4.d1HHDkQiVPOmcB0EVm.DdqCh4VkdpkZYFDdy8UwKmNW8JYQ7ufa3yDL2fAnovDUX9PkH1gX22ngy4h3IU6aCBlkI0UgMJpB2J3XdLek85pwm5cPpynY8.24pf2f0DdcZ.uMKf2MClFo4Y1ZONr8IAikvAUBENBZBqhXQc9IbvPEDgztWJcA6PMLXUF8ePX3tj6GFdmGtcus64IA6EyRX5gTgXFbPX5a04rB228tjSmyMDiepIvWIJMYIbvQNaLwXySRVEFirPplQTRh0kB3G9WvkKXwDqBLVF.WR7Y3Lnf+zUy9EbJIipARfiFNdjOpePkShnRBUXT9YykWJ7mVke9bhgYep0p4yxsrjbYjkCquRdhxxdtr+c58ldc681dj+pqjjV84JaZkPvzs51Qi0WUh8k4oyX5cIWPEPIrJP377cILac8HLQEmhMBTIGK41mmwJGWSoFzBkBURC.xEtDgPnVO0ZmRp0TAOloQbXR9nfmAmOCPdv2TbiNa7HpkVMMvLBqRFSa4tMCdD6BP7WvX6FLhYVXUY9XSyTR25i24ucQuDgCvbXsV593H3CicoqjrkO.TJONVvlnLbWIuQ2neAZZkMk+ZOheys94i90W+iONsYCKDJkdYy9WFf1xuz2oIgKRM.+IabJz.Bg+rfyLLBnGn4BKwr.lmBJ7oJe7YUk2w.1+7xsScahAnUDXW.8BVHmABH44P2vqo5tsIsEUN92CZWbpYTgEHp0pys6ADIikTgExiHU8Gnwwtpa+aW4616Rf1CPyg++Hl58ukXpZmVYIDsZC1zT89poU+1okvpM8OVe1fM8APhdiqy55UonJUJ5+ppzVDavE5p3bA09t2x6dZSoCGfaJzbWYJgMxxlf583p+vVu5u09zWS3dyfIbaz71wamVvq6UEefwa4Co1N3fjDVjsFraFb32utuZ58.JemJ2BLyio.8vwNOIOcJ77jHFfDojILNhZGmVqXbXEwcJSF6G7GvuRmCbiwkNGT4DHlQZ0KiJTntmp8wdK.lj9Wr1Ed5LLlr5pyffv8BchA9KihbkhuX.B0dNe4ZjyWsF4bu0Hm6uF47f0HmudMx4atxbbOd+o4VUZgLALL4.e+QL9.IEXYdFI5OA8YdlOC
    


  • Here's another example that shows how to use a non-deferred timer to repaint a deferred panel on the main interface.

    HiseSnippet 1038.3ocuV0saaaCElxIbnVadXc+bOQtRAHyUZsMa.ACywNICFaI0XNqn2UvHQYSDIRAJpzYTDf8frGl8HsGfMrcnnjkbfyO0ac5Jc9i7imy4i7LQICY44RExo64KxXHmOBOcgPOezbJWfFeDx4SwuJMYhhkyzCogWVjkiFtHilmyhPNNa88F+b5tMp76O9tgzDpHj0nBgdojGx9QdJW2ncxfefmjbBMhcNOsk2Oav3PoXjLQV.XZKrOJC1T5L1YTiacvHmO33HtVplpoZVNxY6gxnESmKeiv5+K447KRXFg.zTXgrpOQlDYPrQKZzbdRzj5ydNBVkIMYhsrYhOGeJOhuTeSF4SJMPZhnc9voycAuf6Gd9qCdcZAussv6w3ogJdltwhAaeHdrPyTwTnDzFVVeQc9hN3QRvCgteJ8R1IJPXYDd666uG44996dPO2dtkMB8iXwL0HZRxEPgH2SqJXVyPcJWSthpHSnBVR.4aI0K8LldjLMSJ.Aucrl2wFEWjvELRbgHTykBhTXMaBUIS7BqiaOXoSf8pm6a641co59JVFTHzdlk65xk7t2094F0kKd8ov6FapEYVUF2mX1feRVnAj5UiTuYVnPHjY8igl2CSR7NkBYHEUDA4Puflu8H629a2cOv85cOn0g9Lol8Bg2ttu0sq60tjaZJNds1p.bBSsVyFtj5tBzSTjdASUmaqcDZpVsqE+v5ZCsY9VNJEiEb8KxXhaipgpJWve+73inZJzd6ToC7KiozbCDbNhcEbugsYuK9HV9kZYVouU0X3p.co0d0TASEDwgF9GgsUSzur7pkee5fEKE90oCdCOROGNoN+lCBMmwmMWaj9qxamdfrsOqRaycAAqk08mN3m7Dx4y44jba.vewREQwnIZnnQx0EwwqxpVRKAhkkJBM3qbkj2NK84VYWCKzZo3dnWPOMgGS7pU00nvtm4ZpRa6q76GX1ktrjb1M7QlU05cOjxJzbarxUA6+uDlkoRCzNTqU7KJzLuF01Np8HAFx7+Fxk6+Ujq5rRsFezxjQaUM4f1ZKO5qwsFUue4tXK28iqnP1ReI4sKtpOnE6EcVK1Kp+fb5UrwB6XIFl1ZnrvyzxnhDpd02tMCrTY.pdqPWM0ZQNWun8.MuCOn6+fm23gB2Gimv0gyWOd6rF7ZlU38LdqFOpG933XVntAraiO4Ua5rPuCPw9v7L3oWEGZPvmUjNElVLjAHQ.TTyyWNcLMqVYeirIyLkIhJE9a3qxXfQ1oxXPsQTJMTIecnkQXF.6QkZ.LIJmCsK9TiLI.Ux0g3v988QovsyuNLzjJ9R.6qOluZCh4oaPLOaCh44aPL6uAw70aPLeycFi4gwCKzxTKMATL43xanbbNVPgtrxNRz+.P3Vpj
    


  • @d-healey Like this?
    See the comment in the Gui and in the ScriptProcessor!

    HiseSnippet 1944.3oc4Ys0baiaElzxX6Jkpr1IoWdDSl9f7VuJRMW51ISajsjch13KbrbtL8kcfIAkvZJ.tjfNQyNYl9Snu0W6Oj9v9Sn+Tx+f1CH3UaFszZS2NSKePiOGfy47gCN3CWrUfvlFFJBLLad5Bepg4OGMYAWNa3LBiaLdjg4sPudtmU.MjJ2kXedjenwtK7IggTG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yfCfpPR.jmnqXtne8yEKa95WizvEqVYh+eCF9F++ICu90nmdHAJTgq9FeuLfXEtKg9XCgoG5HQtW50BlP4NwB+K3Kow9oGyQ0X+zF+IIFyI1AhuN8QhfItOMVCLt4w+CdZhNTIiydtWDpW2dFyAFwu11Vkt+BH+TsM+tUvl6uB17fUvlGtB17nUvle+JXyWtTaTaFsSjTLWuTDTXsW766XZpuMXbUuw+FAS5qR
    


  • @MikeB If that's what you want then yes...



  • @d-healey Now that's a diplomatic answer - isn't it? 😉

    I want my PlugIn to work smoothly in the end.
    And the many graphic elements of the GUi do not disturb the audio flow.
    I end up with four arpeggiators that control four AudioLoopPlayers.
    Like a small drum machine.

    Since this seems to be a larger topic, wouldn't one of your videos be a good idea?



  • There is some good advice here - https://forum.hise.audio/topic/79/scripting-best-practices

    Basically if you are updating the UI from one of the realtime callbacks (on note on, on note off, on timer) then you should defer the script - it's a good practice to always defer your main interface script.



  • @d-healey

    According to this, everything should fit - I only have one NoteOn call, and it is in the ScriptProcessor before the arpeggiator.

    function onNoteOn()
    {
    if (Message.getNoteNumber() == 60)
    	    Message.setVelocity(5);
    	else 
    	    Message.ignoreEvent(true)	    
    }
    

    No timer, no control.
    and now additionally Synth.deferCallbacks(true); in the init script



  • @MikeB I don't think setVelocity will work in a deferred script, but I might be wrong.



  • @d-healey

    That's funny, that doesn't belong in there at all - good thing we talked about it. 😁

    It was still there for testing.
    I was wondering when the arpeggiator was off that the note was played so quietly - no wonder with velocity 5.

    You can already have fun with the thing here 👍


Log in to reply
 

10
Online

1.3k
Users

4.2k
Topics

38.3k
Posts