summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorLuciano Iam <lucianito@gmail.com>2020-04-12 15:58:17 +0200
committerRobin Gareus <robin@gareus.org>2020-04-13 16:29:41 +0200
commiteead6f9cac46961448d423f9de947021cd613cd3 (patch)
tree877617630695339294a00ae307e831ac0b14f976 /share
parent1f0dfddde1712435a1986abdd86b291e21a55c42 (diff)
WebSockets: make mixer-demo import ardour.js instead of lower level channel.js
Diffstat (limited to 'share')
-rw-r--r--share/web_surfaces/builtin/mixer-demo/js/main.js23
-rw-r--r--share/web_surfaces/shared/ardour.js10
2 files changed, 10 insertions, 23 deletions
diff --git a/share/web_surfaces/builtin/mixer-demo/js/main.js b/share/web_surfaces/builtin/mixer-demo/js/main.js
index 9a43147529..451f55ac62 100644
--- a/share/web_surfaces/builtin/mixer-demo/js/main.js
+++ b/share/web_surfaces/builtin/mixer-demo/js/main.js
@@ -16,11 +16,12 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
- // This example does not call the high level API methods in ardour.js
- // but interacts directly with the low level message stream instead
+ // This example does not call the API methods in ardour.js,
+ // instead it interacts at a lower level by coupling the widgets
+ // tightly to the message stream
import { Message } from '/shared/message.js';
-import { MessageChannel } from '/shared/channel.js';
+import { Ardour } from '/shared/ardour.js';
import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
StripPanSlider, StripGainSlider, StripMeter } from './widget.js';
@@ -31,13 +32,13 @@ import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
const FEEDBACK_NODES = ['strip_gain', 'strip_pan', 'strip_meter', 'strip_plugin_enable',
'strip_plugin_param_value'];
- const channel = new MessageChannel(location.host);
+ const ardour = new Ardour(location.host);
const widgets = {};
main();
function main () {
- channel.messageCallback = (msg) => {
+ ardour.messageCallback = (msg) => {
log(`↙ ${msg}`, 'message-in');
if (msg.node == 'strip_desc') {
@@ -53,15 +54,11 @@ import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
}
};
- channel.closeCallback = () => {
- log('Connection dropped', 'error');
+ ardour.errorCallback = () => {
+ log('Client error', 'error');
};
- channel.errorCallback = () => {
- log('Connection error', 'error');
- };
-
- channel.open();
+ ardour.open();
}
function createStrip (addr, name) {
@@ -133,7 +130,7 @@ import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
function send (widget) {
const msg = new Message(widget.node, widget.addr, [widget.value]);
log(`↗ ${msg}`, 'message-out');
- channel.send(msg);
+ ardour.send(msg);
}
function createElem (html, parent) {
diff --git a/share/web_surfaces/shared/ardour.js b/share/web_surfaces/shared/ardour.js
index 51712621a7..ce0bb2069b 100644
--- a/share/web_surfaces/shared/ardour.js
+++ b/share/web_surfaces/shared/ardour.js
@@ -160,13 +160,3 @@ export class Ardour {
}
}
-
-async function main() {
- const ard = new Ardour();
- ard.errorCallback = (error) => {
- alert(error);
- };
- await ard.open();
-}
-
-main();