diff --git a/plugins/x32/main.js b/plugins/x32/main.js index c11f6a9..475208a 100644 --- a/plugins/x32/main.js +++ b/plugins/x32/main.js @@ -20,6 +20,9 @@ exports.ready = function ready(device) { d.data.channelNames = new Array(32).fill('end'); d.data.channelColors = new Array(32); + // this is all the data from the meters/0 group so more than needed but + d.data.meters = new Array(70).fill(-90); + d.data.stereoFader = 0; d.data.stereoFaderDB = 0; d.data.stereoMute = 0; @@ -28,9 +31,6 @@ exports.ready = function ready(device) { d.send(Buffer.from('/xinfo')); - // device.send(Buffer.from("\x2f\x62\x61\x74\x63\x68\x73\x75\x62\x73\x63\x72\x69\x62\x65\x00\x2c\x73\x73\x69\x69\x69\x00\x00\x6d\x65\x74\x65\x72\x73\x2f\x30\x00\x00\x00\x00\x2f\x6d\x65\x74\x65\x72\x73\x2f\x30\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01")); - // device.send(Buffer.from("/batchsubscribe\x00,ssiii\x00\x00meters/0\x00\x00\x00\x00/meters/0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01")); - // device.send(Buffer.from("/subscribe\x00,si\x00/-stat/solosw/01\x001")); }; @@ -68,20 +68,23 @@ exports.data = function data(device, buf) { d.data.firmware = msg[5]; d.data.model = msg[4]; - d.send(Buffer.from('/main/st/config/name\u0000\u0000\u0000\u0000')); + d.send(Buffer.from('/main/st/config/name\x00\x00\x00\x00')); for (let i = 0; i <= 32; i++) { d.send( Buffer.from( - `/ch/${i - .toString() - .padStart(2, '0')}/config/name\u0000\u0000\u0000\u0000` + `/ch/${i.toString().padStart(2, '0')}/config/name\x00\x00\x00\x00` ) ); } d.draw(); - } else if (msg[0] === '/meters/0') { - // console.log(msg) + } else if (msg[0].includes('meters/0')) { + let offset = 24; + for (let i = 0; i < d.data.meters.length; i++) { + d.data.meters[i] = convertToDBTheBehringerWay(buf.readFloatLE(offset)); + offset += 4; + } + d.draw(); } else if (msg[0].indexOf('/mix/fader') >= 0) { const addr = parseAddress(msg[0]); const channel = Number(addr[1]); @@ -103,10 +106,10 @@ exports.data = function data(device, buf) { if (addr[0] === 'ch') { d.data.channelMutes[channel - 1] = buf[23]; - d.send(Buffer.from(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`)); + d.send(Buffer.from(`/ch/${addr[1]}/mix/fader\x00\x00\x00\x00`)); } else if (addr[0] === 'main') { d.data.stereoMute = buf.slice(-1)[0]; - d.send(Buffer.from(`/main/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`)); + d.send(Buffer.from(`/main/${addr[1]}/mix/fader\x00\x00\x00\x00`)); } d.draw(); } else if (msg[0].indexOf('/config/name') > 0) { @@ -117,27 +120,23 @@ exports.data = function data(device, buf) { if (d.data.stereoName === '') { d.data.stereoName = 'LR'; } - d.send( - Buffer.from(`/main/${addr[1]}/config/color\u0000\u0000\u0000\u0000`) - ); + d.send(Buffer.from(`/main/${addr[1]}/config/color\x00\x00\x00\x00`)); } } else if (addr[0] === 'ch') { const channel = Number(addr[1]); d.data.channelNames[channel - 1] = msg[2]; - d.send( - Buffer.from(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`) - ); + d.send(Buffer.from(`/ch/${addr[1]}/config/color\x00\x00\x00\x00`)); } d.draw(); } else if (msg[0].indexOf('/config/color') > 0) { const addr = parseAddress(msg[0]); if (addr[0] === 'main') { d.data.stereoColor = Buffer.from(msg[2]).readInt8(); - d.send(Buffer.from(`/main/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`)); + d.send(Buffer.from(`/main/${addr[1]}/mix/on\x00\x00\x00\x00`)); } else if (addr[0] === 'ch') { const channel = Number(addr[1]); d.data.channelColors[channel - 1] = buf.readInt8(27); - d.send(Buffer.from(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`)); + d.send(Buffer.from(`/ch/${addr[1]}/mix/on\x00\x00\x00\x00`)); } d.draw(); } else { @@ -148,4 +147,9 @@ exports.data = function data(device, buf) { exports.heartbeat = function heartbeat(device) { device.send(Buffer.from('/xremote')); + device.send( + Buffer.from( + '/batchsubscribe\x00,ssiii\x00\x00meters/0\x00\x00\x00\x00/meters/0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01' + ) + ); }; diff --git a/plugins/x32/styles.css b/plugins/x32/styles.css index 53a81f0..88973f4 100644 --- a/plugins/x32/styles.css +++ b/plugins/x32/styles.css @@ -129,7 +129,7 @@ input[type='range']::-webkit-slider-runnable-track { border-radius: 4px; } -.infin{ +.infin { font-size: 20px; vertical-align: middle; -} \ No newline at end of file +} diff --git a/plugins/x32/template.ejs b/plugins/x32/template.ejs index 8e1889b..8fc7bf8 100644 --- a/plugins/x32/template.ejs +++ b/plugins/x32/template.ejs @@ -36,6 +36,8 @@