apply prettier

This commit is contained in:
2022-02-17 09:31:46 -06:00
parent 9a97a92d97
commit 45b9c600df
2 changed files with 16 additions and 31 deletions
+14 -22
View File
@@ -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`));
+2 -9
View File
@@ -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)
}