From 45b9c600df6591eeaab78736aa2542ede53a2fd5 Mon Sep 17 00:00:00 2001 From: Joel Wetzell Date: Thu, 17 Feb 2022 09:31:46 -0600 Subject: [PATCH] apply prettier --- plugins/x32/main.js | 36 ++++++++++++++---------------------- plugins/xair/main.js | 11 ++--------- 2 files changed, 16 insertions(+), 31 deletions(-) diff --git a/plugins/x32/main.js b/plugins/x32/main.js index 185d1f6..8925776 100644 --- a/plugins/x32/main.js +++ b/plugins/x32/main.js @@ -6,7 +6,7 @@ exports.searchOptions = { searchBuffer: Buffer.from([0x2f, 0x78, 0x69, 0x6e, 0x66, 0x6f]), devicePort: 10023, listenPort: 0, - validateResponse (msg, info) { + validateResponse(msg, info) { return msg.toString().indexOf('/xinfo') === 0; }, }; @@ -23,7 +23,7 @@ exports.ready = function ready(device) { d.data.stereoFader = 0; d.data.stereoFaderDB = 0; d.data.stereoMute = 0; - d.data.stereoName = "LR"; + d.data.stereoName = 'LR'; d.data.stereoColor = 7; d.send(Buffer.from('/xinfo')); @@ -93,9 +93,7 @@ exports.data = function data(device, buf) { ); } else if (addr[0] === 'main') { d.data.stereoFader = buf.readFloatBE(24); - d.data.stereoFaderDB = convertToDBTheBehringerWay( - buf.readFloatBE(24) - ); + d.data.stereoFaderDB = convertToDBTheBehringerWay(buf.readFloatBE(24)); } d.draw(); @@ -105,30 +103,25 @@ 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\u0000\u0000\u0000\u0000`)); } 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.data.stereoMute = buf.slice(-1)[0]; + d.send(Buffer.from(`/main/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`)); } d.draw(); - } else if (msg[0].indexOf('/config/name') > 0) { const addr = parseAddress(msg[0]); - if(addr[0] === "main"){ - if(addr[1] === "st"){ - d.data.stereoName = msg[2] - if(d.data.stereoName === ""){ - d.data.stereoName = "LR"; + if (addr[0] === 'main') { + if (addr[1] === 'st') { + d.data.stereoName = msg[2]; + if (d.data.stereoName === '') { + d.data.stereoName = 'LR'; } d.send( Buffer.from(`/main/${addr[1]}/config/color\u0000\u0000\u0000\u0000`) ); } - } else if (addr[0] === "ch"){ + } else if (addr[0] === 'ch') { const channel = Number(addr[1]); d.data.channelNames[channel - 1] = msg[2]; d.send( @@ -138,11 +131,10 @@ exports.data = function data(device, buf) { d.draw(); } else if (msg[0].indexOf('/config/color') > 0) { const addr = parseAddress(msg[0]); - if (addr[0] === "main"){ + 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`)); - - } else if (addr[0] === "ch"){ + } 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`)); diff --git a/plugins/xair/main.js b/plugins/xair/main.js index 3c759c7..9e489c2 100644 --- a/plugins/xair/main.js +++ b/plugins/xair/main.js @@ -6,7 +6,7 @@ exports.searchOptions = { searchBuffer: Buffer.from([0x2f, 0x78, 0x69, 0x6e, 0x66, 0x6f]), devicePort: 10024, listenPort: 0, - validateResponse (msg, info) { + validateResponse(msg, info) { return msg.toString().indexOf('/xinfo') === 0; }, }; @@ -81,7 +81,6 @@ exports.data = function data(device, buf) { ); } d.draw(); - } else if (msg[0] === '/meters/0') { // console.log(msg) } else if (msg[0].indexOf('/mix/fader') >= 0) { @@ -95,13 +94,10 @@ exports.data = function data(device, buf) { ); } else if (addr[0] === 'lr') { d.data.stereoFader = buf.readFloatBE(20); - d.data.stereoFaderDB = convertToDBTheBehringerWay( - buf.readFloatBE(20) - ); + d.data.stereoFaderDB = convertToDBTheBehringerWay(buf.readFloatBE(20)); } d.draw(); - } else if (msg[0].indexOf('/mix/on') >= 0) { const addr = parseAddress(msg[0]); const channel = Number(addr[1]); @@ -113,21 +109,18 @@ exports.data = function data(device, buf) { } device.draw(); device.send(`/ch/${addr[1]}/mix/fader\u0000\u0000\u0000\u0000`); - } else if (msg[0].indexOf('/config/name') > 0) { const addr = parseAddress(msg[0]); const channel = Number(addr[1]); d.data.channelNames[channel - 1] = msg[4]; d.draw(); d.send(`/ch/${addr[1]}/config/color\u0000\u0000\u0000\u0000`); - } else if (msg[0].indexOf('/config/color') > 0) { const addr = parseAddress(msg[0]); const channel = Number(addr[1]); d.data.channelColors[channel - 1] = buf.readInt8(27); d.draw(); d.send(`/ch/${addr[1]}/mix/on\u0000\u0000\u0000\u0000`); - } else { // console.log(msg) }