controller - Javascript ERROR, undefined, not an object -
i new in javascript, , trying map controller's buttons , leds mixxx application. object, array? var missing.
behringercmdmm1.leds = [ // master { "shiftbutton" : 0x12 }, // deck 1 { "sync" : 0x30 }, // deck 2 { "sync" : 0x33 } ];
i have error here,
behringercmdmm1.shiftbutton = function (channel, control, value, status, group) { // note there no 'if (value)' here executes both when shift button pressed , when released. // therefore, behringercmdmm1.shift true while shift button held down var deck = behringercmdmm1.grouptodeck(group); behringercmdmm1.shift = !behringercmdmm1.shift // '!' inverts value of boolean (true/false) variable behringercmdmm1.setled(behringercmdmm1.leds[deck]["shiftbutton"], behringercmdmm1.shift);
}
about "shiftbutton" undefined.
also have function
behringercmdmm1.setled = function(value, status) { status = status ? 0x7f : 0x00; midi.sendshortmsg(0x94, value, status);
}
this javascript file found on internet created different controller. so, trying things understand how can configure mine.
behringercmdmm1.leds
array of objects. within array, element @ index 0 object has shiftbutton
property. thus, way 0x12
value in example this:
behringercmdmm1.leds[0]['shiftbutton']
so when code executes...
var deck = behringercmdmm1.grouptodeck(group);
...the value of deck
other 0, , you're accessing 1 of sync
objects in behringercmdmm1.leds
array. example, if value of deck
1, this...
behringercmdmm1.leds[deck]['shiftbutton']
...will undefined
because you're doing this:
behringercmdmm1.leds[1]['shiftbutton']
Comments
Post a Comment