From 9fa7eb15ac9d220c6483f98b562b0246fa99aad2 Mon Sep 17 00:00:00 2001 From: Luciano Iam Date: Mon, 13 Apr 2020 09:52:35 +0200 Subject: WebSockets: avoid hardcoding node names in mixer-demo, fix typo in message.js --- share/web_surfaces/builtin/mixer-demo/js/main.js | 12 ++++++------ share/web_surfaces/shared/message.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'share') diff --git a/share/web_surfaces/builtin/mixer-demo/js/main.js b/share/web_surfaces/builtin/mixer-demo/js/main.js index 832316e43e..1a5f3ae1d8 100644 --- a/share/web_surfaces/builtin/mixer-demo/js/main.js +++ b/share/web_surfaces/builtin/mixer-demo/js/main.js @@ -20,7 +20,7 @@ // instead it interacts at a lower level by coupling the widgets // tightly to the message stream -import { Message } from '/shared/message.js'; +import { ANode, Message } from '/shared/message.js'; import { Ardour } from '/shared/ardour.js'; import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider, @@ -29,8 +29,8 @@ import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider, (() => { const MAX_LOG_LINES = 1000; - const FEEDBACK_NODES = ['strip_gain', 'strip_pan', 'strip_meter', 'strip_plugin_enable', - 'strip_plugin_param_value']; + const FEEDBACK_NODES = [ANode.STRIP_GAIN, ANode.STRIP_PAN, ANode.STRIP_METER, + ANode.STRIP_PLUGIN_ENABLE, ANode.STRIP_PLUGIN_PARAM_VALUE]; const ardour = new Ardour(location.host); const widgets = {}; @@ -42,11 +42,11 @@ import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider, onMessage: (msg) => { log(`↙ ${msg}`, 'message-in'); - if (msg.node == 'strip_desc') { + if (msg.node == ANode.STRIP_DESC) { createStrip (msg.addr, ...msg.val); - } else if (msg.node == 'strip_plugin_desc') { + } else if (msg.node == ANode.STRIP_PLUGIN_DESC) { createStripPlugin (msg.addr, ...msg.val); - } else if (msg.node == 'strip_plugin_param_desc') { + } else if (msg.node == ANode.STRIP_PLUGIN_PARAM_DESC) { createStripPluginParam (msg.addr, ...msg.val); } else if (FEEDBACK_NODES.includes(msg.node)) { if (widgets[msg.hash]) { diff --git a/share/web_surfaces/shared/message.js b/share/web_surfaces/shared/message.js index 836420faac..6c81cd972f 100644 --- a/share/web_surfaces/shared/message.js +++ b/share/web_surfaces/shared/message.js @@ -27,7 +27,7 @@ export const ANode = Object.freeze({ STRIP_MUTE: 'strip_mute', STRIP_PLUGIN_DESC: 'strip_plugin_desc', STRIP_PLUGIN_ENABLE: 'strip_plugin_enable', - STRUP_PLUGIN_PARAM_DESC: 'strip_plugin_param_desc', + STRIP_PLUGIN_PARAM_DESC: 'strip_plugin_param_desc', STRIP_PLUGIN_PARAM_VALUE: 'strip_plugin_param_value' }); -- cgit v1.2.3