How to set a value, e.g. mPan

Hi,

I am trying to figure out how to assign a value without some kind of binding. e.g. to mPan.
Is there a way to set mPan to an absolute value e.g. 0.5 to center it? I can only see these two methods:

	increment (activeMapping: MR_ActiveMapping): void

	decrement (activeMapping: MR_ActiveMapping): void

And those two methods require an activeMapping!? Why do I need a mapping here or how can I create it? Is there a way to increment by a certain value?

Hi and welcome to the forum,

What is your use case, please?

Do you mean the binding to the MIDI Message or the bindings to the function?

Hi, thanks.

Basically I just wanna do something like:

...mPan = 0.5
and
...mPan.increment(0.1)

Hi,

You can do something like this:

// Surface Layout
surfaceElements.panElement = surface.makeEncoder(0, 0, 1, 1)
surfaceElements.panElement.mSurfaceValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(0, 0)

// Host Mapping
var selectedTrackChannel = page.mHostAccess.mTrackSelection.mMixerChannel
var customPannerValue = deviceDriver.mSurface.makeCustomValueVariable('customPannerValue')

page.makeValueBinding(customPannerValue, selectedTrackChannel.mValue.mPan)
surfaceElements.panElement.mSurfaceValue.mOnProcessValueChange = function (context, value) {
	customPannerValue.setProcessValue(activeDevice, 0.5)
}

For the Decrease/Increase purpose it’s good to use the .setTypeRelativeSignedBit() when you do the MIDI binding:

knobStrip.knob.mEncoderValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(0, knobIndex).setTypeRelativeSignedBit()

Btw, the 0.1 value is quite abstract. It’s going to be different amount for eery single parameter. For every parameter 0 = minimum value; 1 = maximum value. But every single parameter could have own scale, or own number of steps.

1 Like

Thank you. This is working. Altough I can’t say that this is nice or simple.

btw. context should be activeDevice