Hi @robw.
@dimonskinke asked me how to make the Icon’s fader send CC.
I’ve made this possible through SoundFlow because multi ports in the MIDI remote API didn’t seem to work properly in the beginning, but they fixed something in 12.0.50.
I just did a quick testing to checked it now. I haven’t tested it much, and some of the ways can probably be done way smoother. Maybe you can continue the research and share when you’ve found better solutions.
I might also merge my own Icon Platform setup to using the script instead of SoundFlow at some point, but currently I’m also writing a completely new script for another controller, which I’m almost more excited about right now.
Anyway just wanted to share with you how it’s sort of possible for now.
// create objects representing the hardware's MIDI ports
var midiInput = deviceDriver.mPorts.makeMidiInput('')
var midiOutput = deviceDriver.mPorts.makeMidiOutput('')
var midiOutput2 = deviceDriver.mPorts.makeMidiOutput('')
Then you need a virtual midi driver for the second output, so that will be needed in to Cubendo. On Mac we have this available through the IAC drivers:
Then you can make faders that sends to the secondary midi output. This sort of works:
var page = makePageWithDefaults('Midi')
page.mOnActivate = function (activeDevice) {
console.log('from script: Platform M+ page "CC" activated')
clearAllLeds(activeDevice, midiOutput)
clearFaderValues()
// On load I'm setting the pitchbend fader to the center position. Whenever you release it it will jump back to this point
midiOutput.sendMidi(activeDevice, [0xE0, 0, 64]) // to put pitchbend in center
}
// In order to bind a fader so we can get it's value I'm using a dummy function.
var dummy = page.makeSubPageArea('Dummy')
// This fader sends pitchbend
page.makeActionBinding(surfaceElements.channelControls[0].fader.mSurfaceValue, dummy.mAction.mReset).mOnValueChange = function (activeDevice, mapping, value) {
var faderNumber = 0
var valueInput = value
var pitchBendValue = Math.ceil(valueInput * 16383)
var value1 = pitchBendValue % 128
var value2 = Math.floor(pitchBendValue / 128)
midiOutput.sendMidi(activeDevice, helper.sysex.displaySetTextOfColumn(0, 1, 'PB'))
midiOutput.sendMidi(activeDevice, helper.sysex.displaySetTextOfColumn(faderNumber, 0, (valueInput * 4 - 2).toFixed(1)))
midiOutput2.sendMidi(activeDevice, [0xE0, value1, value2])
}
// On release we want the pitchbend fader to jump back to the mid position,
//but for some reason I can get it to work with sending the value. that's why I just added it on the page load
// So here I'm just setting the display back to the "middle" value.
page.makeActionBinding(surfaceElements.channelControls[0].fader_touch.mSurfaceValue, dummy.mAction.mReset).mOnValueChange = function (activeDevice, mapping, value) {
if (value == 0) {
var faderNumber = 0
var valueInput = 0.5
var pitchBendValue = Math.ceil(valueInput * 16383)
var value1 = pitchBendValue % 128
var value2 = Math.floor(pitchBendValue / 128)
midiOutput.sendMidi(activeDevice, helper.sysex.displaySetTextOfColumn(faderNumber, 0, (valueInput * 4 - 2).toFixed(1)))
midiOutput2.sendMidi(activeDevice, [0xE0, value1, value2])
}
}
// This sends CC1. I'm feeding back the values to the Icon, in order for the fader to stay where you release it. Definitely not the best way, but at least one way.
page.makeActionBinding(surfaceElements.channelControls[1].fader.mSurfaceValue, dummy.mAction.mReset).mOnValueChange = function (activeDevice, mapping, value) {
var faderNumber = 1
var ccValue = Math.ceil(value * 127)
var ccNumber = 1
var pitchBendValue = Math.ceil(value * 16383)
var value1 = pitchBendValue % 128
var value2 = Math.floor(pitchBendValue / 128)
midiOutput.sendMidi(activeDevice, helper.sysex.displaySetTextOfColumn(1, 1, 'CC' + 1))
midiOutput.sendMidi(activeDevice, helper.sysex.displaySetTextOfColumn(faderNumber, 0, ccValue))
// this is the value going back to the icon Fader
midiOutput.sendMidi(activeDevice, [0xE0 + faderNumber, value1, value2])
// this is the value going back to Cubendo
midiOutput2.sendMidi(activeDevice, [0xB0, 1, ccValue])
}
Since you’ve already worked on a more advanced setup for touch and release fader, you might have an easier time making it better.
I think what needs to be done for it to be nice is to store the various CC values so we get them on load on the display. And we don’t wanna send all the fader values back in to the icon, but rather just send the last value on release. For pitch bend we want the fader to go to the center.
Still seems a bit wonky with the two midi ports, when you reload a script for instance, it create two devices and I have to remove and disable the script, then enable it and then add the device with the ports again
Maybe it’s because it’s not the intended usage. I don’t know.
But I hope this can get you on your way
Best