Floating tile keyboard lowest key
-
I'm sure this worked for me in the past but using
Engine.setLowestKeyToDisplay();
isn't making a different to the floating tile keyboard on my UI. -
That‘s deprecated because with the floating tile system you can have multiple keyboards so a global lowkey property doesn‘t make sense anymore.
-
@Christoph-Hart I see, so how do I access the LowKey property of the tile?
-
There is a "LowKey" entry in the Keyboard-FloatingTiles
Data
property settings.You could obviously also set this via script:
const var FloatingTile1 = Content.getComponent("FloatingTile1"); // Keyboard const var datadump = FloatingTile1.get("Data"); Console.print(datadump); FloatingTile1.set("Data", '{ "KeyWidth": 14, "DisplayOctaveNumber": false, "LowKey": 36, "HiKey": 127, "CustomGraphics": false, "DefaultAppearance": true, "BlackKeyRatio": 0.69999999, "ToggleMode": false, "MidiChannel": 1, "UseVectorGraphics": false, "UseFlatStyle": false, "MPEKeyboard": false, "MPEStartChannel": 2, "MPEEndChannel": 16 }');
right now, its just a string that is then parsed as JSON.
Question: Couldn't this also be done with a dict or an object to access the values individually? a là:Data["LowKey"]
?atb,
d -
The JSON thingie that you use with the
set()
method must be a String to enable the interface designer input box. Whenever you want to customise a FloatingTile via scripting, use theFloatingTile.setContentData()
which takes a native Javascript object:var funky = { "Type": "Keyboard", "LowKey": 36 }; FloatingTile.setContentData(funky);
-
@Christoph-Hart I just used this approach but it seems that I can't change the LowKey by itself, I have to also specify all of the other properties too, is that correct?
If that is the case then agetContentData()
function might be handy.Edit: Never mind, realised I can use
.get("Data")
. -
Should work.. only thing is, that the "Type" is mandatory.. btw: little naming inconsistency with the Component Specific Properties Panel. There the FloatingTile-Type is called
ContentType
.var funky = { "Type": "Keyboard", "HiKey": 19, }; funky["HiKey"] = 36; Console.print(funky["HiKey"]); FloatingTile1.setContentData(funky);
greet,sd
-
Well I hit a little snag, using
get("Data")
returns a string rather than an object so I can't access individual properties without some serious string manipulation. So I retract my previous retraction and think agetContentData
function that returns an object would still be handy.I only want to change the low key when a button is pressed but if I just use your example:
var funky = { "Type": "Keyboard", "HiKey": 19, };
Then all the other properties I've set in the interface designer are reset to their default. So I have to set every single property in the script every time I want to change one property. My solution is to store all the properties as a global object and just update it and pass it to the tile as needed but it's not the cleanest solution.
-
I think your solution works quite well.. I compiled a plugin and the performance overhead is quite small and actually, runs smooth.
/+ finally a fascinating method to leverage that weird BlackKeyRatio animation..
Content.makeFrontInterface(600, 500); const var FloatingTile1 = Content.getComponent("FloatingTile1"); const var Knob2 = Content.getComponent("Knob2"); const var LFOModulator1 = Synth.getModulator("LFO Modulator1"); Globals.funky = { "Type": "Keyboard", "KeyWidth": 14, "DisplayOctaveNumber": false, "LowKey": 34, "HiKey": 127, "CustomGraphics": false, "DefaultAppearance": true, "BlackKeyRatio": 0.69999999, "ToggleMode": true, "MidiChannel": 1, "UseVectorGraphics": false, "UseFlatStyle": true, "MPEKeyboard": true, "MPEStartChannel": 2, "MPEEndChannel": 16 }; inline function onKnob1Control(component, value) { Globals.funky["LowKey"] = value; FloatingTile1.setContentData(Globals.funky); }; Content.getComponent("Knob1").setControlCallback(onKnob1Control); inline function onKnob2Control(component, value) { Globals.funky["BlackKeyRatio"] = value; FloatingTile1.setContentData(Globals.funky); LFOModulator1.setIntensity(value); }; Content.getComponent("Knob2").setControlCallback(onKnob2Control);
HiseSnippet 1841.3oc4YrsaabbcVJstQzUtQIFoIuTLfnEfpwUgjVVtw4hoDkjihkrHLUbhiQfwvcGRNP6NylcGJYZCC3W5ePA5q8SQu2eh7Ij+.2yYmk6EIJIpHmBGz8ACNmay41btH2NT4vihTgDq41aT.mX86s6LRpGzZ.SHIasNw5Z16vhz7PpAzZiBXQQbWhk0L2CAXM2rj3ue9tqw7XRGdFHB4QJgCeaguPmAscy6K771j4x2S3mi5katkiR1R4oFB5yL10HALm8Y84OfgjUxlXckMbEZUXGMSyiHVytlxcTmApCkF5ejHRz0iiGpS5.Bx.dSkmKpwHTRqABO21is6HBwxtclWXFiW3516HbEovy7FuaLBZFG48GVkNK0qdd0q1DUuZSR8rxodyZTuEr63DJBzYXPc6p1aIg.UOFDBxqVF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