Forum
    • Categories
    • Register
    • Login

    Accessing function in another script from Interface

    Scheduled Pinned Locked Moved General Questions
    9 Posts 3 Posters 658 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ustkU
      ustk
      last edited by ustk

      It's in the title, is there a way to achieve that?
      Global system seems to be only for variables. I tried to use a component as global for its callback, but at init the interface script complains, like if the global component in the external script is not yet declared.

      Also, if I declare the global component in the interface, its callback is not triggered if placed the scripFX.
      I know this is dirty and violates encapsulation, but still, we might need to call functions in a scriptFX right?

      So in short, the goal is to trigger some computation in a scriptFX function from the interface (and pass data to it)

      Side question: does it mean that at init, scripts are declared AND preset recalled one by one? Not all declared THEN preset recalled?

      Hise made me an F5 dude, browser just suffers...

      1 Reply Last reply Reply Quote 0
      • David HealeyD
        David Healey
        last edited by

        Put the function in an external file and include it in every place it's required.

        Free HISE Bootcamp Full Course for beginners.
        YouTube Channel - Public HISE tutorials
        My Patreon - HISE tutorials

        ustkU 1 Reply Last reply Reply Quote 0
        • ustkU
          ustk @David Healey
          last edited by

          @d-healey Thanks
          I think I see what you mean but I might have explained myself badly so here's a simple snippet:

          HiseSnippet 938.3ocwV0saaaCElzwbaVstnEXO.J4JYfrT4s1tAzKVqchGL1RpQcVQtqfghNlHTjBTTcSqHuC6p8Xsmk8Frcn9IRNQsH0.ai9BqyejemCOmOvEFMimlpMH7fSyS3H78IKyU10SWSEJz7CQ3GPNllZ4F+RUSxSnoo7HDFuyO3TfGzGUr9queBURULdiJD5MZAi+ShXgsQ6hW7iBobFMhepHtk2O4EyYZ0TsTmA3YGRHJgxtjdA+DpysdDD9yNJRX0lkVpkmB9LQGkubs9WTk9+FQp3bI2ILFsD1nR0noqExnE04ZJBg6unIy2oLy+RxwhHw05ap.OrvfeSDsqA3daBo9a.oweHHMSKibavG.d3VvqeI7dDYIyHRrMVbX6dj4J3xYEEJ6sgUound+NlLUCdnrGDSujOy.BWGQvyBC22+oggid9PO2OgRJTb+UYJlUnU9Z0jLqUqF61CiVFvzwIZEra66+NpLiOZn26G54CKwJ+fRUUJbqgdCb+83G+RlCy9w4yp2ZgxOs.iyNqz+qF5cE.iZzdA2Ns9vB1qBF6M5fTm9BvLkJkmCMHA2DktroUJbh1xekJXj268F3ckm+MMsZUm1p1LI2zoYWqq4iEXfJK9btotPU6HbetYCy8taMLrx5RKG0p4Jg8UI7J4lVJmsxrt1ZH55jssplbrs1hTqC2ZTc6NVT08lq2sxcvUaQm6Cp5bKukPB.iCHUWYnhpSaFCzOO+PpkVuQvdBmSB2XEtpE9P96.FkxQhAjC4oWZ0IE9V0rfvj6vw9qfa3+.Nsb2GwvGhzi0wP7TCnB2Cc6IPfGPGkIo1MIGbrfUFfFfMlBcSZpTgMuMK4m.iQXmLFi6p9eGg6iHKDV15twauNvKbO7uMdq3eGRNZ0JNy1.19jYm8+CYqWUuCb9Nfb+JQ+YmMtKZV7eR7uM6YCaWPCOIzSmpk7CRLBGwVNmulR2c2c2azy8tpEuUhgmPM7S0Kjz7fTZbhj+ZHq22+bolc4RwuwuM4SRYhLw4Q.aMUo3xzsgihrYc9yua04axHsQNzvdzFkepzLuVmYEpKNlZMB2L7IYwKgmKv3SqxV23bOGeTobnS10EujqhJD9aXUYbrSFWYbbswFprshJ5+DHFSYF8aYkELWO7WTnAJaph2JM.dzFH6eM+JgDdPHJFdGyaYL2j0WASkcGyWuEw7MaQLOYKh4oaQLOaKh4a2hX9tOZLtmP9xLqNtj0ETr3nhlKL9HEEFlJ3SP+CvmSxzI
          

          Hise made me an F5 dude, browser just suffers...

          David HealeyD 1 Reply Last reply Reply Quote 0
          • David HealeyD
            David Healey @ustk
            last edited by David Healey

            @ustk You can't access a function in another script like that, the function would need to be in the script that is calling it or an external file. Possible solutions:

            • Use a timer callback in the second script and check a global variable, when the global variable changes the timer can trigger the function.
            • Call the function from a control callback in the second script and trigger the control's callback from the first script.

            Free HISE Bootcamp Full Course for beginners.
            YouTube Channel - Public HISE tutorials
            My Patreon - HISE tutorials

            ustkU 2 Replies Last reply Reply Quote 0
            • ustkU
              ustk @David Healey
              last edited by

              @d-healey That's what I thought...
              I'm currently working on the second solution, it might work for my case :)

              Hise made me an F5 dude, browser just suffers...

              1 Reply Last reply Reply Quote 0
              • ustkU
                ustk @David Healey
                last edited by ustk

                @d-healey Well, that seems good on the paper, but once you added a DSP to the scriptFX, you cannot access its components from interface anymore... They are probably replaced with the DSP parameters only... @Christoph-Hart ? I'm out of luck with anything I try these days 😔

                HiseSnippet 1614.3oc4X0taaaCEUxIpM1sYaEnO.D4OSA0y0tethrh7gS7PvhSMhS6JPPPAiDsMQjIEnnahWQeV1a1dFxav1kjRVTN1YAdncCXN+Hh2Kujm6UjmCo5H3AjjDtvws7wiiINt22q6XlbPyAXJyY+cUFNFeVDAIIIRmcFGiSRHgNttK8ypd3VdYG8uq1bGbDlEPxM437NNMfb.cHUlasyV+BMJpENjbLcnUue1V6GvYM4Q7Q.ZVxqtSLN3bbexgXU2J443dm8BoRtnqDCfwwc4c3gi6NfeAyz+2QSn.RUMZ3zEFHi4V7nPEhUVcZNfFE1IKqSbfQoSdMXISM3gdsogzI1yqEem1AJOB65gaoaBdMrgW8aO7bsf2xF38.utABZrL2iBa2yaeljH5ggWA1vxzWmRWVxqIG5ASVaH9bRKAzXRD9und8pnmWu95arZE0evqhDI5iXAxDeq22.8ZjdoQs9D4d85QBj9qYbh.uqkE4ieL5XAseeh.IGPPwXFIBdBKQA3nnDswQwgPMB0aDKPR4rUqPYQTVtADmY5hdo2NRlB4Bdje.eXLmA4PU.aQiHquZkOsZED7i1C4aLkZP8K+I.USRjZRC95vhPgbRB66kHxkTHeuX.ggvnc61AQSPABB.gvZ0pkON4CRBQtsDFoyFII9yZryf3Fln+7pU9L7X16.nH1LKY7WqX1t15pQOMmaBUsyfcB9yoljU2spcGxkj2v7WuxmpTtxmqfl1UudyzW5.FQDyzsZ6p3lBzmMZ3YDQVdm0QXc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Ou4zCYsTIH6iPjlApMk8toObba7kSY6pMOfeAQL0U9gSQGGeMqWsYWIIVQ1Uv14jKLESaqVeHh8YgjKctFVJjFNVqjt2jURM9O6RoUT.cEyRoF+Gasz+SVAc0lEWAM+F+iuQ3xxzaHj9YbTegD8EBuuW9YIsuL3q1pvUX9pHKNDGH3eHvHaqduth1BrPlo+dbk8ZqZiZjcmYOu50p6LjFR+PPf51N+.HoO6XdxBDySWfXd1BDyyWfXdwBDyKWfX9waLF0mlb6QR9PyMgACc1SuR00cOlZcudWnyeAEK6fu
                

                Hise made me an F5 dude, browser just suffers...

                ustkU 1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @ustk
                  last edited by

                  So a little update. I tried unsuccessfully the first option with a timer that checks a global variable.
                  But Hise crashes as soon as you start a timer panel in a scriptFX...

                  This is a no end problem => no timer, parameters not accessible from outside if a DSP is present, functions not accessible from interface, and tables don't connect to scriptnode...
                  Now I wonder how we can update the node tables from UI, it seems that I tried everything... 🤔

                  Hise made me an F5 dude, browser just suffers...

                  1 Reply Last reply Reply Quote 0
                  • Christoph HartC
                    Christoph Hart
                    last edited by

                    Actually there's a function to disable the DSP network grabbing the parameter callbacks:

                    const var dsp = Engine.createDspNetwork("dsp");
                    
                    dsp.setForwardControlsToParameters(false);
                    

                    However the API popup for the DSP network object doesn't work, so it's very easter-eggy right now. Also the function doesn't work at all right now, so I gotta look into it anyway.

                    ustkU 1 Reply Last reply Reply Quote 3
                    • ustkU
                      ustk @Christoph Hart
                      last edited by

                      @Christoph-Hart Oh that is good news!
                      Will it affect the access to DSP Parameters? I hope not…

                      Hise made me an F5 dude, browser just suffers...

                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post

                      21

                      Online

                      2.1k

                      Users

                      13.0k

                      Topics

                      112.5k

                      Posts