summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorLuciano Iam <lucianito@gmail.com>2020-04-11 17:49:34 +0200
committerRobin Gareus <robin@gareus.org>2020-04-11 22:30:41 +0200
commit5c78c85ef527fde08a009e813c1491a5e4e95ecb (patch)
tree31bd49f88bd05e97b27dbb7f8074508b5db17950 /share
parent02cdd5b52d208eaf89ae5a82937acea413cbac3d (diff)
WebSockets: rename Channel to ArdourMessageChannel
Diffstat (limited to 'share')
-rw-r--r--share/web_surfaces/builtin/mixer-demo/js/main.js51
-rw-r--r--share/web_surfaces/shared/ardour.js4
-rw-r--r--share/web_surfaces/shared/channel.js2
3 files changed, 31 insertions, 26 deletions
diff --git a/share/web_surfaces/builtin/mixer-demo/js/main.js b/share/web_surfaces/builtin/mixer-demo/js/main.js
index 11d8ecfc6e..6f647c3da3 100644
--- a/share/web_surfaces/builtin/mixer-demo/js/main.js
+++ b/share/web_surfaces/builtin/mixer-demo/js/main.js
@@ -16,7 +16,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-import { Channel } from '/shared/channel.js';
+import { ArdourMessageChannel } from '/shared/channel.js';
+
import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
StripPanSlider, StripGainSlider, StripMeter } from './widget.js';
@@ -26,34 +27,38 @@ import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
const FEEDBACK_NODES = ['strip_gain', 'strip_pan', 'strip_meter', 'strip_plugin_enable',
'strip_plugin_param_value'];
- const channel = new Channel(location.host);
+ const channel = new ArdourMessageChannel(location.host);
const widgets = {};
- channel.messageCallback = (node, addr, val) => {
- log(`↙ ${node} (${addr}) = ${val}`, 'message-in');
-
- if (node == 'strip_desc') {
- createStrip (addr, ...val);
- } else if (node == 'strip_plugin_desc') {
- createStripPlugin (addr, ...val);
- } else if (node == 'strip_plugin_param_desc') {
- createStripPluginParam (addr, ...val);
- } else if (FEEDBACK_NODES.includes(node)) {
- if (widgets[[node, addr]]) {
- widgets[[node, addr]].value = val[0];
+ main();
+
+ function main () {
+ channel.messageCallback = (node, addr, val) => {
+ log(`↙ ${node} (${addr}) = ${val}`, 'message-in');
+
+ if (node == 'strip_desc') {
+ createStrip (addr, ...val);
+ } else if (node == 'strip_plugin_desc') {
+ createStripPlugin (addr, ...val);
+ } else if (node == 'strip_plugin_param_desc') {
+ createStripPluginParam (addr, ...val);
+ } else if (FEEDBACK_NODES.includes(node)) {
+ if (widgets[[node, addr]]) {
+ widgets[[node, addr]].value = val[0];
+ }
}
- }
- };
+ };
- channel.closeCallback = () => {
- log('Connection dropped', 'error');
- };
+ channel.closeCallback = () => {
+ log('Connection dropped', 'error');
+ };
- channel.errorCallback = () => {
- log('Connection error', 'error');
- };
+ channel.errorCallback = () => {
+ log('Connection error', 'error');
+ };
- channel.open();
+ channel.open();
+ }
function createStrip (addr, name) {
const id = `strip-${addr[0]}`;
diff --git a/share/web_surfaces/shared/ardour.js b/share/web_surfaces/shared/ardour.js
index 8da2c0679c..99342c650f 100644
--- a/share/web_surfaces/shared/ardour.js
+++ b/share/web_surfaces/shared/ardour.js
@@ -16,12 +16,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-import { Channel } from './channel.js';
+import { ArdourMessageChannel } from './channel.js';
export class Ardour {
constructor () {
- this.channel = new Channel(location.host);
+ this.channel = new ArdourMessageChannel(location.host);
}
async open () {
diff --git a/share/web_surfaces/shared/channel.js b/share/web_surfaces/shared/channel.js
index 8f4a178a7c..c730458817 100644
--- a/share/web_surfaces/shared/channel.js
+++ b/share/web_surfaces/shared/channel.js
@@ -18,7 +18,7 @@
const JSON_INF = 1.0e+128;
-export class Channel {
+export class ArdourMessageChannel {
constructor (host) {
// https://developer.mozilla.org/en-US/docs/Web/API/URL/host