LUA; how do I retrieve the MIDI channel from a valueObject?

LUA; how do I retrieve the MIDI channel from a valueObject?

1 Like

get the message object associated with the valueObject and then call getDeviceId() on it. Once you know the device, you can query information about it.

ie.

function getChannel(valueObject, value)
    local message = valueObject:getMessage()
    local deviceId = message:getDeviceId()
    local device = devices.get(deviceId)
    print("Channel = " .. device:getChannel())
end

If you do this often, consider making a helper function for it and possibly cache the channel so that you do not call it with every signle value change.

1 Like

Thanks,
I need this for my NovationNRPN on the Summit. Novation has not respected the standard NRPN and uses CC 38 as any other CC. As a result, using standard NRPN changes MOD ENV2 to Pitch on a Summit and Peak.
I made my own helper NRPN, and needed a way to retrieve the right channel as I constantly change the channels of the devices in use on the multi-timbral Summit.

(post deleted by author)