Newbie to MIDI Remote scripting

But… Have you maybe defined another mapping page previously with the very same name (page)? Because why would you want to assign a button to activate a page that is already activated? Can you post a statement for another page you’ve made?

Not knowingly…

I’ve set up two pages so far, gain and volume, where the faders change function depending on the mapping page selected. I can swap between them with the Mapping Page option in the lower zone, but I want to be able to swap just using the hardware.

This is the other page, the volume one:
var page = deviceDriver.mMapping.makePage(‘Volume’)

Do I need to not call them both “page” perhaps?

Exactly. Each page, as a unique entity, must have a different variable name:

For example:

var pageVolume=deviceDriver.mMapping.makePage("Volume")
var pageGain=deviceDriver.mMapping.makePage("Gain")

Now, answering your question about activating a page using a button, say, the “Gain” page:

pageVolume.makeActionBinding(GainButton.mSurfaceValue, pageGain.mAction.mActivate)
1 Like

Thank you so much for your continued help (not all heroes wear capes).

That has actually stopped all the faders binding the gain values on that page, and the button binding isn’t showing either, but I don’t doubt that that’s something I’ve done wrong.

I’ll look at it with fresh eyes tomorrow.

Realised what I’d done… I’d made that button binding before I’d defined the pageGain variable. It doesn’t give an error - but it doesn’t work, either.

Argh this is a learning curve, my immersion in PHP and MySQL were a long time ago now.

OK my next step is to implement the DefaultBindings function that you suggested back at post #11. I obviously have to be very careful about the order in which I create and call things, I definitely need a clear head for that - tomorrow I hope.

Hello again, I’m back with another set of questions.

Q1. I’m not sure whether this is a hardware (Softube Console 1 Fader mk 1) or MIDI remote issue; when I use the buttons that I’ve assigned to change mappings in this way:

pageVolume.makeActionBinding(GainButton.mSurfaceValue, pageGain.mAction.mActivate)

  • I have to use them twice to activate the new mapping. I can see in the MIDI Remote window that it’s recognising it the first time, but it isn’t “lighting up” the button… is this something to do with properties of the button itself, e.g. it’s defaulting to toggle but actually shouldn’t for this use case?

Q2. I can’t find a way to get a function for DefaultBindings (as above in this thread) to work with mapping assignments, I think because I can’t add the buttons before I’ve defined the pages, and I can’t define the pages without setting up the default binding function - catch 22, whichever order I do it in, the compiler needs the other one first. I think. Am I better off just setting up a load of mutually-referencing mapping buttons separately, e.g.

pageVolume.makeActionBinding(GainButton.mSurfaceValue, pageGain.mAction.mActivate)
pageLC.makeActionBinding(GainButton.mSurfaceValue, pageGain.mAction.mActivate)
pageGain.makeActionBinding(VolumeButton.mSurfaceValue, pageVolume.mAction.mActivate)
pageLC.makeActionBinding(VolumeButton.mSurfaceValue, pageVolume.mAction.mActivate)

etc? It’s repetitive but actually I think it’s the way I’d have to do in the MIDI remote mapping function as well, i.e. keep defining each button as the same function for each page?

Q3. Is there a way to bind two commands to one key press? I’d like to set up a button on the Fader unit to both select a Channel Visibility Configuration, and change to a pre-set bank on the unit. Setting up exactly 10 channels per visibility config and moving to a bank including those 10 on the unit seems like the easiest way to keep the unit in sync with my workflow until the Follow Channel Visibility update to MIDI remote goes live (not 13.0.5 then).

Many thanks in advance for any help.

Hi, this is not normal.

Not sure how you’ve tried to implement this.

Please attach your script here so I can have a look concerning both of the above cases.

Yes.

Example 1:

var button=//your button
var aSecondNoRealButton=surface.makeCustomValueVariable("aSecondNoRealButton")
page.makeCommandBinding(aButton.mSurfaceValue,'command category','command name').mOnValueChange=function(activeDevice,activeMapping,value,diff){
     aSecondNoRealButton.setProcessValue(activeDevice,value)
}

page.makeCommandBinding(aSecondNoRealButton,'second command category','second command name')

Example 2:

var custom1=surface.makeCustomValueVariable("custom1")
var custom2=surface.makeCustomValueVariable("custom2")

button.mSurfaceValue.mOnProcessValueChange=function(activeDevice,value,diff){
 custom1.setProcessValue(activeDevice,value)
 custom2.setProcessValue(activeDevice,value)
}

page.makeCommandBinding(custom1,'command category','command name')
page.makeCommandBinding(custom2,'second command category','second command name')

How do you plan to implement this?

Thanks @m.c, much appreciated.

Q1… hmmm. How does one change the button properties so that I can try some of the options that are exposed in the MIDI Remote lower section?

Q2. I’ll make a non-working version and share it - do you want to see the whole script or just the offending sections?

Q3. I hadn’t quite got as far as the mechanics yet but I’m intending to have a template where tracks 1-10 are drums, 11-20 are percussion, 21-30 are bass (excessive so maybe bass plus something else), 31-40 are acoustic guitars etc.

Then for channel visibility configurations in Cubase I would have exactly those 10-track configs, that I would activate through buttons on the unit. And then simultaneously I was hoping to move to the appropriate bank to control on the unit itself.

So let’s say I’m working on drums and want to move to acoustic guitar, I would press the assigned button and 1) cubase would select the channel visibility config for acoustic i.e. tracks 31-30 and 2) the unit would pick up channels 31-40 as a bank.

An alternative (less buttons, more presses if I want to move a few banks) is to assign the bank up/down button to next bank and next config, although I haven’t actually checked that that is a MIDI remote command.

Does that make sense?

You can post the script as is, no need to edit it, probably I can identify the issues :slight_smile:

Q3: If you make this type of arrangement, and then can easily move through these banks using your controller, then, what is the use case for the channel visibility? Is it for just seeing on the screen the selected channels, so you can know where exactly you’re in? Just curious to know.

Yes, exactly that. In MIDI Remote mapping through the lower window, if I have channels 1-12 on screen, pressing a button twice that is mapped to select next bank will mean than I can still see channels 1-12, but I’m controlling channels 21-30.

It’s saying I can’t upload a .js file… do I need to package up as .midiremote?

Perhaps you can send it compressed in zip.

Good idea - let me know if this works.
Softube_NextDevice - Copy (4).zip (1.6 KB)

Well, I did see some tiny issues, but nothing serious :slight_smile:
Here’s an edited version you can try. I’ve added there a logger of the volume button, so we can inspect the values sent.

Softube_NextDevice - Copy (4).zip (1.7 KB)

Wow thank you - just doing bedtime with my son, I’ll try this later :slightly_smiling_face:

1 Like

OK I haven’t tried this with the unit yet for logistical reasons (namely, the room it’s in is too close to my son’s bedroom and he’s only just asleep) but I’ve opened on a laptop with Visual Studio Code and it’s giving me an error.

I think you may have changed from

var surface = deviceDriver.mSurface

to

var surface = deviceDriver.mSurfaceValue

?

It’s showing this error in the Problems section:

image

Not sure I understand why, I’m pretty sure I’ve seen (and used) mSurfaceValue in other scripts / iterations of this script…

It’s also saying Cannot find name ‘pageHC’ but I think that you’re one step ahead of on that one, and have set up the page activation before I’ve set up the page :smiley:

Please re-download the script or manually restore the correct one:
var surface=deviceDriver.mSurface

(The auto-complete pushed the “Value” right after the “mSurface”. And since I made it up without compiling, I didn’t notice :slight_smile: )

The pageHC was an addition from me, but I see now that you haven’t actually implemented it yet, correct :smiley:

Anyway, the way I see your layout, I think it would be a good choice to use subpages instead of pages, for the particular uses you have for now.

Here’s an altered version you might want to look at, it uses subpages. You can see I simplified (?) some things, at the same time. Hope it doesn’t confuse you.

SoftTube_NextDevice.zip (1.4 KB)

This is fantastic, thank you - I’ve made the manual adjustments and want to step through what you’ve done to check that I understand it.

I’d been wondering about subpages so I’ll definitely go there next.

On your first version then. It looks like instead of creating pages with a function that starts by adding the common bindings, you’ve moved that part to the end instead? If I’ve read correctly then that makes complete sense, it felt like chicken and egg before, but I need to read through the allPages variable (array?) references again to make sure I understand how it works.

The double key presses are a thing, BUT… when I’m looking in the MIDI remote window, they only take effect when they go from greyed out to ‘lit’… so the right hand buttons on this screengrab would work first time, the ‘lit’ ones would need two presses:

How does the logger work so that I can see what’s happening?

Thank you again btw, I can’t believe you’re doing this for (I assume) fun and/or benevolence!

I don’t know whether this helps: putting MIDI Monitor on it, the button is sending two different Value2’s:

This is actually OK.

I’m sorry I don’t understand this. I’ve just checked it here, when for example we press the Gain Button, the Gain page is getting activated. Then if I press the LC button, the LC page is activated. I don’t get the double press need. Maybe you have something in the middle interfering with your controller, other than the Midi Remote?