13
0

WebSockets: make mixer-demo import ardour.js instead of lower level channel.js

This commit is contained in:
Luciano Iam 2020-04-12 15:58:17 +02:00 committed by Robin Gareus
parent 1f0dfddde1
commit eead6f9cac
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 10 additions and 23 deletions

View File

@ -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) {

View File

@ -160,13 +160,3 @@ export class Ardour {
}
}
async function main() {
const ard = new Ardour();
ard.errorCallback = (error) => {
alert(error);
};
await ard.open();
}
main();