Has anyone made a custom PNG based keyboard ?
-
@lalalandsynth said in Has anyone made a custom PNG based keyboard ?:
I seem to recollect that you can make a keyboard using png´s
https://docs.hise.audio/ui-components/floating-tiles/plugin/keyboard.html
@lalalandsynth said in Has anyone made a custom PNG based keyboard ?:
Can I skip the native custom keyboard settings and make this entirely with panels
-
@d-healey The custom graphics one will not allow me to do the custom start and end notes , as far as i can tell , let me have a look at that video
-
The custom graphics one will not allow me to do the custom start and end notes , as far as i can tell ,
It's very limited. You can't do key colours either. I wouldn't use it.
-
Is it possible to make a custom keyboard and create a callback for each note and key(off the keyboard) on the onNoteOn and onNoteOff? Might take awhile but maybe?
The keys can be created separately then in HISE placed them together, basically making the keys Buttons.
Maybe…
-
@bwsounds said in Has anyone made a custom PNG based keyboard ?:
create a callback for each note and key(off the keyboard) on the onNoteOn and onNoteOff?
What do you mean?
-
-
It's very limited. You can't do key colours either. I wouldn't use it.
@d-healey Actually I think the best way would be to have a scriptable look and feel for it. I'm currently pretty busy, but if anyone might want to give it a shot, there's a guide of how to add scriptable look and feels here:
https://docs.hise.audio/glossary/add_custom_laf.html
The first steps are already done, so you just need to subclass this
from the script look and feel and register the methods.
-
@christoph-hart said in Has anyone made a custom PNG based keyboard ?:
Actually I think the best way would be to have a scriptable look and feel for it.
Oh that's a very good idea
-
@d-healey Ah, I just realized that it won't be of much use unless you can draw images in a look and feel callback which sadly requires my brain skills to implement.
-
@christoph-hart Yeah I see what you mean.
-
@d-healey Brain Skills -> Applied.
https://github.com/christophhart/HISE/commit/f4b0b1761b8db0000da3bc3b204fe078b93ab25c
-
@christoph-hart That was quick! :D
So this can be added to any LAF routine?
-
@d-healey Yup.
I also noticed that the keyboard look and feel methods are a bit messy, so I'll do it myself. Oh and I'll remove the non-vector default keyboard during the process, I don't think anyone uses them anymore.
-
@christoph-hart Will the Engine.setKeyColour() affect a LAF keyboard or will the LAF override it?
-
@d-healey Good call, I'll make sure it will get passed on as property into the call.
BTW, I've just pushed a preliminary version. This is a example use case:
laf.registerFunction("drawWhiteNote", function(g, obj) { g.setColour(obj.hover ? Colours.yellow : Colours.white); g.fillRect(obj.area); g.setColour(Colours.brown); g.drawRect(obj.area, 1.0); g.setColour(0x22FF0000); if(obj.down) g.fillRect(obj.area); }); laf.registerFunction("drawBlackNote", function(g, obj) { g.setColour(obj.hover ? Colours.yellow : Colours.black); obj.area[1] += -4.0; obj.area[3] += 4.0; g.fillRoundedRectangle(obj.area, 3.0); });
-
And this is how you use it with filmstrips:
const var laf = Engine.createGlobalScriptLookAndFeel(); for(i = 0; i < 12; i++) { // use whatever prefix you want var prefix = "{PROJECT_FOLDER}Oink/"; var d = "down_" + i; var u = "up_" + i; laf.loadImage(prefix + d + ".png", d); laf.loadImage(prefix + u + ".png", u); } laf.registerFunction("drawWhiteNote", function(g, obj) { g.setColour(Colours.black); var x = obj.down ? "down_" : "up_"; x += obj.noteNumber % 12; g.drawImage(x, obj.area, 0,0); // fill the key color if it's defined if(obj.keyColour) { g.setColour(Colours.withAlpha(obj.keyColour, 0.2)); g.fillRect(obj.area); } // draw the hover state if(obj.hover) { g.setColour(0x33000000); g.fillRect(obj.area); } // Add the C octave numbers using the best font available if(obj.noteNumber % 12 == 0) { obj.area[3] -= 4.0; g.setFont("Comic Sans MS", 14.0); g.setColour(0x77000000); g.drawAlignedText("C" + parseInt(obj.noteNumber / 12), obj.area, "centredBottom"); } }); laf.registerFunction("drawBlackNote", function(g, obj) { g.setColour(Colours.black); var x = obj.down ? "down_" : "up_"; x += obj.noteNumber % 12; g.drawImage(x, obj.area, 0,0); if(obj.keyColour) { g.setColour(Colours.withAlpha(obj.keyColour, 0.3)); g.fillRect(obj.area); } if(obj.hover) { g.setColour(0x33FFFFFF); g.fillRect(obj.area); } }); for(i = 60; i < 72; i++) Engine.setKeyColour(i, Colours.green);
-
@christoph-hart said in Has anyone made a custom PNG based keyboard ?:
var x = obj.down ? "down_" : "up_";
I had no idea you could assign with the ternary operator in this way. I have some edits to make to my scripts!
-
@christoph-hart Does it only work with New Layout branch or Develop branch ? Or it will work with Master branch as well?
-
@dabdab Only new_layout for now
-
@matt_sf OK. Thank you :)