WebSockets: add transport methods to client JS

This commit is contained in:
Luciano Iam 2020-04-18 15:19:14 +02:00 committed by Robin Gareus
parent dc97bf3ff0
commit 1d84cc0046
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
3 changed files with 22 additions and 0 deletions

View File

@ -30,6 +30,9 @@
// Globals
onTempo (bpm) {}
onPositionTime (seconds) {}
onTransportRoll (value) {}
onRecordState (value) {}
// Strips
onStripDescription (stripId, name) {}

View File

@ -25,6 +25,14 @@ export class ControlMixin {
async getTempo () {
return await this._sendRecvSingle(ANode.TEMPO);
}
async getTransportRoll () {
return await this._sendRecvSingle(ANode.TRANSPORT_ROLL);
}
async getRecordState () {
return await this._sendRecvSingle(ANode.RECORD_STATE);
}
async getStripGain (stripId) {
return await this._sendRecvSingle(ANode.STRIP_GAIN, [stripId]);
@ -50,6 +58,14 @@ export class ControlMixin {
this._send(ANode.TEMPO, [], [bpm]);
}
setTransportRoll (value) {
this._send(ANode.TRANSPORT_ROLL, [], [value]);
}
setRecordState (value) {
this._send(ANode.RECORD_STATE, [], [value]);
}
setStripGain (stripId, db) {
this._send(ANode.STRIP_GAIN, [stripId], [db]);
}

View File

@ -20,6 +20,9 @@ export const JSON_INF = 1.0e+128;
export const ANode = Object.freeze({
TEMPO: 'tempo',
POSITION_TIME: 'position_time',
TRANSPORT_ROLL: 'transport_roll',
RECORD_STATE: 'record_state',
STRIP_DESC: 'strip_desc',
STRIP_METER: 'strip_meter',
STRIP_GAIN: 'strip_gain',