Old project won't open in latest build

  • Opening one of my old projects crashes the latest build of HISE. I also noticed that when I open it in build 644 and press a key I get a warning about line 1 in onNoteOn - but this line is just function onNoteOn() so I find that weird.

  • I am sorry about that (this shouldn't happen). What build version did you use to create the patch? If you want, you can send me the project (minus the sample folder) and I'll check what's wrong.

  • Thanks, here's the project. I built it in 644 http://chilp.it/6b66582

  • Actually I have no idea why it didn't crash in the last build, but now it's fixed (it was actually a missing safe check that wasn't triggered in build 644 for some reason).

    I think the script warning has something to do with your framework script that is saved outside of the folder (I get this error message when I try to compile the script:

    onInit() - Line 1, column 1: File /Volumes/_HISE Development Framework v1.0/libraries/ui_library_v1.0.js not found

    (The onNoteOn error message is just a follow up - the line numbering is a bit off sometimes when using external files).

    BTW, I noticed you are using many functions in your framework. I strongly recommend you replace them with inline functions (see my blog post about scripting best practices).

  • Thanks Christoph. Yes I've just started another library which makes use of inline functions. Am I correct in thinking that these only provide a benefit when used in the audio thread callbacks?

  • Yes for audio callbacks it's pretty mandatory, but there's no reason why you shouldn't use it elsewhere (the paint callback of Panels could also become a bottleneck if it is too complex).

    I made some performance measurements and the boost is pretty drastic. This is the execution time in milliseconds for 1.000.000 calls to the identity function function id(x){return x;}


  • For some of the GUI stuff I'm doing like mic mixer channels it's definitely beneficial for me to create classes which, as I understand it, won't benefit from inline functions - if they can be used within classes? But for most other things like round robins, legato, etc. I'm using inline functions and reg variables as much as possible. Is there a way in HISE to measure the performance of our scripts?

  • Do you need classes to sort your functions (like the ui.knob() methods) or do you want to access object properties via this? The latter could be also achieved by passing the object as parameter (this is how you could do object oriented stuff in C):

    inline function setInvisible(this)
       this.set("visible", false);
    // Usage

    If you just want to categorize the functions, I am thinking of adding a namespace keyword so that you can do stuff like this:

    namespace ui
        inline function knob(name, x, y)
            //  [...]
    // Usage
    ui.knob("name", 20, 20);

    The compiler can resolve the dot operator at compile time to the function pointer so there's no overhead compared to plain inline functions (unlike using functions from actual Javascript objects).

  • The organisational aspect of it is helpful, especially with things like the UI library, also having access to this is helpful, although not necessary in the case of my UI library. For my mixer channel library it's important that it's a class because I need to be able to create multiple instances of it - one for each mixer channel. The namespace keyword would definitely be useful for building libraries that are going to be using a lot of inline functions. Would it also support namespaced variables?

  • Yes, that could be possible (I have to think it through a little bit).

    Why don't you do something like this with your channels:

    inline function createMixerChannel(index)
       local Panel = Content.addPanel("Channel"+index, index * 20, 0);
       [...] // JSON stuff and callback definitions
       return Panel;
    var channels = [];
    for(i = 0; i < channelAmount; ++i)
        channels[i] = createMixerChannel(i);

  • The channel class I've created is more than just the UI it also houses the mute, solo, purge, change volume, change pan, and change width functions. It makes it really easy to do something like channel1.solo(true, mixerObject); and this not only solos channel1 it also mutes all the other (non-soloed) channel. I'm not sure this sort of functionality could work as smoothly if they weren't part of an object. This sort of thing though will run in the message thread so I don't think it would be too much of a problem.

  • Using a combination of the techniques you've presented I think I've actually come up with a way to create my channel class with inline functions and it should be much more efficient (I need to do a little more testing though to be sure). The name spacing idea would definitely improve the categorisation of the functions though.

  • Great to hear. BTW, did you know you can define parent components (it will use the coordinate space of the parent and will be invisible when the parent is hidden)? I can imagine this concept could also be helpful for your channels:

    HiseSnippet 801.3ocsU12SSCDF.+51ZBTcDw3Gfl8Wij4ncLdIRLBavzoxXwRHlXL3Q6M5EZuq45UvIguy9IP8t9BsCJHyDujkt64s6We5877LlQsQggTFP4IGMM.ATdpp0TB2suKDS.C2Cnrj5AvPNhomHp2z.XXHxAnnT8sRAJKVCDu94a5A8fDaTtH.3XJ1F8QrOlmK8a67Arm2.nC5HreAq6tyPaJoO0iFI3oppAH.ZeN7LzHnzrJpfKvnKCAJFpq0oM6byS+wtskqdsyV60trEvNhwPD9wB2AJpJ+VrTT22AyoLKNjiDwrZOpyTKW5kjji9XbH9TOjbiIvRvThXPeWrmy3rzVH.nTabdRrZRR7EpGfcv2HOOY9rXE54dTLcpTYVjpMCRl2GRCndNx.bO3oT.uZI3srpkMCGvy0HY64oRuG5RTBp7KE09TBWjNaGh3uCgOyk2rigwJaWWSS78KjqeAjoOFRPd5uVOyVniSrnlMheznkdmtq0Ru65qrs1pqp+k2ac3nDm9pVg3KXI.w3XT3.F0WZTd.tptltdiKwNb2FuRuyVcaEKvMFIgDSiMqqccZ7Ws3AjiYuHNmRlkyDYMaj7TbPlaH9MCnIp9qjdSDRPM.JuE1m5GPIh+HPL8c41XlF9IQDaNVfGkLhxQGRZth1UZKpcs1s0LYRYpjzwnddHVYZkEerGvsljH+SQrVh7jWDJyNw8rYukp83tkl8JbX.J0vaPOSjznbjKJMF0RLKWjcxGhBEvTxPBlmeb2sz.j90SVjjFPgo73RjkRKFR9R.vhRfETS2DmOJ1jCb2RLQgN0IxCxms5W1wLUgHWOS80PIKgX9zhcTmiVBFk1Rnz26GItKqNFyscKm2JkvqHQ9+l2zFr0U2exDjMOG1ZpC97+Z2z4.kOQi3XxYG.4L72EyRFE4aIFWYiDjPDkxgx4KUj2sR1aH2KyLVHhiQ1vmTklx8JoJMyTB7g1L5I1I2HksvWHVhfIR7fvEESjE60MytIJ41WLW4DaaYh3kBxK2iNysGqM2dzct8X841iMlaO1bt8XqGvC4P7ci3T+jxB.3OPOHq3M

  • That seems very useful, I can thing of several situations in which it would be helpful. Thanks!

  • I have another preset that won't open and crashes the latest build (github build). It's strange, the autosaves won't open either but I have a backup I made that does open.


  • Hmm, I can load both patches with the latest version - but I don't have your external scripts, so maybe it is crashing the scripting engine there.

    Does it crash on load or do you have to press a key?

  • Aha! I just moved my external files and it loaded up no problem. It was crashing as soon as I opened the preset, no clicking on anything. So my next task is to narrow down which file is causing the crash and then which bit of code.