Complete crash of Hise with this script



  • What is wrong here -
    There are 12 folders Kit1 - Kit12 in the AudioFiles folder
    Each kit contains 10 samples in the array "inst" here
    As soon as I call Kit 11 HISE crashes completely - without error message.

    Content.makeFrontInterface(1200, 500);
    
    // Load Audiofiles into pool ----------------------------------------------------------------------------------------------
    Engine.loadAudioFilesIntoPool();
    //--------------------------------------------------------------------------------------------------------
    
    // const vars---AudioLoopPlayer1---------------------------------------------------------------------------------
    const var AudioLoopPlayer1 = Synth.getChildSynth("Audio Loop Player1");
    
    //--------------------------------------------------------------------------------------------------------
    
    // Array Samples in AudioFiles-Folder----------------------------------------------------------------------
    const var inst = ["sample01.wav","sample02.wav","sample03.wav","sample04.wav","sample05.wav","sample06.wav","sample07.wav", "sample08.wav", "sample09.wav", "sample10.wav"];
    //--------------------------------------------------------------------------------------------------------
    
    
    //Selector-ComboBox 12 Kits---------------------------------------------------------------------------------
    const var KitSelector1 = Content.getComponent("KitSelector1");
    inline function onKitSelector1Control(component, value)
    {    
        for (i = 1; i < 13; i++) {
            Content.getComponent("knbSampleSelector1_Kit"+i).showControl(i == value);
            Synth.getAudioSampleProcessor("Audio Loop Player1").setFile("{PROJECT_FOLDER}kit"+value+"/"+inst[value]);
            Console.print("{PROJECT_FOLDER}kit"+value+"/"+inst[value]);
        }       
        Console.print(value);    
    }
    Content.getComponent("KitSelector1").setControlCallback(onKitSelector1Control);
    //-----------------------------------------------------------------------------------------------
    
    const var kit = KitSelector1.getValue();
    Console.print(kit);
    
    
    //************************************ KOBS 1-12 *******************************************************************************
    
    //knbSampleSelector1_Kit1 - Sample selection---------------------------------------------------------------------------------
    const var knbSampleSelector1_Kit1 = Content.getComponent("knbSampleSelector1_Kit1");
    inline function onknbSampleSelector1_Kit1Control(component, value)
    {    
        Synth.getAudioSampleProcessor("Audio Loop Player1").setFile("{PROJECT_FOLDER}kit"+kit+"/"+inst[value]);
        Console.print("{PROJECT_FOLDER}kit"+kit+"/"+inst[value]);   
    };
    Content.getComponent("knbSampleSelector1_Kit1").setControlCallback(onknbSampleSelector1_Kit1Control);
    //--------------------------------------------------------------------------------------------------------
    


  • Could be because combo box values start at 1 and array indexes start at 0 so you're trying to access array elements that don't exist.



  • here is the snippet but beware is buggy

    and it doesn't matter if 0 -12 or 1-13

    please be so kind and look over it - it must be something really stupid

    HiseSnippet 2591.3oc6b07baabEGPRvwl0xiSh6LIc5ALpcZkisHA32ZbcMEIEkXzGjQTR1toYz.Athbs.1EB.TRzd7L4OgbM2xL8ejbuyzo2x01a8n+OHc2E.j.TfpDRVxLkBG.4906812626s.X+ntIVEXYgM43uy1cM.b72UnQWjc6RsUfHtpk43EEVdkZhMTzMz.hM.Z.UaronbRw0f1VhRI4J10PwxBzjime5Unsh+Nyvwtd2yJpnofTA8yhiaWLTErNTGZ2O25EVCpoUQoIXantuZmtPUULpDVC2gHgSKHwYnndnRKvlJzpMk.G+sVtIjHPMrUrAVb7yTD2rai13SPN0eWnEbeM.MgLWCBgbxtBVqIUho4xUpMTqYcOMgEGGuP895koczKOPXCXSXu76qetOq.w9svu9fepyS7j8KdRit3MkOw6i7LaLwSSoKvjIV2SXipkqJ5jib.gpTGSS.xtA3nNf.Fm28L2h11jnl8m+5XrwxHEhn1zusjR88IUsgAveAu6Y7SGreO8v629MKmsuxQ6VUfZ.Z+l2KAo1z9Hw9WVwVgi+eHHmQJNZ6rqkuTk5w2txRwW09qd4pEM0iebx76ryNkJtCZsjuBBiWJ05lmt8y2ZoCA1p4Wxb+01MtwolYRVZkSfGkt5q1Haw8W8nzYLI2OUdoW1pVsS5twqeQkxZFlajq0QcL1UK9gU1bm7RRRux5jR6pWEqX1TA9b6EeQF8uBtJp3laUSM9id9IsWEUKdQT8VFqbzRG+RzJuHaqcyTpwWV83WlRa8caUMSboiqmbUzwPsidwNGrYINZWzAg+WDRrKVqiNvJwFcrfGVQg580MwNV.SqD5zrNvMqF01YyxMRPs5IJa1Q2h5FKlQRJQQM.v30T+08Rs+dxx4iqCo.ApuVCXKjhcGSBuD1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eGOmV+CK.mxz7Nn.bRN3AHwLi1mj++wAmwLi0mqGWegaldzD2Pzf70OyIFy8EZ.o16kQGCzHNKLY7SDJCNPoilsWtA8T1.ivFswHnZPvFY.xVs.l9k8P6PKYaG3DJ4AE1hDcWwB3ev00gHfh4f9KQPWHO55hyyd8YBNhqH08V7+OFlX5IygI1B2wlDlcCEBP8TmiLkFjnyp.hjfP.M5jGxOE8YWbRK4EOqA.0jk3mIWtEJSSy6VnrWgWK7PWQ0DumpybZPwx2lkCoeiXA1uivFzzh8lIDAAIxyHpShHtmpJUcufLGW3sI4EnMot.sI8EnMYt.sI6EnM4t.sI+41F5fQK0wFq63JRxn9xNG9Q78FjmeZt+KTg6yxI
    


  • inst[value]

    This won't work because value will start at 1 but the array will start at 0. You need to use value-1.

    Also you should declare component and module references at initialisation rather than run time.

    Thing like this should be called once during on init and stored in a const, then you can use the const inside your control callbacks (and anywhere else you need to access these references) rather than reassigning them every time the callback is triggered.

    Content.getComponent("knbSampleSelector1_Kit"+i);
    Synth.getAudioSampleProcessor("Audio Loop Player1");
    


  • Sorry David - too high - I am not yet ready to understand your short precise instruction
    Do you have an example - or can you please comment it in my snippet so I can see where it says what you are talking about?
    I would be very grateful.



  • @MikeB When you select item number 1 in the combo box the value in the callback will be 1 but the first element of the array has an index of 0. That means when you select the last item in the combo box the value will be higher than the last index of the array and you'll get an error or a crash. So everywhere you are using a combo box value to access an array element you need to use value-1.

    With regards to the other stuff I said you can see in all of my videos I never use things like

    Content.getComponent() inside a control callback, I always declare these references as consts in on init, like:

    const knbKit1 = Content.getComponent("knbKit1);And then whenever I want to access it I use knbKit1`. There's more of this kind of thing in the coding standards guide - https://github.com/christophhart/hise_documentation/blob/master/scripting/scripting-in-hise/hise-script-coding-standards.md



  • @d-healey said in Complete crash of Hise with this script:

    @MikeB When you select item number 1 in the combo box the value in the callback will be 1 but the first element of the array has an index of 0. That means when you select the last item in the combo box the value will be higher than the last index of the array and you'll get an error or a crash. So everywhere you are using a combo box value to access an array element you need to use value-1.

    I did that in the first try - but 1 minus 1 = 0 and Kit 0 does not exist.
    How do I get a combobox with value 1 to x together with an array [value 0 to x]?
    I have seen this in a video of yours - but in which one?
    By the way, this is often the problem - that with the number of your videos
    you don't know where this or that was shown.

    With regards to the other stuff I said you can see in all of my videos I never use things like

    Content.getComponent() inside a control callback, I always declare these references as consts in on init, like:

    const knbKit1 = Content.getComponent("knbKit1);And then whenever I want to access it I use knbKit1`. There's more of this kind of thing in the coding standards guide - https://github.com/christophhart/hise_documentation/blob/master/scripting/scripting-in-hise/hise-script-coding-standards.md

    The other I have as well as understood - I think - for now 🙂



  • @MikeB said in Complete crash of Hise with this script:

    I did that in the first try - but 1 minus 1 = 0 and Kit 0 does not exist.

    inst[0] does exist. As I said you need to use value-1 when you want to use that value to access array elements. You don't need to do it everywhere.

    By the way, this is often the problem - that with the number of your videos

    If you have a solution please let me know 🙂



  • @MikeB said in Complete crash of Hise with this script:

    inst[value]

    First stupid error found "inst[value]"
    Is of course "doppelt gemoppelt" as we say in Germany
    Means "inst" is already a value - so here a value of a value - stupid 🙂

    to the second part: Content.getComponent()
    Here I have the problem that I have the knobs 1 -12 and I read the number 1-12 from a key (as learned from you) But because there is no knbKit1 and that creates an error

    knbSampleSelector1_Kit+i.showControl(i == value);

    Interface:! KitSelector.js (25): Unknown function 'showControl' {SW50ZXJmYWNlfEtpdFNlbGVjdG9yLmpzfDE0NTZ8MjV8NDU=}



  • Now I have to stop for today
    it is completely the worm in it
    I can't get any further



  • @MikeB said in Complete crash of Hise with this script:

    knbSampleSelector1_Kit+i.showControl(i == value);

    You need to store all of your knbSampleSelector knobs in an array (you can do this using a loop or use the built in or use the right click method in the widget list to grab a component reference). You'll see me do this in lots of videos.

    Then you're code would look something like this:
    knbSampleSelector[i].showControl(i == value);



  • Maybe someone can help me here
    David has tried - but unfortunately I can't follow his explanations yet.
    And the more he writes the more confusing it gets for me - sorry David

    I want the ComboBox to select a kit 1-12 - (this works so far).
    each kit has a knob that selects the corresponding samples (sample 1-10)
    The selected sample from the selected kit is loaded into the AudioLoopPlayer.
    Actually quite simple if you know it 🙂

    I am a visual person - I need to see this to understand it.

    HiseSnippet 2225.3oc6Z0sTajbEdFfw1nX4hcWmpxlpRUSQRkBJL5OPfb4305ODnEDRlAgw6VaQMZTKo1LS2CyzRfvkqZeAx6PdDxiPdBRk6xsatKW52fjt6YFod.YhVggJqM5hFN8OmyWeNm9zcOmtlC1.35hcjjmc+91.I4Gpn0GQ5TniNDIUtnj7eTYiMqppoaYaBT0.l.CB1QMYJ0sgDW0k01EZaCHR46aq65BZJIKO8lrwJO6LR7eu+E40M0QFfgUIIc.FZ.1AZAICqsV1sgllkzaB1GZIz6UyV1.iJfMwco3bZkDR15FGq2FrqNqaSoHIeuMZBovRinS.tRxyjG2ruVG7oHu9e.zE1vDvHRJoQYjW0kvlMYHlUqTgNPyl0BzGtRRxJ0Fpcl1S67XkJvlvA0OTKMGuA0giPTeHO0UAujhvKw3CuoDf28CLdb3Yp2G3vg0iTpTtXYUuZRFBTE553.PDMvIcAgLNu+E9MsuCUMKV+NXr8FHcJTaJZKYbuAsqZ1.wFd+KjmN77d5O77Vzrb44pDaZUBZBXya4.BZuYyQp8unNQWR9uqjLchXn8Wa6LEJUK19kxEaKxKe8V4crh0KUl50qWHecz1odCDFqvJ63b19uZubGCHFYx4zX6ChYelS5TE17T3IqV9MUVKeisNY0zNzxyRl60sqV8z9UN+vREMscprd6S5ZefYriKsa8LIRj3MtmV3.qxXcml5vWQd5gosdIbKT9c2qpQrkd0oc1BUMVdTs11adRtduFs4gq09fzEz91x8d8Jl6bP6xoiknWsTag5AMO4v5s1sfDaJ54g+cJwO.a10B3FuRWW3wkzYqA6GutKvwMtEqpV9UoUs9tE0hyr5wK5z0xksXVMchDwyaB.1myV0dzJMNJYxLwrfLGA1ZMMXajNoqCUVJ610JuNUoOz.mcWrEj1NOJgekyksH.MppY9HT6sCQzCwywIjugjf26LddueghlgCzlLrEl48WoTFQ.NzIHHj+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HqU3OgDW4NrU5lOZDpTbEqLrBJK9RJnxYcMzMAdWedX0+6WXqy9dGBykQqibI.aM34gBT0KX+L4oE09ObBh3+Kekgz0xcXkOccGhNAawdmxP3.B2oLDNdycJCgCm8KKkgvD+ie.zL24YHdv3OCUFWww5+LbcxUboj6zFhWo5SVsw8CeIncza3eInGnv++P2mKmv8dx9xrDvYTN76T32FrA9LUWNDT42Ga4joTW9ajFb2nGF5tQY8tk6XCCQKvOVV.F054CiTJaivM7jqON7SIOspDpsbvVpdYgP8XpIk1sgXqbHrYv46kR91bJUvM6ZxRmmXVsYox2uAHFEJAbrjrgbgj9gR46MQptGW39EJ0fDiNiFuSMB7xxh9MLd8e3.QU1nUKpUaHXmQozg27uR.Qn7UAPYPx27ek.OV4xeL+q3Ac7OF2Gzg8X+fNz5iLnlsPqi41R9aP.hZe4rIeomgvdXLg8EuEePI9wNX4ilx9P8FzC33FlCCy39uWYD4dHUbwDsIwCMpHyFn+m94mdljj4v7e60lYPtu8Hu3ahXlw66i++3sfLy+W+TUt8B2L83A2QnAkqcomB0bJZPl8dCTOfIcwBGieoRQPK8tljfZCuRoBFgs6fQPivNazcIa2F3Hh8QNgxQHgdzMON6dzn85t.wcX2Ah.5NWb8xOCcQxwWWbU1qeihGbUYKuU+zXaho+7bah8vcIzvrUzoNpm48JfznQmM.TjfP.SVl7jmhcpFO5DAwyz.nlbh+C8meiI4esX+FSFz3shLrzMbvGY3kfAlu7C30Pm2Hdf8YUpvnUGjVBEkDwRPik2DdjgAScubRIoQOlTSvXVYBFypSvXROAiYsIXLqOAiIyUNF1lQ45RvVdKEoUTaCu2ym7fM4oW+8+tXSd6C
    


  • @MikeB said in Complete crash of Hise with this script:

    HiseSnippet 2225.3oc6Z0sTajbEdFfw1nX4hcWmpxlpRUSQRkBJL5OPfb4305ODnEDRlAgw6VaQMZTKo1LS2CyzRfvkqZeAx6PdDxiPdBRk6xsatKW52fjt6YFod.YhVggJqM5hFN8OmyWeNm9zcOmtlC1.35hcj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CQKvOVV.F054CiTJaivM7jqON7SIOspDpsbvVpdYgP8XpIk1sgXqbHrYv46kR91bJUvM6ZxRmmXVsYox2uAHFEJAbrjrgbgj9gR46MQptGW39EJ0fDiNiFuSMB7xxh9MLd8e3.QU1nUKpUaHXmQozg27uR.Qn7UAPYPx27ek.OV4xeL+q3Ac7OF2Gzg8X+fNz5iLnlsPqi41R9aP.hZe4rIeomgvdXLg8EuEePI9wNX4ilx9P8FzC33FlCCy39uWYD4dHUbwDsIwCMpHyFn+m94mdljj4v7e60lYPtu8Hu3ahXlw66i++3sfLy+W+TUt8B2L83A2QnAkqcomB0bJZPl8dCTOfIcwBGieoRQPK8tljfZCuRoBFgs6fQPivNazcIa2F3Hh8QNgxQHgdzMON6dzn85t.wcX2Ah.5NWb8xOCcQxwWWbU1qeihGbUYKuU+zXaho+7bah8vcIzvrUzoNpm48JfznQmM.TjfP.SVl7jmhcpFO5DAwyz.nlbh+C8meiI4esX+FSFz3shLrzMbvGY3kfAlu7C30Pm2Hdf8YUpvnUGjVBEkDwRPik2DdjgAScubRIoQOlTSvXVYBFypSvXROAiYsIXLqOAiIyUNF1lQ45RvVdKEoUTaCu2ym7fM4oW+8+tXSd6C

    OKay, you have all your instruments loaded in to an array called inst:

    const var inst = ["sample01.wav","sample02.wav","sample03.wav","sample04.wav","sample05.wav","sample06.wav","sample07.wav", "sample08.wav", "sample09.wav", "sample10.wav"];
    
    • arrays are numbered from zero so in inst[0] is : "sample01.wav". in inst[1] is "sample02.wav" etc etc.

    you are referencing this array in your combobox....using the value returned from the combobox.

    Comboboxes ALWAYS start at 1 and go to whatever the last entery is.. so yours will return the numbers 1 to 12

    -- so you want to load the samples from inst (which are numbered 0 to 11) using a value you get from the combobox (which are numbered 1 to 12)

    So in your combobox call back you need to reference the contents of inst like this:

    inst[value -1]


    Meanwhile:

    inline function onKitSelector1Control(component, value)
    {    
        for (i = 1; i < 12; i++) {
            Content.getComponent("knbSampleSelector1_Kit"+i).showControl(i == value);
            Synth.getAudioSampleProcessor("Audio Loop Player1").setFile("{PROJECT_FOLDER}kit"+value+"/"+inst[value]);
            Console.print("{PROJECT_FOLDER}kit"+value+"/"+inst[value]);
        }       
        //Console.print(value);    
    }
    Content.getComponent("KitSelector1").setControlCallback(onKitSelector1Control);
    

    -- just NO. NO.NO. never do this.....

    every time your callback executes (everytime you use the combobox...) your program has to go initialise and find all the controls you want to access...bad very bad.

    do this instead to pre-load your components and loop player...:

    const var mySampleSelectors = [];
    const var myLoopPlayer = Synth.getAudioSampleProcessor("Audio Loop Player1");
    
    for (idx =0;idx<12;idx++)
    {
        mySampleSelectors[idx] = Content.getComponent("knbSampleSelector1_Kit"+(idx+1));
    }
    
    

    Then in your combo callback:

    inline function onKitSelector1Control(component, value)
    {    
            for (idx= 0; idx<12;idx++)
            {
                  mySampleSelectors[idx].showControl(idx == (value-1));
            }    
            myLoopPlayer.setFile(inst[value -1]);
    }
    Content.getComponent("KitSelector1").setControlCallback(onKitSelector1Control);
    


  • @Lindon
    Super - many thanks for the help - But unfortunately this is only the half

    1. the combobox selects one of 12 knobs - (that works fine)
    2. this knob loads one of 10 samples into the AudioLoopPlayer (this is completely missing)

    So the knob has to load from the folder selected with the combo box
    the sample selected with the knob

    There are 12 folders - Kit 1 to 12
    Each folder has 10 samples 1-10



  • @MikeB - so see if you can work it out from the code I've given you...



  • @Lindon Thanks a lot
    I've been trying to do exactly that for a week and I can't get it to work.
    Ok - Must try something else.



  • @MikeB - you wont get it to work if you dont stop and get the concepts right first...



  • So I am making progress.
    After watching one of David's videos again I am a bit further along
    However my requirement here is not so simple

    I fail at the moment still at the following problem
    I need the value of one component in another and vice versa.

    Bildschirmfoto 2021-06-15 um 07.34.11.png

    HiseSnippet 2305.3oc4Z0sTaijEVBPyFXfTL6jspY2ZunKW6ElhfsjAyOUFVL1FCd.i8fABYRkhRH21tCRcKjZavgJUkGg8p858QYeB1mi8x7Fra2sjrkrMTDCgcmAkpB9z+bNeme6Vp6JNDCnqKwQRdxC6XC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WHCjz1YhJ2Oec+x8ezLi7zgD7ziPQ3qBGnER5+EO2S.YrLrkupxbD1tgGSTD92r6GgeZmLtF5lPuuhRuY9u2vVm+YuBA9gabboP6pnODYYh1AqHJOdXy92NBqY7qPsW5d4vW72PN7oGgkgeJq8oeRq8K+jV6W4Is1u5SZsesmDZ+srA8mzpu1Sa0O0u1U+AO6tYUJQp0xjeZfgOTb9MAvuC1qOE4763mQG1EQ6D4Di+ZbR42U39cJUPTilCGuiMD7xOD9ux30+dGLixV0qy7N8.6DJEN4q+kLHLT99.nHNqF9Q03eICdgxfmdyCw8Aw9NeePp1AavbaQhWE9RwUXf8NyCdXzCbKFNfPn7u0Z36ihehA+3rYrOxngsgNtQ4PuCreLEIKtJqHya2+aJXrtrjYuSG2qOyfSF2ir+aLwD2sO7ZOm3vt8DxS7+0WjkGupIie2f6PrfxUF3JRMqRUDO5XKbanIKWPfweuRdXc8VlzfVilHThfI1M4epnnwRrJ7MZ.cBi8gpPaRoQtRNuHyArh15tvvqNrGBC0c5Oc3KvVnc2sE2l+5GT7fKfm8B9swp.i+zbUfCHsnrpnkzYApW4cGgpxJ9Z.YHAigl7iHRdL9GE1iVMndVUHtlf3+vd76TiSK62oVPmOJxvR2vgbpg2WtlGK+LQKL8FKpaOoRINMn626VQQMgJqVdMzoFFby8BZRRCeNoFg4r3HLmkFg4jdDlyxivbVYDlyp25b3KFsYKJwxKUj0Pks7tsexcWCmsgz+KRgEJGA
    


  • @MikeB look in the API, you will see a call for every component that looks like this

    youComponentReference.getValue()

    this will tell you the value of the referenced component, but are you sure thats what you want? Because the value of your comboboxes are 1 to 12...

    .. you might need:

    yourReferencedComboBox.getItemText();



  • Thanks for looking at this again
    It doesn't matter what I put in front of ".getValue() it always returns the error "Unknown function 'getValue'!
    I have tried everything - nothing works

    I think I can't reference the sampleSelector because it doesn't exist yet.

    And that is already correct there are 12 kits and 10 samples per kit
    The ComboBox select the Kit 1-12
    The Knob (1-12) select the samples


Log in to reply
 

8
Online

1.3k
Users

4.2k
Topics

38.3k
Posts