Code a midi cc direct to a slider?



  • Code a midi cc direct to a slider? Or does it need to be midi learned from the interface?



  • @tod-slaughter you can code it, just set the slider's range to 0-127 and in the on controller callback assign the CCs value to the slider


  • administrators

    Yes, you can use the onController callback for this:

    function onController()
    {
        if(Message.getControllerNumber() == 71)
        {
            Knob1.setValueNormalized(Message.getControllerValue() / 127.0);
        }
    }
    

    EDIT: David was faster than me, but my solution works with all slider ranges 🙂



  • @Christoph-Hart

    Unfortunately that doesn't work for me

    HiseSnippet 1204.3oc2X8zaaTDEeV6LsXWbfJBRbBsJBjbDgfcZZJHTUbhSbkUiiMYSCTwgxjcm0dT1clkcmMfopRbgy70gOF7ofKboG3N7lYs8ttrjX6FnUrQZkeu48dyu48u4soWnvlFEIBQFkNYX.EY7lXqgb4flCHLNp89HikwcHQRZnYBq8FFPhhnNHCihOPwvnzRH8yy2YOhGgaSSYgPmJX1zCY9LYJ2dMdHyyqEwgdByOiza0nssf2T3IhA7TDWCEPrOmzmdDQIVALx3FG3vjhPKIQRiPFKsmvYn0.w2wSj+TVD6LOphnNxBLTB6VBOGEhU+F0b.yyo23ycDBYf6k5EJl3EVA2g4vlvO0a715ELS0Hq+vnvkAu5KH7Lx.ukRf2swV1gr.Y5JJrcKbaNDnbIPHHKrRjEUv0.2T.Rvka3SNm1JDHlnQ0sqUacy6Vq1Zedkxp+FKJww4gbwYUW8b3c8UW2rtRP30ZtwbaISvME7iDRZWd00J+zxkJ+rxu3Jtt4sjZGBEddzvpqUo7SqT1DdXtU6.GIHpuQepLUjih8OSIn48uuY80RjcjJpGEDquQDUdJwKldjHzm3w9ApS9FSKDXqOwr9l2aC8QVYjmUYZ.pROCuDjWkqA05lWnr2X4fnzzoA2X1RCrSb3YDTvayYxtAzQzoIJ0yIQAMJhoRYFAPPToNgY4QILVdLGZHhAF4lXc.Eowd1RVziZuOQRFaFvhvtDPCkL0gwXe5EPIcRdXI79znykh.sr9ABtZ+Mt4Utoe+jMrwiaLbBwO93FAiOQsAweK7gs5Z1Q3D6Q.GJzOHDZE.YrpESR24QL4PjOQawi+k2+m98u3O1A82KYfB2wlIa0rpE1nEfP6TkMoVOSKt4nDuVtk34F4lQ3dabOlzdP93sPN3Ehg+ai2QMLqfOv0kZKSA6R3Ve0h1cbwfxxIP4VXKFmpuESCj2USa9kjKnlOfxog5To+46w90Y8drfY9drt1RX2OIjviBDQSYXKpO6DntIJKyGEAcmoe6wpfbV9MEjvbW546zBNi4piEQFGpyV10WDykSkcTbgtvZ5hlLxmysWK8J3x0q+JuW9FEEmM3dE2+WZLFsX9AdzC3WP8fdyi5NrO0kD6ImvMKH6H3hfABNyNaBvwTYHqeeZXVnm64YWoDFFKkyJMNl5QIYSl+fFGBIgjPvMQWPWQ8Y2UbYgq2Cm.WSUgo4+O5uW7ks+9BNxYkD.iUWEqQ4Kdo7UhQUaoXJ2dLyuw82VsgpsY6zttM94FpFztvfaiFsXRH4PZeXexx4DJLpAzfepTYKegPNfw6Ocy3UZbnPDb.m.dAmrFoYbjT3OdSQFeHdys1X5mK5Bub+H0O+rlZZjkjFnmNx3qwaqkOy52o60CM55qhovLl58N5f5jvmJ79ZdwRBhmja8ZBheUONzwhXITCzg.80gQhwvmMYAigXSAjv4TOXivFETiRjPWSQmLGB2QS7mvynEqqnMFsX8wK9exd3SrCEOwN4yXTIxuglCbt45+Y.kvcTzlS99EkuwGld3I11Jm8GCdm70Xy4Vi6L2Zr0bqwcmaM1dt03dysFe5kngZTscigVnI2TAL5cPRmQiIcaMJh9K.sre0BA
    
    


  • @tod-slaughter Hi Tod. Don't use addControl in your main interface script, add all of your controls using the interface designer. Then in your script use content.getComponent() to get a reference to the control and store it in a variable. Your use of addControl isn't the problem here though, it's just not best practice.

    The problem here is you haven't got a reference to Knob1 so in your onController callback there is nothing to assign the value to. You need to do const var Knob1 = Content.addControl() or use getComponent as I mentioned above.

    After you get a reference to the control you will hit another problem, the middle value you have set for the knob is invalid, it must be set to a value between the knob's minimum and maximum.


Log in to reply
 

1
Online

325
Users

969
Topics

6.4k
Posts

Looks like your connection to Forum was lost, please wait while we try to reconnect.