I am once again stuck with a small problem



  • I have 16 knobs - all 16 are visible.
    There is a selector knob with the value 1-16
    If I change the selector knob I should
    only as many knobs are displayed as the value of the selector.

    For example, the selector is set to value 12 - the knobs 1-12 are displayed.
    the knobs 13-16 are hidden.

    In my example code here, only the knob that corresponds to the value of the selector is displayed.
    So unfortunately it is the other way round.

    I have tried to adapt the super script from Lindon, but due to my lack of experience I am not getting anywhere.

    const var selector = Content.getComponent("selector");
    
    const var myPads =[];
    const var nrPads = 16;
    for (idx=0; idx<nrPads; idx++){
        myPads[idx] = Content.getComponent("Knob" + (idx+1));
        myPads[idx].setControlCallback(myPadKnobCallback);
    
    }
    inline function onselectorControl(component, value)
    {
        if(value){
        for (idx = 0; idx<nrPads; idx++){
            myPads[idx].showControl(idx == (value-1));
            Console.print(idx);
        };
        
        }
    };
    Content.getComponent("selector").setControlCallback(onselectorControl);
    

    Bildschirmfoto 2021-06-24 um 08.52.12.png



  • @MikeB

    HiseSnippet 1122.3ocsX0saaaCElxwrqVctXAXO.B9Jafr.YGGmzUzF233LXrlDiprh0aVKsDcLQjHMjnRiWPdZ1KReD1c619Hrq1saj5GK4DqNGKUciAOmyG+9NzG96PWlI1yi4BTpb9roXfx2BMlQ4S5MAQnfAGATdJ7DjGG6pEZ5vYSQddXKfhxF+jzfRkxffu+9fCQ1HpINwD.7VFwD+ZhCgmXcX2elXaeLxBeNwIUzs6NvjQ6wrY9B8rATGLEYdI5B7oHYXkf.kG02hvYtFbDG6Ih4Pl0LiIrORCi+sDOxHarrQSfgniBMC5MgXaMLNW8..kxCSx7MBy7uGdBwhL2dxHv2E3PKAQ5w.kRKJoxKHolYIoiY1VxNHC4ojRdkCk2lPCSWxTdhGo1dBb.U7myXjXXOsrBiET5eTf8XhHn7scPWhO1UzXNh5cz02RaWc8FOupZUUwfuGW6Jjq1kzQdZuPKF4EX9qrs6wblxnh1d0qIBnVHnppDpMgh0F6SM4DFUiQM5+598N+r2Hw6xrqaFibKQua6iaTU8lppUFyb0papQnA7ILpI9tI7G4mz51DpE95yFW2rg1KeQHbsCzL21CyqW6pvA2ZaoMFY6ga7i22A2Uv2yC5yaqpdaflSkWySp50hUcsFx9HR68P11iDUg0uWVIS+T47oLN9LZ8Fp2nVQ8VUs65Z73k5KpyrwtK0sbBh6WBXcpuyHra7.abfhplEKKexpUVZFNxjJPFc.kvOaJNpcRgqzWXVG6UGLOYSaJIGSaMH0VRXIlt+7BPz+bhYHaFEtHTdv7imFM+vvlXgcADgFeDTTB0DDLzjdQIvphsUNvtSNv1NGX2MGX6jCr6kCr6mCrOa8v9MA0F54Aby7.tUd.uSd.2NOfuS00e8G+4AqN30r7REFuz6cwq2E7KCNBwQxsLiVaPrdwTrKmHW0S4H7UhyeDtAZE3QXuK4roAKdDsrunH5+a4iqSq2Yoa7QhEeRhgeq6DL4hIoNoyftfUmoVYxzftEKS6jISuqfYpcVL8oQELS6lYNQJXl5jEScYELS6k4nmaAyz9Ywzm8KXldVJl9Lp6Wm4SwKtmP0mVfpBbBU7VAYQ06JZpZkEUE4Tp3sYxJqHEMUsyhphbRU7VXYM.5VzT0IKpd3SqTWksGSX6C9O3JCGz0o2Y0Yw616wwSMH+tPBPXys0ANDKKa7PlGQdgjjH05Bt+cWE2flY4ai3KdsZ46GD4P1Gou+p7NpTQeOKsFd.20Veo20t4xtSwJJ2MgCIbyIKWukVhdEmI4qsdid4hpv9iGiM4IhsL73eccelhGfTdCymSnWbBh6RDEOvS8cLX9tlXgRnTrsfHnRI4o7BaqKaKGYLvTqfF+q3KxYSYakHmMicBbPltr2aFdLQ4ai73.KBMQCdVnJvSjs0leZbHTOr9j7dSS4PwOHz9xwzZMvryZfo8ZfY20.Sm0.ydqAl8+hXjuV1q74LmvoIBCC6GbHcEk9TjnJKnhD7ePf2mN0
    


  • @ulrik or

    inline function onSELECTORControl(component, value)
    {
    	for (c in knbs)
        {
            knbs.indexOf(c) >= value ? c.showControl(false): c.showControl(true);
        }
    };
    


  • @ulrik Thank you 🙏 🙏 🙏 🙏

    Since your concept is much better than my attempt, I now have the following problem
    How do I get the value of one of the 16 knobs in your way?

    SliderPack1.setSliderAtIndex(c, value);



  • @MikeB

    inline function onknbsControl(component, value)
    {
        local index = knbs.indexOf(component);
        
        SliderPack1.setSliderAtIndex(index, value);
    }
    
    for (k in knbs)
    {
        k.setControlCallback(onknbsControl);
    }
    


  • @ulrik check if it's working with this Console.print

    Console.print("index:" + index + " value:" + value);
    


  • @ulrik It works fantastically - I thank you very much - you have saved me again many hours of try and error.
    I often simply lack the syntax - I have to work on that.
    I can do a lot myself, but often with 100 lines of code - while you show me here that it can also be done with 15 lines and much more elegantly.



  • @MikeB I'm glad I could help. 😀



  • @ulrik
    Sorry if I am annoying now 😬
    Is there a simple solution to return the value of a slider of the SliderPack to the knob?



  • @ulrik I save everything I learn in a specially created Ninox database on the Mac.

    • Text and image (for me as a visual person, the image is most important).
      Here I can quickly read the English and partly translated German texts.
      That helps a lot.

    Bildschirmfoto 2021-06-24 um 12.45.49.png



  • @MikeB this is a universal function that will return all values as an array, just set the SliderPack as an argument
    (in case you have more than 1 SliderPack)

    //  function, get all sliderpack values
    inline function getSliderPackValue(sliderpack)
    {
        local num = sliderpack.getNumSliders();
        local values = [];
        
        for (i = 0; i < num; i++)
        {
            values.push(SliderPack1.getSliderValueAt(i));
        }
        
        Console.print(trace(values));
        return values;
    };
    
    //  execute the function to get the values and store them in a variable
    local values = getSliderPackValue(SliderPack1);
    

    or store them in the knobs



  • @ulrik then you have to set the knbs to that value



  • @ulrik this is more simple

    inline function onSliderPack1Control(component, value)
    {
        for (i = 0; i < knbs.length; i++)
        {
            knbs[i].setValue(component.getSliderValueAt(i));
        }
    
    };
    
    Content.getComponent("SliderPack1").setControlCallback(onSliderPack1Control);
    


  • @ulrik Where do I put your lines now?
    This is how it looks at the moment!
    I have three song packs for note, length and velocity.

    inline function onselectorControl(component, value)
    {
    	for (c in myPads)
        {
            myPads.indexOf(c) >= value ? c.showControl(false): c.showControl(true);
        }
    };
    Content.getComponent("selector").setControlCallback(onselectorControl);
    
    
    
    inline function onmyPadsControl(component, value)
    {
        local index = myPads.indexOf(component);
        if (Button1.getValue()){
            component.set("min", -24);
            component.set("max", 24);       
            SliderPack1.setSliderAtIndex(index, value);
        }
        
        if (Button2.getValue()){
            component.set("min", 0);
            component.set("max", 127);
            SliderPack2.setSliderAtIndex(index, value);
        }
        
        if (Button3.getValue()){
            component.set("min", 0);
            component.set("max", 99);
            SliderPack3.setSliderAtIndex(index, value);
        }
        
        Console.print("Knob " + index + " Value " + value);
    }
    
    for (k in myPads)
    {
        k.setControlCallback(onmyPadsControl);
    }
    


  • @MikeB What is "Button1, 2 & 3?



  • @ulrik
    They are radio buttons that select which of the three slider packs are changed with the 16 knobs.
    Button 1 for SliderPack 1 for Note (-24 to 24)
    Button 2 for SliderPack 2 for Velocity (0-127)
    Button 3 for SliderPack 3 for Lenght (0-99)



  • @MikeB aha, same buttons for 3 different packs, hmm...let me think



  • @MikeB So you want the knobs to change values at the same time as you change the radio buttons?



  • @ulrik here ist the Snippet for better understanding

    HiseSnippet 2381.3oc4Zs0aaibElxxzqsx5bqYwt.8EBihB45rBRT9RRS2ZIeK1ariUsb7FfsEAzTCklXpgrji7Z2z.ru0W6OgBzW5Oih9ZeoOtO1G6iAn+.ZOyLjRintQJeY01x.3nyLy2Y9Nm4Lyb3LrhmiIx22wSI0bGeoKRI0GqV8RBswlMLvDk81RI0iT294GpUX0JF0dAw4TsiQ9TkMtz0v2GUSIUpzOm0xTyMsB+4CquggsAwD0oHEkSbvln8wMwzNkVozKv116XTCcLtoTqWtzdlNjMcrcZArJsZdEWCyyLpidoAqYSopjZlsqgoNdUoFTjuRpo2vo1kUa37MDQ6OA6iO0FwDJnTETjn3cbrqwXLqTkMafsqUIz58UTRoVoiuHsvW7H0Cv0vsKuiO497Jz5fP1ejZpgQuBxzKe7oWJI5MsfdOPspoG1k1oFF2ti5dDJxyx.FBjoknsJS8WlUcSGnEDZtlFmg1wCDZiHaA874er1J4yu3ylOi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yoVsQKKKaz3EgcGUwhUGiQCyDF9Ix9HvczDeLjyhTE8PmayyleT7MLgxAy2Or9jyId+P084Wzcr8t2LG8crlZ7.UXGBBAYWc.2ySelYzWE8opG1h51hdMotGndPksg8.7BUXOtvXN2+dLEsMo1.TyPVPUZZ2Lp6BaD2mor2ZIfmNdYQNhMjmKjiUwMcsQaSNGlXAkv33CU2BYYzxlFVZ26KefCwwsgCA2UZMGgnd350QcksTeMnxTJahP6RdToifPDCeI+4Ooz9XBxvC7SnwzWjfjSF130moJnqFKiWs+23EmR++8u3zvmgBuTvObFogUa8M003C2Ze+OdejSKJlT+.CX0.14ZvxgEdqPHeKwpt9g23afb9va5tJhTiKvNhufJKvjSETYgvJuU5ilFldNuwTrg.aAiY4k.1Mg+o1Om5ALYsNeo.p4ykWoI7hUuwzjES+4f+o+XzGCLEGCLKOFXVYLvr5XfYsw.ySFJF16zVtE0ooH9GJnx17a7OUJQlx7oBJ+WDo1AcJ
    


  • @MikeB can you send a snippet of what you have so far?


Log in to reply
 

12
Online

1.3k
Users

4.2k
Topics

38.3k
Posts