Custom Keyboard - bug in compiled product
-
So I'm using a custom keyboard with LAF - it draws keys as circles and colours these, then flips them to white when the MIDI note arrives and back to its colour when the MIDI off arrives.
This works fine in HISE, but in the compiled product it sometimes(on quick note playing) fails to flip the colours back on MIDI note off...it only flips them back on mouse over..
-
@Lindon Need to see some code
-
@d-healey sure..
namespace keys { for (i = 36; i<68;i++) { Engine.setKeyColour(i,0); } const var KeyboardTile = Content.getComponent("KeyboardTile"); const keyboardLAF = Content.createLocalLookAndFeel(); keyboardLAF.registerFunction("drawWhiteNote", function(g, obj) { var a = obj.area; //Console.print(trace(colourSet)); if (obj.noteNumber-36 <= colourSet.length-1 ) { g.setColour(colourSet[obj.noteNumber- 36]); }else{ g.setColour(0xff333333); } g.fillEllipse([a[0]+9,a[1]+32,5,5]); }); keyboardLAF.registerFunction("drawBlackNote", function(g, obj) { var a = obj.area; if (obj.noteNumber- 36 <= colourSet.length-1 ) { g.setColour(colourSet[obj.noteNumber- 36]); }else{ g.setColour(0xff333333); } g.fillEllipse([a[0]+6,a[1]+15,5,5]); }); KeyboardTile.setLocalLookAndFeel(keyboardLAF); }
-
@Lindon I'm not seeing anything in there to differentiate between on and off.
if (obj.down) etc.
-
@d-healey - I see what you mean - strange tho as it works correctly...
still, did you mean something like this:
keyboardLAF.registerFunction("drawWhiteNote", function(g, obj) { var a = obj.area; if (obj.noteNumber-36 <= colourSet.length-1 ) { if(!obj.down) { g.setColour(colourSet[obj.noteNumber- 36]); }else{ g.setColour(0xFFFFFFFF); } }else{ g.setColour(0xff333333); } g.fillEllipse([a[0]+9,a[1]+32,5,5]); });
-
@Lindon - hmm that makes it worse not better....now its doing it nearly all the time...
-
@Lindon - yeah now its producing all sorts oh half drawn artifacts..
-
@Lindon I'll take a look when I'm back home in an hour or so
-
@Lindon This is how I would do it. Set all of the key colours outside of the LAF function (unless you need them to change to some other colour). I don't have access to your colourSets array so I've just added some placeholder code.
To solve the half drawn artefacts you need to increase the key width in the floating tile's properties.
HiseSnippet 1292.3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ZHwvz3bXwUBWc2QV9y+XmTvj7kKLZKHWzI64Kq4cccuEcGZCzer1au81ebRsqjpN1YM+Z8Xmy.RbNXleyv7SEnTrO16Q.s3V.CrrcITWcQTfOa3INZ1koDYvrGCZlFa+P0UPXfpMiE2WjHAc2ikqMHRq5+5PVPWgSzDQVm6wF3q2MHfyBwm2mvZ78ZXudKjUUfE6xU2L92FaXu9l1qWI1qSUc53yOR4NYv3ypvyrRI2GwRrt2EwOi6.btbfQGNfmYroOS2VOz+N6TqFY0f6pG3tg5wekUxz2P5l6aWsvMHsaDs4YeFZy2YlWUEj2XZ7WYblsLFwgSnHeS7HDsgxJPxmfk.g7.rjrB+cXIYpI2eTAXHEk6.H4L4jK3HZoFfa7SLt.NRfLRnGleDtufwYrezwYdpPbAyVBsS2GFiy7.XD5E7+AFmMqP0vyC3eiA3blM+0ochuOym+spAHCBFBJTfDH3daBEIkXFgboYv9gIx1nLlAZyktwBXaiTiUPYiTiUxLR5ybBUezIoOONl4yh0.XRFOUsk4QnLsBIt2ODmocYaReft9QGG73+SPK5GNlUlhXVcJh4ESQLqMEwTcJhY8oHlMdzXvNE6N.ZGmbc.TzpQ7C.FFMjLfYEyBI+CXaTSSC
-
@d-healey thanks for this - however this make no difference to the problem in the compiled version...its still randomly failing to change the colours on key press/release, especially for very fast key sequences...
-
@Lindon It works here compiled as standalone. Can you send me a MIDI file that triggers the glitchyness and I can try it in a plugin version. Which DAW are you testing in?
-
@d-healey - well I should have been more clear
- your example compiles and works fine
- but its missing a lot of functionality in that the colour set used changes based upon the number and sequence of samplers the user has inserted...
- so I added your "?" operator to my code and it still breaks - this may be because I'm changing the displayed colourset dynamically
I'm using the ever reliable Reaper by the way - not that this is the problem..
-
@Lindon If you can show me exactly what you're doing I can take a look. You could send me the project in a pm.
-
@d-healey sure I'll do that...