page.makeValueBinding() unexpected behavior

I’ve been coding a script for an old TASCAM US-428 control surface. I’ve got some logic that allows the buttons to change the behavior of the jog wheel.

So this code snippet for example is to change the jog wheel from controlling the channel fader, to one of the aux sends:

typ// create at least one mapping page
var page = deviceDriver.mMapping.makePage('Tascam US-428 Mixer Page')

// create host accessing objects
var hostSelectedTrackChannel = page.mHostAccess.mTrackSelection.mMixerChannel

function assignJogWheel(auxID) {    
    if (auxID == AUX_CODES.None) {
        page.makeValueBinding(knobJogWheel.mSurfaceValue, hostSelectedTrackChannel.mValue.mVolume).setValueTakeOverModeScaled()
    } else {
        page.makeValueBinding(knobJogWheel.mSurfaceValue, hostSelectedTrackChannel.mSends.getByIndex(auxID).mLevel).setValueTakeOverModeScaled()        
    }    
}

function makeAsgnLEDDisplayFeedback(button) {
    button.mSurfaceValue.mOnProcessValueChange = function (context, newValue) {
        if (newValue > 0) {
            // button pressed (ignore button release)
            asgnEnabled = !asgnEnabled;
            
            displayAsgnLED(context, asgnEnabled)
            assignJogWheel(asgnEnabled ? AUX_CODES.None : selectedAux)
        }
    }
}

makeAsgnLEDDisplayFeedback(btnAsgn)

Something about the makeValueBinding method seems to be wrong here, because it will work once (switch binding from the aux send to the channel fader) but then it won’t switch back to the aux UNLESS you nudge that control with the mouse, THEN the binding seems to take effect.

I’ve got similar behavior on my EQ controls. The EQ knobs binding doesn’t switch bands until I nudge the aux send jogwheel, then it switches over depending on what button had been pressed.

This could be due to my lack of understanding about “pages” or perhaps a need for CustomValue variables?

@Martin.Jirsak any thoughts? :cowboy_hat_face: I can attach the whole script if needed… 500 ish lines

Hi, your approach in not compatible with the API, in the sense that you’re trying to dynamically bind while in reality you can only bind statically.

Let me explain:

Seeing your code, you’re after changing the behavior of the jog wheel based on the state of a button. Correct? Now, this is not understood by the compiler.

There are three ways you can deal with this:

  • Create separate mapping pages for each functionality
  • Create separate subPages for each functionality
  • Create custom vars for pointing your jog wheel to (already) bound functions

Let’s take the sub pages approach:

var page = deviceDriver.mMapping.makePage('Tascam US-428 Mixer Page')

var hostSelectedTrackChannel=page.mHostAccess.mTrackSelection.mMixerChannel

var subPagesArea=page.makeSubPageArea("subPagesArea")
var subPages=[]

var subPageVolume=subPagesArea.makeSubPage("subPageVolume")
subPages.push(subPageVolume)

page.makeValueBinding(knobJogWheel.mSurfaceValue,hostSelectedTrackChannel.mValue.mVolume).setValueTakeOverModeScaled().setSubPage(subPages[0])

var sendSlotsSize=midiremote_api.mDefaults.getNumberOfSendSlots()

for(var i=0;i<sendSlotsSize;i++){
    
    var subPageSlotByIndex=subPagesArea.makeSubPage("subPageSlotByIndex"+i)
    subPages.push(subPageSlotByIndex)
    
    page.makeValueBinding(knobJogWheel.mSurfaceValue,hostSelectedTrackChannel.mSends.getByIndex(i).mLevel).setValueTakeOverModeScaled().setSubPage(subPages[i+1])

}

//Here place the code for browsing through sub pages based on buttons

2 Likes

Thanks for the great reply! I had a feeling it was something about dynamically changing the binding. Though, it’s odd that is still sort of works if you bang on it.

I have yet to find any documentation about subPages… or the “push” method etc, I’m still not clear on the overall architecture on how those are intended to be used.

A related question… I need to set up banking similarly so that buttons 1-3 bank the faders/mutes between tracks 1-8, 9-16, 17-24 … I guess this is another subPage scenario? Thanks so much

Wonder what would the custom vars solution look like? It seems like that would be the simpler approach for me than duplicating tons of stuff across multiple pages…

It’s not that simple unfortunately, and you can run in all types of problems.

Not sure how you’re trying to construct your surface. Perhaps attaching your script would be of help here.

1 Like

Tascam_US-428-JS.zip (4.2 KB)

Here’s the full script! It all works, it’s just when remapping controls dynamically where I’m getting into trouble.

Not trying to get too fancy with this, but I want a few of the buttons to switch between banks, and change the EQ and jog wheel targets

FYI, this is the old girl we’re trying to breathe life back into. I labeled all the MIDI CC’s. This has been fun so far.

(I wish I had some insight into when/why to use “host” custom variables vs “surface” custom variables… Having a hard time finding info on this topic specifically)

OK, just had a quick look at your script.

So, if I correctly understood, you want that when you press ASGN to toggle your jog wheel’s action between volume and whichever send slot is selected via the AUX buttons. Is this correct so far?

Then you want that when you click on your High/MID/etc buttons, to set the EQ gain/freq/q to whichever bank is selected by these buttons.

I see bindings to volume/mute/rec for all the 8 tracks, and a pan for the selected track. By the way, do you intend to use the “Rec” toggle, so that you can have either a record-arm or select for your select buttons?

Finally I see the usual transport bindings.

Now, seeing the AUX/ASGN buttons, why not taking the approach to assign your faders to the volume (as you already do in your script) and then use the AUX/ASGN buttons to turn these faders to the send slots? Because this way, you can preserve your jog wheel for apart being a… jog wheel, to be used for zoom in/out, tempo adjustments and other stuff. But yeah, whatever works best for you, it’s just an idea.

I see in your script that you’ve already assigned the bank buttons, to changing track (previous/next). How about using for example the NULL button to toggle between changing track/bank? Just a thought.

Anyway, I cannot unfortunately dive into your code more tonight, but I can certainly come back tomorrow with whatever corrections I find needed, and I’ve already seen some important corrections.

So, if I correctly understood, you want that when you press ASGN to toggle your jog wheel’s action between volume and whichever send slot is selected via the AUX buttons. Is this correct so far?

Yes exactly!

Then you want that when you click on your High/MID/etc buttons, to set the EQ gain/freq/q to whichever bank is selected by these buttons.

Yes!

do you intend to use the “Rec” toggle, so that you can have either a record-arm or select for your select buttons?

I want to set this up a bit differently. I’m using the “select” buttons instead as individual “record arm” buttons. The single “rec” button I thought would be good to leave as a record arm whatever selected track, allowing the user to reach beyond the first 3 banks (banks toggled by F1, F2, F3… and instead using the “bank” buttons as “selectNextTrack” / “selectPrevTrack”

Now, seeing the AUX/ASGN buttons, why not taking the approach to assign your faders to the volume (as you already do in your script) and then use the AUX/ASGN buttons to turn these faders to the send slots?

The faders aren’t flying faders, so that would become pretty chaotic for me in practical usage. The whole idea behind this is to make Cubase feel like an old-school basic 8-track recording machine. I’m really not even that concerned about going beyond 8 tracks, so that the fader positions don’t get out of wack. That’s why I wanted to have the option to control the individual selected track volumes with the jog wheel. It’s more like ok record 8 things in F1 bank, hit F2, reset the faders, record 8 more tracks. Zip around and quickly dial up reverbs & EQ on each track. Put a single master reverb level on the master fader. Fun!

How about using for example the NULL button to toggle between changing track/bank? Just a thought.

Not a bad idea, but again my goal with this is to be as obvious and easy to use as possible & not have to memorize any “modes” and hidden features. I just want to mash a few buttons, arm a track, and play music (and not touch a mouse!!) Grip it & rip it

Thanks for taking the time sir!! I’m in here grinding on this today, trying to glean insight from your masterful Arturia Keylab MK2 script, as well as the Presonus Faderport code from Werner/CKB

I see. Note that though navigating to a specific bank is doable, it is more straight forward to use for example, F1 and F2 for shifting between banks. At the end of the day, you may want to use more than 3 banks (you or more generally another user).

Using the F1 F2 F3 for banks gives me LED indicators of which bank I’m currently inside. That’s the thinking there. If I go beyond 24 tracks recording on this thing I probably need to exit TASCAM world at that point haha :stuck_out_tongue_winking_eye:

I like your thinking! It’s not what most of us done with scripting, in the sense that we used a lot of “modes” but at the end of the day, a simple (not simplistic) approach is great! I’ll let you know tomorrow about whatever corrections/additions I can offer.

You are doing god’s work, sir… thank you so much.

Yea! I love the power and control I get with my Cubase!! This is just a way for me to get out of the technical trenches and just have some raw music fun.

It feels like writing on an old school 4 track tape machine! The button clicks! The LED’s! Oh mama

That said… it might be nifty to have the “asgn” mode (in addition to switching jog wheel to control selected track volume) allow the EQ buttons to toggle the individual bands on/off… and also the AUX buttons to toggle the sends on/OFF… indicate those with the LED’s… that would scratch the deeper tech modal itch nicely…

I made a lot of progress on this today… all the main channel section now works properly with “Sub Pages”

The assignChannelBankControls() method is a bit ugly (I should refactor it…) but it works.

Next I need to work on the EQ modes and also figure out how to implement simultaneous button presses (such as STOP+REW for RTZ)

Tascam_US-428-JS.zip (4.9 KB)

Out of curiosity, when you press “REC” do the “SELECT” buttons MIDI CCs change or you still get the 32-39 values. The same question goes for the “SOLO” button.
I ask because the way I see it, you could use the “SELECT” buttons for selecting tracks, while when clicking “REC” toggling to “ARM-REC” and same for SOLO/MUTE.

You may want to check my code for the Arturia Keylab MK2 or the Novation SL MK3, where I use “states”. In principle you need to set these keys to change a global var, then check upon release whether this global var was set to 1 (for example). And of course, not bind the initial buttons to anything at all.

As promised, here’s a version of the script I prepared. I cannot test it since I don’t have this device, however, you may find useful stuff inside.

Test_Tascam428.zip (2.9 KB)

EDIT: A new version uploaded.

Woah!! Christmas came early this year… I can’t wait to open this present haha thank you!

when you press “REC” do the “SELECT” buttons MIDI CCs change or you still get the 32-39 values. The same question goes for the “SOLO” button.

Great question & from what I can tell, the midi CC’s never change regardless of button combinations. (This is all in standard native mode… in the control panel, there is also a “4 banks” and “4 encoders” mode that I believe changes the behavior more to what you’re thinking)

I ask because the way I see it, you could use the “SELECT” buttons for selecting tracks, while when clicking “REC” toggling to “ARM-REC” and same for SOLO/MUTE.

This is how it was intended to be used & while it would certainly be great, I’m finding having 8 record buttons more useful for me. I still get track selection with the bank left/right buttons and 8 track select LED’s to indicate which one is selected. It’s actually kind of fun to make the green LED dance over to where you want it.

That leaves the REC button still available… I feel like it could be really cool to make that an “assign” to bind that red master fader to the current selected channel, that way you get 1 static fader you can easily use for anything you want (FX, master, drum bus, etc)