Dear forum members,
I have this code where the insert parameters are sent as sysex messages to an external display. By iterating “i” I want to address the parameter number and the according column of my display, but somehow all parameters are displayed starting at the same column (at i = 7).
for (var i = 0; i < 8; ++i)
{
var displayValue=ChannelInsertParameters[i].mOnDisplayValueChange = function (activeDevice, activeMapping, value) {
var dataDisplay = [0xf0, 0x00, 0x00, 0x66, 0x14, 0x12, i*0x07];
var dataDisplayReset = [0xf0, 0x00, 0x00, 0x66, 0x14, 0x12, i*0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7]
for (var j = 0, len = value.length; j < len; ++j)
{dataDisplay.push(value.charCodeAt(j))}
dataDisplay.push(0xF7)
midiOutput.sendMidi(activeDevice, dataDisplayReset)
midiOutput.sendMidi(activeDevice, dataDisplay)
}}
On the other hand when iterating “manually” all works fine:
var displayValue=ChannelInsertParameters[0].mOnDisplayValueChange = function (activeDevice, activeMapping, value) {
var dataDisplay = [0xf0, 0x00, 0x00, 0x66, 0x14, 0x12, 0*0x07];
var dataDisplayReset = [0xf0, 0x00, 0x00, 0x66, 0x14, 0x12, 0*0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7]
for (var j = 0, len = value.length; j < len; ++j)
{dataDisplay.push(value.charCodeAt(j))}
dataDisplay.push(0xF7)
midiOutput.sendMidi(activeDevice, dataDisplayReset)
midiOutput.sendMidi(activeDevice, dataDisplay)
}
var displayValue=ChannelInsertParameters[1].mOnDisplayValueChange = function (activeDevice, activeMapping, value) {
var dataDisplay = [0xf0, 0x00, 0x00, 0x66, 0x14, 0x12, 1*0x07];
var dataDisplayReset = [0xf0, 0x00, 0x00, 0x66, 0x14, 0x12, 1*0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF7]
for (var j = 0, len = value.length; j < len; ++j)
{dataDisplay.push(value.charCodeAt(j))}
dataDisplay.push(0xF7)
midiOutput.sendMidi(activeDevice, dataDisplayReset)
midiOutput.sendMidi(activeDevice, dataDisplay)
}
Does anybody know what has to be changed in the first code to make it work like the second?
Thanks a lot in advance, Emre