merging-ravenna 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/catalog.js +2 -2
- package/src/engine.js +19 -1
- package/src/paths.js +6 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "merging-ravenna",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Standalone client for Merging Technologies RAVENNA devices (Hapi / Horus / Anubis) over their CometD/WebSocket control protocol. Unofficial; not affiliated with Merging Technologies.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"merging",
|
package/src/catalog.js
CHANGED
|
@@ -91,11 +91,11 @@ function buildCatalog(tree) {
|
|
|
91
91
|
}));
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
// out max level
|
|
94
|
+
// out max level (model-supplied enum: device gives only the int)
|
|
95
95
|
if (typeof sec.out_max_level === 'number' && caps.out_max_level) {
|
|
96
96
|
out.push(Object.assign({}, base, {
|
|
97
97
|
key: 'out_max_level', raw: sec.out_max_level, value: sec.out_max_level,
|
|
98
|
-
unit: '
|
|
98
|
+
unit: 'enum', min: null, max: null, step: null, enum: PARAMS.out_max_level.enum || null,
|
|
99
99
|
settable: true, confidence: PARAMS.out_max_level.confidence
|
|
100
100
|
}));
|
|
101
101
|
}
|
package/src/engine.js
CHANGED
|
@@ -266,6 +266,15 @@ class RavennaEngine extends EventEmitter {
|
|
|
266
266
|
if (!desc) throw new Error(`Unknown parameter '${key}'`);
|
|
267
267
|
|
|
268
268
|
let v = value;
|
|
269
|
+
if (desc.unit === 'enum') {
|
|
270
|
+
// Accept either the integer or a label string (e.g. 'Brickwall', '+24 dBu').
|
|
271
|
+
if (typeof v === 'string') {
|
|
272
|
+
const map = this._enumMapFor(moduleId, key);
|
|
273
|
+
const hit = map && Object.keys(map).find((k) => k.toLowerCase() === v.toLowerCase());
|
|
274
|
+
if (hit != null) v = map[hit];
|
|
275
|
+
if (typeof v === 'string') v = parseInt(v, 10); // numeric-string fallback ("3")
|
|
276
|
+
}
|
|
277
|
+
}
|
|
269
278
|
if (desc.unit === 'tenths-db') {
|
|
270
279
|
v = dbToTenths(value);
|
|
271
280
|
const cap = this._capFor(moduleId, key);
|
|
@@ -287,6 +296,15 @@ class RavennaEngine extends EventEmitter {
|
|
|
287
296
|
return null;
|
|
288
297
|
}
|
|
289
298
|
|
|
299
|
+
/** Label->int map for an enum param: static (PARAMS) or device-provided (capabilities). */
|
|
300
|
+
_enumMapFor(moduleId, key) {
|
|
301
|
+
const desc = PARAMS[key];
|
|
302
|
+
if (desc && desc.enum) return desc.enum; // model-supplied (e.g. out_max_level)
|
|
303
|
+
const c = this.capabilities[moduleId];
|
|
304
|
+
if (key === 'roll_off_filter' && c && c.rollOff) return c.rollOff; // device-supplied
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
|
|
290
308
|
_channelCountFor(moduleId, section) {
|
|
291
309
|
if (!this.tree || !Array.isArray(this.tree._modules)) return 1;
|
|
292
310
|
const m = this.tree._modules.find((x) => x.id === moduleId);
|
|
@@ -416,7 +434,7 @@ class RavennaEngine extends EventEmitter {
|
|
|
416
434
|
}
|
|
417
435
|
if (typeof outs.out_max_level === 'number' && outs.out_max_level !== prev.out_max_level) {
|
|
418
436
|
prev.out_max_level = outs.out_max_level;
|
|
419
|
-
this.emit('param', { moduleId, key: 'out_max_level', raw: outs.out_max_level, value: outs.out_max_level, unit: '
|
|
437
|
+
this.emit('param', { moduleId, key: 'out_max_level', raw: outs.out_max_level, value: outs.out_max_level, unit: 'enum' });
|
|
420
438
|
}
|
|
421
439
|
if (Array.isArray(outs.channels)) {
|
|
422
440
|
if (!Array.isArray(prev.trims)) prev.trims = [];
|
package/src/paths.js
CHANGED
|
@@ -60,11 +60,14 @@ const PARAMS = {
|
|
|
60
60
|
capEnum: 'roll_off_filters',
|
|
61
61
|
build: (v) => ({ roll_off_filter: v | 0 })
|
|
62
62
|
},
|
|
63
|
-
// out_max_level
|
|
63
|
+
// out_max_level selects the card's output reference level. The device exposes only
|
|
64
|
+
// the raw int (0/1) with NO label map, so the meanings are MODEL knowledge encoded
|
|
65
|
+
// here (Hapi MkII D/A, sub_type 218; may differ on other cards). Confirmed mapping.
|
|
64
66
|
out_max_level: {
|
|
65
|
-
section: 'outs', unit: '
|
|
67
|
+
section: 'outs', unit: 'enum', confidence: 'confirmed',
|
|
66
68
|
capFlag: 'out_max_level',
|
|
67
|
-
|
|
69
|
+
enum: { '+18 dBu': 0, '+24 dBu': 1 },
|
|
70
|
+
build: (v) => ({ out_max_level: v | 0 })
|
|
68
71
|
},
|
|
69
72
|
// Per-channel trim is an array within custom.outs; the partial-array shape (target
|
|
70
73
|
// channel carries {trim}, others {}) is confirmed to apply on the device.
|