As i can see it is easy to get feedback to hardware if surface element is assigned to a value (value binding). But if I assign, for example, a button to command (command binding), it looks like no way to get feedback to controller.
Am I missing something? I want to make feedback for MixConsole opened/closed state, or “Listen” on selected track and found no way to do this. Any workaround exists?
Yes, I understand that command and value are absolutely different things. But maybe I can do this using mOnActivate somehow?
Hi,
I expect, you are talking about MIDI Remote, right?
Do you use the Mapping Assistant (it’s not possible to do so) or do you write JavaScript code (you can do it)?
I don’t think, you can get a feedback, if the MixConsole window is open/close, as there are no 2 dedicated commands (Open MixConsole and Close MixConsole).
Yes, I’m talking about midi remote.
I use JavaScript.
It’s as @Martin.Jirsak said. There’s no hostValue assigned to the visibility state of the Mixer.
However, IF and only if, you plan to use your controller for opening/closing the mixer, you can workaround this:
var mixerState=0 //Alternatively you can use the activeDevice.get/setState
page.makeCommandBinding(yourSurfaceValue,'Devices', 'Mixer').mOnValueChange=function(activeDevice,activeMapping,value,diff){
mixerState=1-mixerState
console.log("mixer State="+mixerState)
}
This is not directly exposed by the API. However, this one can be really achieved, but I’m waiting for the presentation of some documentation updates on the API, and then I will gladly share a snippet for this
Hi,
If you want to send out a dedicated MIDI Message (other then the Input Message), use the mOnProcessValueChange.
Short example:
knobStrip.knob.mEncoderValue.mOnProcessValueChange = function (activeDevice, value) {
sendLedRingMessageOut(activeDevice, midiOutput, knobIndex, value)
///////////////////
function sendLedRingMessageOut(context, midiOutput, encoderIdx, value) {
var midiCcNr = encoderIdx + 32
var midiValue = (value * 127) / 8 // Normalised value * 127 to get MIDI
var ringValue = 1 + Math.round(midiValue * (numberOfEffectiveLEDs/16)) + (mode * 16) // 12/16 because there are 12 LEDs only, not 16
if (pDot) ringValue += 64
midiOutput.sendMidi(context, [0xB0, midiCcNr, ringValue])
I used the function above to show the value on the Ring of a MCU V-Pots (which has only 8 LEDs).
I believe, you will understand the principle.
More info in the documentation > API Reference. Or, whatever @m.c says is 100% correct.
Thank you Martin but don’t swear by it In the snippet I’ve posted above, I have two errors (on purpose):
- Inside the mOnValueChange, we really have to check for the value before toggling the mixer state:
page.makeCommandBinding(yourSurfaceValue,'Devices', 'Mixer').mOnValueChange=function(activeDevice,activeMapping,value,diff){
if(value==1){
mixerState=1-mixerState
console.log("mixer State="+mixerState)
}
}
This is because I assume the usage of a gate button. And then, there’s a second error:
- Exactly the assumption that we have a gate button. If for example we have a button that sends just a 1 (i.e. without sending a 0 afterwards) this implementation will fail, since the mOnValueChange will fire just once. This was something reported (NOT a bug), but eventually since it can be easily workaround by using the mOnProcessValueChange that you used instead, the case is closed
Thank You! This snippet works. Unfortunately, as you said, there is still no hostValue assigned to the visibility state of the MixConsole, so this can be only a temporary solution.
Yes, I understand. Currently I’m working on a script for a Behringer X-Touch Mini using its MCU mode. So i know MCU protocol and get feedback works OK for all of my assigned functions (especially strange MCU LED rings feedback protocol).
MCU V-Pots has 11 leds, but it makes no difference))
Thanks for help!
If you’re on Windows and don’t mind getting your hands dirty, you could accomplish this with AutoHotKey. Below is a script that shows a way to create a shell hook to detect a window being created and destroyed. You could then react to these events by sending MIDI from AHK to MIDI Remote or your controller.
#Requires AutoHotkey v2.0
#SingleInstance force
Persistent
ProcessSetPriority "High"
Gui1 := Gui()
Gui1.OnEvent("Close", (*) => Gui1.Destroy())
Gui1.Opt("+LastFound")
DllCall("RegisterShellHookWindow", "UInt", WinExist())
MsgNum := DllCall("RegisterWindowMessage", "Str", "SHELLHOOK")
OnMessage(MsgNum, ShellMessage)
HSHELL_WINDOWCREATED := 1
HSHELL_WINDOWDESTROYED := 2
ShellMessage(wParam, lParam, *) {
Static hwnd := 0
if wParam = HSHELL_WINDOWCREATED {
Title := WinGetTitle("ahk_id " lParam)
if InStr(Title, "MixConsole - ") {
hwnd := lParam
; MixConsole got opened
; Do something...
}
} else if (wParam = HSHELL_WINDOWDESTROYED) {
if lParam = hwnd {
; MixConsole got closed
; Do something...
}
}
}
Hi,
Are you aware, there are already some scripts emulating MCU, right?
If they are for X-Touch Mini, i’ll be glad to check them out, if you can share a link - I would be grateful , but I’d prefer to make my own custom too.
I use MCU mode of X-Touch Mini just only because it offers layer buttons as a midi buttons, which i can use for selecting track (in my case).
I do not use it as a MCU devise. I use it as midi remote device. For my taste in this case it is preferrable for me, and it adds some versatility (if I want to share my script - I do not need to make additional assignments on controller).