diff options
author | Luciano Iam <lucianito@gmail.com> | 2020-04-13 09:52:35 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2020-04-13 16:29:41 +0200 |
commit | 9fa7eb15ac9d220c6483f98b562b0246fa99aad2 (patch) | |
tree | b91e5f0038bcf1c027059b5f7e559e2a67da8f21 /share | |
parent | da670aa186951a39b416469d48e1543b9c968653 (diff) |
WebSockets: avoid hardcoding node names in mixer-demo, fix typo in message.js
Diffstat (limited to 'share')
-rw-r--r-- | share/web_surfaces/builtin/mixer-demo/js/main.js | 12 | ||||
-rw-r--r-- | share/web_surfaces/shared/message.js | 2 |
2 files changed, 7 insertions, 7 deletions
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' }); |