MIDI Remote: Knob label content and how to access it

@Jochen_Trappe - it appears that making a knob automatically includes making an associated label below the knob, such as:

image image image etc.

Is the label the same as an instance of mSurface.makeLabelField.relateTo(knob), or is it something else? The reason I ask is that I’d really like to be able to access the label’s name property and assign it to a variable, along the lines of:

var knob = deviceDriver.mSurface.makeKnob(x, y, w, h)
var knobLabel = knob.mKnobLabel.value

Obivously, mKnobLabel doesn’t exist, but there must be something similar for the MIDI Remote Script to include it in the hardware surface emulation. Is there a way to access it? If not, I’ll tag this as a feature request. Note that I’m not wanting access to change the label’s name property, I just want to create a variable string that uses the name property.

Looking forward to hearing from you, or any forum member who can answer these questions!

Hi @ScottStick,
I used to think the related label field would have the same label, but after paying attention to the builtin knob labels on my surface, I quickly found out that’s not the case: For the first insert effect parameter of the builtin compressor, the builtin knob label states “Threshold”, the related LabelField shows the corresponding track name, and the knob’s mSurfaceValue.mOnTitleChange() is invoked with “Compressor”, and – oh, I see – a second parameter which I never considered: “Threshold”! :tada:
So to answer your question, you can access the builtin label’s text via mOnTitleChange():

var knob = deviceDriver.mSurface.makeKnob(x, y, w, h)
knob.mSurfaceValue.mOnTitleChange = function (activeDevice, title1, title2) {
  activeDevice.setState("knobLabel", title2)

Now, in any callback that gets activeDevice, you can use activeDevice.getState("knobLabel") to get the current label.

Hi @bjoluc!
That’s some brilliant detective work and an elegant solution. You’re a :star:

I really appreciate the time you took to respond and your willingness to share your knowledge.

Kind regards,

1 Like

Thanks for the kind words @ScottStick! :blush: