Sampler Loop Start / End Point - change with sliders?



  • @Christoph-Hart I saw some code from a thread recently which looks like it could be used to control the Sampler Loop point from sliders - is this possible? I'm trying to link Sampler1.LoopEnd to a knob callback (unsuccessfully!). Loop on / off would be great as well. Here's the code below:

    /** Select all samples in the current samplemap
        ".*" is Regex and means everything.
    */
    const var allSamples = Sampler.createSelection(".*");
    
    /** You'll get an array of all samples, which you can iterate */
    for(s in allSamples)
    {
        /** Just multiply all sample properties with 2 */
        s.set(Sampler.LoopStart, parseInt(s.get(Sampler.LoopStart)) * 2);
        s.set(Sampler.LoopEnd, parseInt(s.get(Sampler.LoopEnd)) * 2);
        s.set(Sampler.SampleEnd, parseInt(s.get(Sampler.SampleEnd)) * 2);
    }
    
    /** This needs to be called after a sample manipulation op
        in order to refresh the UI. */
    Sampler.refreshInterface();
    

Log in to reply
 

14
Online

1.1k
Users

3.6k
Topics

31.0k
Posts