Midi Remote "Host Value Variables" question

I’m trying to control my jog wheel using 4 subpages for FX sends, and a 5th subpage to control cubase zoom in/out.

I’m not sure if or how I should be using “host” custom variables. I need to assign a function to the knob onProcessValueChange somehow.

When I set var_knobJogWheel.mOnProcessValueChange, the assigned function never gets executed. Meanwhile, I don’t know how to bind knobJogWheel.mSurfaceValue.mOnProcessValueChange directly to a subpage.

// jogwheel knob
var knobJogWheel = deviceDriver.mSurface.makeKnob(4.0, 4.0, 2.0, 2.0)

// create custom var to intercept jogwheel value
var var_knobJogWheel = page.mCustom.makeHostValueVariable("JogWheel Position")

// create jogwheel subpage area
var area_JogwheelSubPages = page.makeSubPageArea('Jogwheel Subpage Area')

// create and assign subpages for each aux button
var subpage_JogwheelFXSendMode = []
subpage_JogwheelFXSendMode[AUX1] = makeFXSendSubpage(AUX1, area_JogwheelSubPages)
subpage_JogwheelFXSendMode[AUX2] = makeFXSendSubpage(AUX2, area_JogwheelSubPages)
subpage_JogwheelFXSendMode[AUX3] = makeFXSendSubpage(AUX3, area_JogwheelSubPages)
subpage_JogwheelFXSendMode[AUX4] = makeFXSendSubpage(AUX4, area_JogwheelSubPages)

// create extra subpage for jogwheel zoom mode
var subpage_JogwheelZoomMode = area_JogwheelSubPages.makeSubPage('Jogwheel Zoom Mode')

function assignZoomToJogWheel() { 
    page.makeValueBinding(knobJogWheel.mSurfaceValue, var_knobJogWheel).setSubPage(subpage_JogwheelZoomMode)

    var_knobJogWheel.mOnProcessValueChange =        
        function(context, activeMapping, newValue) {    
            // zooming code, never gets reached...?????
        }   
}

And when the zoom button is pressed I’m calling:

subpage_JogwheelZoomMode.mAction.mActivate.trigger(activeMapping)

I can’t find any documentation on host value variables. But that’s the only type that seems to be allowed by page.makeValueBinding(surfaceValue: MR_SurfaceValue, hostValue: MR_HostValue).setSubPage()

Binding the code directly to the knob works, but causes the zooming to happen at the same time as the FX sends. Can anybody see what’s wrong with this code?

image

(this is what Cubase reports when turning the zoom knob)

Tried this?

page.makeValueBinding(knobJogWheel.mSurfaceValue, var_knobJogWheel).setSubPage(subpage_JogwheelZoomMode).mOnValueChange=function(activeDevice,activeMapping,value,diff){
console.log("val="+value)
}

This is correct. Custom host Values are indeed “undefined” values.

You can flag when these subPages are activated and ignore the binding for the zoom:

subPageSend.mOnActivate=function(activeDevice,activeMapping){
activeDevice.setState("subPageSendActivated","1")}

subPageSend.mOnDeactivate=function(activeDevice,activeMapping){
activeDevice.setState("subPageSendActivated","")}

//in mOnProcessValueChange
if(activeDevice.getState("subPageSendActivated")=="1"){return} else 
//place the rest here 

YES THIS WORKED! .mOnValueChange!

page.makeValueBinding(knobJogWheel.mSurfaceValue, var_knobJogWheel).setSubPage(subpage_JogwheelZoomMode)
  .mOnValueChange =
     function(activeDevice,activeMapping,value,diff){
       // .....
}

I’ve been staring at this for so long, I just missed that little bugger! Thank you!

Here’s the final fully functioning, refactored, commented version of the code!

Tascam_US-428.zip (8.6 KB)

Cool! If you feel safe about the functionality (I mean no serious bugs, I haven’t noticed something bad), why not posting your remote to the dedicated shared-midi-remote tag? Who knows, maybe there are other guys with the same console, who would like to take advantage of the midi remote :slight_smile:

I’ll test it a bit more and ship it on Monday!

Maybe there’s somebody out there as crazy as me:


But seriously, this code could be adapted to a lot of devices I think, just by changing the MIDI CC values…

I did some cool stuff with the “assign” mode across the whole board … and that master “REC” button is your “mastering” button… instant on/off toggle for your master bus glue

1 Like

I see two consoles. What’s the usage of the second one? A normal audio?

One is going to live at the desk, and one in the live room (mostly by the drum kit).

Plus I put so much time into this, I figured a backup was in order.

Can’t thank you enough for your help man.

I was just thinking whether combining the two in the same remote could be of interest to you. Not sure if you’re aware of it, but you can have multiple in/outs in a remote script, and perhaps open new horizons :slight_smile:

I might do that later on! 16 channels and a second encoder bank for Quick Controls…

For now my brain is toast haha I gotta record some music asap :guitar:

1 Like

My suggestion too! Don’t let scripting take more time than needed :wink:

Cheers to that

I must say I’m overwhelmed how much brain power and time you put into helping a complete stranger reach a goal. You da man :melting_face:

But I’ve been coding since I was 4 years old. My dad would spank me if I left spaghetti on the table.

Is he into coding too?

Oh yes. I inherited his Zenith 286 PC back in the 80’s.

I’m mostly into music: www.paulwarner.tv

But I recently shipped a mobile app written in Dart/Flutter- https://www.zapatlas.com/

Aha, interesting! Perhaps you’d like to try B4X as well. Anyway, glad I’ve been of help!

Ohh … looks like Visual Basic… that’s my jam

Good lord doing this without a debugger was rough… But you sir are a human debugger.