Zoom and Project scroll using knobs

Hi!

Just started using remote scripts with a special idea in mind. I have a Monogram Creative Console with 3 knobs. Using Cubase it’s only possible to Zoom In our Out when assigning a command to a knob but not zoom out when knob is turned left and zoom in when knob is turned right. I also want to do this for project scrolling for one knob.

I imagine scripting should allow this one way or another but haven’t figured out exactly how. The knob needs to be relative and it needs to send a command for “Zoom in” when values are decreased and “zoom out” when values are increased.

Not sure exactly from the Api reference (that would need some further details btw) how this would be achieved :thinking:

Have a look here. If you can figure out how to make this work via script, please share!

2 Likes

Oh thanks! That looks really promising :tada:

Awesome, this work! Just need to change the knob to relative but got the zoom to work. Will post when I have a finished piece of code.

1 Like

Here’s some working code for setting one knob to zoom and one knob to nudge (move project cursor) if it helps anyone in the future:

//-----------------------------------------------------------------------------
// 2. SURFACE LAYOUT - create control elements and midi bindings
//-----------------------------------------------------------------------------

// create control element representing your hardware's surface
var knob = deviceDriver.mSurface.makeKnob(0, 0, 1, 3)
var knob2 = deviceDriver.mSurface.makeKnob(3, 0, 1, 3)

// bind midi ports to surface elements
knob.mSurfaceValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(0, 42).setTypeRelativeBinaryOffset();
knob2.mSurfaceValue.mMidiBinding.setInputPort(midiInput).bindToControlChange(0, 44).setTypeRelativeBinaryOffset();

//-----------------------------------------------------------------------------
// 3. HOST MAPPING - create mapping pages and host bindings
//-----------------------------------------------------------------------------
var page = deviceDriver.mMapping.makePage('Default')

// Nudge Knob
var nudgeLeftVariable = deviceDriver.mSurface.makeCustomValueVariable('NudgeLeft')
var nudgeRightVariable = deviceDriver.mSurface.makeCustomValueVariable('NudgeRight')

page.makeCommandBinding(nudgeLeftVariable, 'Transport', 'Nudge Cursor Left')
page.makeCommandBinding(nudgeRightVariable, 'Transport', 'Nudge Cursor Right')

createCommandKnob(knob, nudgeLeftVariable, nudgeRightVariable);

// Zoom knob
var zoomInVariable = deviceDriver.mSurface.makeCustomValueVariable('ZoomIn')
var zoomOutVariable = deviceDriver.mSurface.makeCustomValueVariable('ZoomOut')

page.makeCommandBinding(zoomInVariable, 'Zoom', 'Zoom In')
page.makeCommandBinding(zoomOutVariable, 'Zoom', 'Zoom Out')

createCommandKnob(knob2, zoomInVariable, zoomOutVariable);

/**
 * @param {MR_Knob} knob
 * @param {MR_SurfaceCustomValueVariable} commandIncrease
 * @param {MR_SurfaceCustomValueVariable} commandDecrease
 */

function createCommandKnob(knob, commandIncrease, commandDecrease) {
  knob.mSurfaceValue.mOnProcessValueChange = function(activeDevice, value) {
    if(value === 0 ) {
      commandIncrease.setProcessValue(activeDevice, 1)
    } else if (value === 1) {
      commandDecrease.setProcessValue(activeDevice, 1)
    }
  }
}
5 Likes