Pitchwheel & Modwheel graphics &linking.



  • hello !
    linking modwheel & pitchwheel with graphics is not implemented yet ?
    is there a way to do this with script ?

    thanks.


  • administrators

    That should be easy to achieve. Just update your graphics from the onController() callback:

    Pitchwheel

    Content.makeFrontInterface(600, 500);
    
    // This is important or it will render the graphics on the audio thread...
    Synth.deferCallbacks(true);
    
    const var ModwheelDisplay = Content.addPanel("ModwheelDisplay", 38, 60);
    // [JSON ModwheelDisplay]
    Content.setPropertiesFromJSON("ModwheelDisplay", {
      "width": 50,
      "height": 180
    });
    
    
    // [/JSON ModwheelDisplay]
    const var PitchWheelDisplay = Content.addPanel("PitchWheelDisplay", 110, 60);
    // [JSON PitchWheelDisplay]
    Content.setPropertiesFromJSON("PitchWheelDisplay", {
      "width": 50,
      "height": 180
    });
    // [/JSON PitchWheelDisplay]
    
    ModwheelDisplay.setPaintRoutine(function(g)
    {
    	g.fillAll(0xFF222222);
    	g.setColour(0xFF666666);
    	
    	var h = this.getValue() * this.getHeight();
    	
    	g.fillRect([0, this.getHeight() - h, this.getWidth(), h]);	
    });
    
    PitchWheelDisplay.setPaintRoutine(function(g)
    {
    	g.fillAll(0xFF222222);
    	g.setColour(0xFF666666);
    	
    	var h = 0.5 - this.getValue();
    	var offset = Math.min(1.0 - this.getValue(), 0.5) * this.getHeight();
    	
    	g.fillRect([0, offset, this.getWidth(), Math.abs(h) * this.getHeight()]);
    });
    
    function onNoteOn()
    {
    }
    function onNoteOff()
    {
    	
    }
    function onController()
    {
    	if(Message.getControllerNumber() == 1) // Modwheel
    	{
    		ModwheelDisplay.setValue(Message.getControllerValue() / 127.0);
    		ModwheelDisplay.repaint();
    	}
    	if(Message.getControllerNumber() == 128) // Pitchwheel
    	{
    		PitchWheelDisplay.setValue(Message.getControllerValue() / 127.0 / 127.0); // 14bit resolution
    		PitchWheelDisplay.repaint();
    	}
    }
    function onTimer()
    {
    	
    }
    function onControl(number, value)
    {
    	
    }
    


  • thanks !
    i will use png grafics (filmstrip) instead of paint grafics.
    some modifications to do.
    i'll do this this afternoon.



  • not working for me ... 😞


  • administrators

    What is not working for you? The example above or your filmstrip implementation?



  • in your example: onController() callback <= maybe made mistake here.
    in my example: using graphical png knob/slider linked to CC1 &CC128 => made more mistakes i feel 😄



  • don't find the solution.
    If someone has already used it or have an example... thanks in advance.


  • administrators

    You really need to be more precise what's not working. "Made more mistakes" is pretty vague 🙂

    Please post your script and the error message from the console, otherwise it's just shooting in the dark.



  • ok i'm just the stupidiest man in this world. i put the controller script in the init, and wrote an "exotic" script in Controller.
    your code with your grafics works now.
    so i'm actually try to replace your paint graphics by a .png filmstrip



  • This post is deleted!

  • administrators

    Ah OK, you've pasted the entire code in the onInit callback, however this was supposed to be the whole script (you've ended up with two onController definitions and the empty one overwrote the one you've pasted.

    Just use this snippet:

    HiseSnippet 1113.3ocsVs0aaaCElJIZXV6BVG16kHOIO35HkaMnAAq4RcZ1lSBpyRKPQQGsDkEQjHMnnZpaQ9Ou+AaGJZE4XqjZOfR3GLO2324SGxy4boHflkIjHqu6hQCoHqu2t2HtJ9vXBiiN4Hj0OZ2kjonRrQzAiFRxxngHKqkOVKvpwJnh0+7aGPRH7.ZkHD5RAKf9mrTlpR5e+7+fkjzgDRufkNg0a97SBD7CEIhb.OKa6gFRBthLfdJQa1R1nOvnWmgr7r2X81xq76+o8aqWG0tbcgW+qN43W16u5D7oqRHocOVKEEjKkTt5Rvcjks0+BKK6WDxTBYOEQQgXtxAhvQ8hEWyMG8krLV+DpdiOpGfIi3S3.UDQBnSXJ5vXVR34kTYFBh14UD6xFh8Wr6xBY2Juhf+oBE3JOljhsV5gfo+8AyNhjPc.tG3YMA7Vw.uGY2KPxFppznw1OOV58fNiRzRO9arOT.LCW0NkbEsiD1bKS4tsmWK7VddM20wYs0vWDyxv5eoCEREgqvBIlovWCEEX3yTHTqoho3ARxvXVPFVvK1SxCYB3eRJID9n5TTm1NjFQkGRRR5C0JYtJYNUeNPgTlB+AhD2UDdcLklbDKaXBYDdObITIggmS3zD2UmxlUag2XmV3s0HF.7a+8dmc5zw4cNkgIipIsgTohQyfTOUadcw7yNX7pWyBUwq9LfOZo2FSYChUvd+c7btQi7hSbs5Oxpr5blJH90eo7ZFq.T366McpMiYewjqt.OWoWUxUyg5LUBWb5v0D0qD4JFm5FkyCTLA2cPSmO6zXP6HnlY+jDWuO1oy5EK3L.4fil2QJzrcwRqwogl7hAxRAUgsGPUWRRxotMw+5sRdYAlcMlaNhWQCTtuE3sosA+DbbkzWqSd2lsvwuq4tMLeNmIM+ZlTds2BPzTo1tF8hnHH.fQcIv0lTF20us2rV2RGj4kNLwrFBn3LH8ybiqKT.6XHmxTGthepPQOi6VPAN2Lilnn5ToqRkhjDpznkE41EdkBZYnOtJsmlm1WaCdu8v9MwPQXYklSCvsF0T2YniZiVYIyZX+0eZa8MoYifjNT+Mtf1tYNA156T.shJlI.WsUPyO7pfoN39a1GdpURyDI4ZRr13eWveGFW2wV9.eJb4EYTK3QJ.Ek1AMhtaaLm4qMVf4UnILTvOgyTmMjd6dSgSoDOzsELSJphclTZQxTiYUhls2IZ7Kiv+lsIJzJWDlmPT2s+tdNowJ.x5NcP0cI4YL0nImiZAZ56UaSe+5.9bB2GYWTPTOdWpF7ByS70FuiGg5GreQTD71SEXWwtya9+NuzB.EyS0CfW0jrOBSPBWa6AuCGPAjvgNsY5oJWRWbX16o2qYldv3LdkibNVoudu0Xk9kJQoj.o38AlJP8PZeagD.S7hwea.ygC6w9nhqVFbmBSN99f.MQ7D.406w5KrGarvdr4B6wVKrGauvd7zE1icd.OziouetRjZtVfP+2meqMk
    

    Copy this into the clipboard, then File -> Replace with clipboard content.

    (Note to myself: never post a entire script again) 🙂

    Also you've got some weird syntax errors in your script, so it's no wonder it isn't working (basically you're approach should be correct though).



  • lol,
    i just edited my previous message to say like you that i place all codes in OnInit. Stupid i am !!!

    no, you can post entire script, but not for a "Forrest gump" like me 😄

    ok. try to replace by .png filmstrip image now

    EDIT:
    ok, working with .png images. at this time it's a knob. So i have a question. Modwheel and Pitchwhell are not the same. For modwheel i will create a wheel starting to 0 (down) and going to 127 (up). that's ok. But for the pitch i must do another wheel starting at center or the same wheel will be "centered" (like the knob ?)


Log in to reply
 

2
Online

315
Users

914
Topics

5.9k
Posts

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