UI controls in design disappear when loading file with callback function that causes error.

  • When creating UI control (e.g. knob) and adding callback function, when opening file again the UI is not visible in Midi Processor -≥ Interface. Additionally, I was also able to create file with JS callback code that makes HISE crash on load and sadly was not able to edit it back in preset file (seems like serialized format, maybe there is consistency check).

    Attaching file with HISE project (without samples) to demonstrate the problem. Problematic files are TestBug.hip (GUI not shown) and Preset.hip (loading this file crashes HISE). https://drive.google.com/file/d/0B3Nkp-y-UjAsM080aVZHazAtSW8/view?usp=sharing

    System details:

    • HISE Standalone 1.0.0 build 649
    • Mac OS 10.11.6 (El Capitan)

    Reproduction steps:

    • Click Frontend Panels, select dimensions, confirm to switch to Designer mode
    • Unlock panel, right-click on it, select Create Slider
    • Right-click on newly created control, select Add custom callback for knob
    • Enter following into function body:
      for (int i = 0; i < 2; i++) {
      smp = Synth.getSampler('test' + i)
    • Save preset and quit HISE
    • Start HISE and load preset

    Expected result: GUI for design is shown

    Actual result: GUI for design is not shown

  • I followed your instructions and I get this error in the console

    Line 6, column 11: Found identifier when expecting ';' {SW50ZXJmYWNlfHwxNTN8NnwxMQ==}

    This tells you the problem is on line 6. There isn't an int type declaration in javascript (https://www.w3schools.com/js/js_datatypes.asp) and in HISE you don't need to put the declaration for the loop iterator i, but if you do you need to use the keyword var.

    Once you've done that you'll get another error - Line 9, column 2: Found '}' when expecting ';' {SW50ZXJmYWNlfHwyMTd8OXwy}.
    This tells you there is a problem on line 9. Basic javascript, you pretty much always need to put ; at the end of a line.

    Upon fixing that I get this error with your testBug patch - Line 8, column 25: test0 was not found. {SW50ZXJmYWNlfHwyMDJ8OHwyNQ==}
    This is because there is no sampler in that patch called test0. So I add 2 samplers, test0 and test1.

    Then I get this error - Line 8, column 7: Unqualified assignments are not supported anymore. Use `var` or `const var` or `reg` for definitions {SW50ZXJmYWNlfHwxODR8OHw3}
    This is an error on line 8. You haven't declare smp so you can't assign to it. You must declare this before you can use it. So I add reg smp before the loop.

    I don't know how you intend to use this code but currently smp will be overwritten each time through the loop so it won't be much good outside of the loop. You'll probably want smp to be an array so you can assign each sampler to a different index.

  • Hi David,
    thank you for getting back to me.

    I should have add more context. This was minimal case which caused the UI not being shown in HISE.
    I had more elaborate example, however HISE crashes when I try to load it (in HISE project from first post it is the Preset.hip file).

    You are seeing those JS errors in console - Do you mean the Console panel? If so, I might be missing some setting, because there are no messages about JS code shown in my HISE. Just messages like
    TestBug: Save TestBug to /Users/whatever/Documents/HISE-UltraBass/Presets
    What is the HISE version / build you use, please? I would like to see those errors as well, I could do so much more with them. 🙂
    I have to admit, I haven't touch JavaScript for Long time, being Java developer myself.

    To the use case: I was thinking of creating instrument from mono synth, which would use 50-voice unison (each note sampled individually from analogue synth, 50 times) with selectable number of voices and (random) panning of each voice.

    As I understood from Note panning thread, it is not possible to change pan of individual note (= all samples being triggered by one note).
    However, in Sample editor, there is setting for Pan for individual sample.

    Controls for this instrument would be:

    • number of voices (samplers playing)
    • auto panning amount
    • maybe something else

    So I planned to use 50 samplers called Sampler0 - Sampler 49, mute / unmute them according to number of voices configured and generate random can setting for each note in sampler (each note has separate sample).
    Not sure, if it would be possible to randomize pan settings for each sample in 50 samplers for each note (due to performance) or just when enabling sampler.

    The part of code I have posted was intended to retrieve those sampler instances and then perform operations on them - muting and random panning.

    I suppose being able to see errors in console and being able to load the problematic file would help a lot.

  • I'm using the latest build (from github) but you should see those errors in the console in any build, they will also appear below the script window. You won't see your GUI while those errors are there. Hit the compile button to see if those errors appear.

    That sounds like a lot of samplers. The thread you linked to seems to indicate what you want can be achieved with the StereoFX effect

  • Ah, there is Compile button. I did not see it hidden in 50 shades of grey. Thank you, David, this should help. 🙂

    I have tried to recreate code from file that cannot be loaded and managed to get HISE crashing when clicking Compile button.

    Steps to reproduce:

    • Create new Sampler instance, rename it to Sampler0
    • Click Frontend Panels, then confirm switching to designer mode. Switch to first workspace and edit interface under Midi Processor -> Interface.
    • Under call Content.makeFrontInterface enter following code and click Compile:

    const var MAX_VOICES = 1;

    const var knNumVoices = Content.addKnob("knNumVoices", 5, 6);
    // [JSON knNumVoices]
    Content.setPropertiesFromJSON("knNumVoices", {
    "text": "# Voices",
    "min": 1,
    "max": 51,
    "macroControl": "Macro 1",
    "stepSize": "1",
    "defaultValue": "1"
    // [/JSON knNumVoices]

    inline function onknNumVoicesControl(component, value)
    //Add your custom logic here...
    for (i = 0; i < NUM_VOICES; i++) {
    sampler = Synth.getSampler("Sampler" + 1);
    if (i < value) {
    sampler.setAttribute('bypassed', 0);
    } else {
    sampler.setAttribute('bypassed', 1);


    Actual result: HISE crashes, also happens when entering this code
    Expected result: Compilation is performed and problems shown

    Would you have any idea on what could be causing this crash?

  • It doesn't crash for me, I think you should try building and using the latest version of HISE from github.

  • Okay, thank you for trying, David.

    It seems it is time to get hands dirty with HISE compilation. 🙂

Log in to reply