AudioLoopPlayer crashes



  • Maybe a little bug?

    in this example samples are loaded via a knob into the AudioLoopPlayer.
    There are 6 samples [0-6] in the array.
    If I set the knob to min 0 and max 7 it tries to load the 7th sample.
    So by mistake one sample more

    HISE crashes mercilessly and the file cannot be opened anymore.

    The AudioLoopPlayer can not catch this error with an error message

    HiseSnippet 1533.3oc4XstaaaCEVJNJq1qYncq+X+jvXCPFsNwt21v15pyEmgrF2XDmVTfhhLFIZahJQJPQmVut.rGk9nr2f8JrGg8FrwKRVRtxWpWcxvl.BPN7vCOe9b9Nj7v1LpCJLjxLLKd7v.jg4Us5Ljv6uSeHlXr+tFleoUsaW8wnWyq1lgNq5QPhK0Gr0.WL8.JMnsGbHhYr8v.XXHx0vzrvOHM0r3pFpu+7gaC8fDGTxPFFOkhcPGf8w7jQa23QXOu8ftniw9ol8caruCkrC0iNP.yBV0LBfNuD1C8XnbZqXYXtVSWLmx5vgbTng4paScG1oO8UD87eJNDepGRJT2niXgzCuG0yUhX4nF6zG641NNbDZXXZ0NI3TPGbtgUKrKdz3IAoqoT.RrHc7vbkoAu5ogWs4Gdlof2pZ3ccqNNLb.OQiDaer09DNh0EJRAogkdtFq7KW0ZGpXFD9F9vWh1iIDFYg88qU6Vf6UqVkuc8RqWZyMAGPgt5zeWrGJDfIbJHfR8.UWpeqWpIoGlf1vS..k+2S5eARosEd2VBvM2r5EzmLXDEPDjyPN3LHKbY6xQdZ7xu5fG.TksazCwUTEkjcY07.xIBhlYYYbJYghJme.HlBHW.pe.kHDrKqUOlMOhPOs9DMQocLKjaeLQCjJGa9xcZl37kJKewmsEY5sXL3PPGnefl3CRngUUUqrO7YZr7ed.34kCUtsV8MdE7rx2JV71YEuSVw6lU7dYEuuR7EWR0MZVjNXBBQdHGNlRVBNDS7Daa.5Nfn7.fRTtVRtXh8MbhYV2RDu8Ffprdo2rdIf3aTEkJMqQ5nsVyu1ZiPDWxGrK+l1Gc3O1bmiOYuCOX2lGcd4aJyjOW4hWHYumK9apUPx0JBj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lXubW7INNxvc05FF4aysW.atyBXycW.at2BXy8W.a9pEvludp1HOLZqAbputTTLP6lp1DLMGcFtYAi+157BCL
    


  • Friend in the code that I adapted from your example I realized that it does not actually load without setting the knob to the number of samples, but it does not send me an error, it just does not load the sample and it does not block Hise in my case, it sent me an error when I wanted to rewrite the samples by typographical error but nothing else
    🙄

    Here I leave the lines that have been modified so that you can evaluate the changes..
    😁

    // Load Audiofiles into pool ----------------------------------------------------------------------------------------------
    Engine.loadAudioFilesIntoPool();
    //--------------------------------------------------------------------------------------------------------
    
    
    
    // const vars----------------------------------------------------------------------------------------------
    const var AudioLoopPlayer = Synth.getChildSynth("Sampler");
    const var Random = Content.getComponent("Random");
    const var Knob62 = Content.getComponent("Knob62");
    const var Next = Content.getComponent("Next");
    const var Prev = Content.getComponent("Prev");
    //--------------------------------------------------------------------------------------------------------
    
    // Array Samples in AudioFiles-Folder----------------------------------------------------------------------
    const var inst = ["sample01.wav","sample02.wav","sample03.wav","sample04.wav","sample05.wav","sample06.wav","sample07.wav","CBsample2.wav"];
    //--------------------------------------------------------------------------------------------------------
    
    
    
    //Knob1 Sample selection---------------------------------------------------------------------------------
    inline function onKnob62Control(component, value)
    {
        Synth.getAudioSampleProcessor("Sampler").setFile("{PROJECT_FOLDER}"+inst[value]);
    };
    Content.getComponent("Knob62").setControlCallback(onKnob62Control);
    //--------------------------------------------------------------------------------------------------------
    
    // Random Button------------------------------------------------------------------------------------------
    Random.setControlCallback(onRandom_Control);
    
    inline function onRandom_Control(component, value)
    {    
        if (value)
        {
            Knob62.setValue((Math.randInt(0, 5)));
            Knob62.changed();
        }
    };
    //--------------------------------------------------------------------------------------------------------
    
    
    
    // Prev-Button----------------------------------------------------------------------------------------------
    inline function onPrevControl(component, value)
    {
        if (value)
        {
            Knob62.getValue() > Knob62.get("min") ? Knob62.setValue(Knob62.getValue() - 1) : Knob62.setValue(Knob62.get("max"));
    	    Knob62.changed();
        }
    };
    Content.getComponent("Prev").setControlCallback(onPrevControl);
    //--------------------------------------------------------------------------------------------------------
    
    
    
    // Next-Button ----------------------------------------------------------------------------------------------
    inline function onNextControl(component, value)
    {
        if (value)
        {
    	    Knob62.getValue() < Knob62.get("max") ? Knob62.setValue(Knob62.getValue() + 1) : Knob62.setValue(Knob62.get("min"));
    	    Knob62.changed();
        }
    };
    Content.getComponent("Next").setControlCallback(onNextControl);
    //--------------------------------------------------------------------------------------------------------
    
    


  • @callybeat said in AudioLoopPlayer crashes:

    Friend in the code that I adapted from your example I realized that it does not actually load without setting the knob to the number of samples, but it does not send me an error, it just does not load the sample and it does not block Hise in my case, it sent me an error when I wanted to rewrite the samples by typographical error but nothing else
    🙄

    You are on Windows or Mac?



  • I have added the line to my example:
    The knob must be set to the number of samples - here 0-5.



  • If the knob only adjusts it to the number of samples in relation to the number of samples in the audio files folder, but the code works very well, just do not modify the random function, I do not think I put it in the plugin

    by the way I am working under Win10

    😁



  • Yes - The random function must also be set to the number of samples - here 0-5
    Knob1.setValue((Math.randInt(0, 5)));


Log in to reply
 

9
Online

1.3k
Users

4.2k
Topics

38.3k
Posts