mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-14 10:36:34 +01:00
WebSockets: make mixer-demo use ardour lib and remove duplicated code
This commit is contained in:
parent
40a03e4cf5
commit
ece0bcde8b
4 changed files with 21 additions and 94 deletions
|
|
@ -16,16 +16,20 @@
|
|||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
import { Channel } from '/shared/channel.js';
|
||||
import { Switch, DiscreteSlider, ContinuousSlider, LogarithmicSlider,
|
||||
StripPanSlider, StripGainSlider, StripMeter } from './widget.js';
|
||||
|
||||
(() => {
|
||||
|
||||
const MAX_LOG_LINES = 1000;
|
||||
const FEEDBACK_NODES = ['strip_gain', 'strip_pan', 'strip_meter', 'strip_plugin_enable',
|
||||
'strip_plugin_param_value'];
|
||||
|
||||
const conn = new Connection(location.host);
|
||||
const channel = new Channel(location.host);
|
||||
const widgets = {};
|
||||
|
||||
conn.messageCallback = (node, addr, val) => {
|
||||
channel.messageCallback = (node, addr, val) => {
|
||||
log(`↙ ${node} (${addr}) = ${val}`, 'message-in');
|
||||
|
||||
if (node == 'strip_desc') {
|
||||
|
|
@ -41,14 +45,16 @@
|
|||
}
|
||||
};
|
||||
|
||||
conn.closeCallback = () => {
|
||||
channel.closeCallback = () => {
|
||||
log('Connection dropped', 'error');
|
||||
};
|
||||
|
||||
conn.errorCallback = () => {
|
||||
channel.errorCallback = () => {
|
||||
log('Connection error', 'error');
|
||||
};
|
||||
|
||||
channel.open();
|
||||
|
||||
function createStrip (addr, name) {
|
||||
const id = `strip-${addr[0]}`;
|
||||
const strips = document.getElementById('strips');
|
||||
|
|
@ -118,7 +124,7 @@
|
|||
function send (widget) {
|
||||
const val = widget.value;
|
||||
log(`↗ ${widget.node} (${widget.addr}) = ${val}`, 'message-out');
|
||||
conn.send(widget.node, widget.addr, [val]);
|
||||
channel.send(widget.node, widget.addr, [val]);
|
||||
}
|
||||
|
||||
function createElem (html, parent) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue