From 2405049b9837d77bc4d3d7d5351c15341f598884 Mon Sep 17 00:00:00 2001 From: John A Knight Jr Date: Fri, 1 Nov 2024 18:48:53 -0700 Subject: [PATCH 1/2] Adjust meter definitions to match feedback ids. --- buildMeterDefs.js | 19 +++++++++++++++---- buildStripDefs.js | 4 ++++ index.js | 6 +++--- package.json | 2 +- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/buildMeterDefs.js b/buildMeterDefs.js index d9f7d85..f78d1b3 100644 --- a/buildMeterDefs.js +++ b/buildMeterDefs.js @@ -11,18 +11,23 @@ export function buildMeterDefs(self) { fbID += '_' + fb.options.num1 break case 'rtn': + fbID += fb.options.num2 + break case 'fx': - fbID += fb.options.num2 + fbID += 'send_' + fb.options.num2 break case 'bus': fbID += fb.options.num3 break + case 'aux': + fbID = 'rtn_aux' + break; } if (['aux', 'rtn', 'lr', 'mon'].includes(type)) { fbID += `_${fb.options.pan}` } - return fbID ? `m_${fbID}` : undefined + return !(fbID && fbID.includes('undefined')) ? `m_${fbID}` : undefined } let stat = {} @@ -90,13 +95,16 @@ export function buildMeterDefs(self) { feedbackID = muteFeedbackID = variableID = - ['bus1', 'bus2', 'bus3', 'bus4', 'bus5', 'bus6', 'fxsend1', 'fxsend2', 'fxsend3', 'fxsend4'][i - 26] + ['bus1', 'bus2', 'bus3', 'bus4', 'bus5', 'bus6', 'fxsend_1', 'fxsend_2', 'fxsend_3', 'fxsend_4'][i - 26] n = ['Bus 1', 'Bus 2', 'Bus 3', 'Bus 4', 'Bus 5', 'Bus 6', 'FX Send 1', 'FX Send 2', 'FX Send 3', 'FX Send 4'][ i - 26 ] } else { let m = parseInt((i - 36) / 2) channelID = feedbackID = muteFeedbackID = ['lr', 'mon'][m] + if (channelID=='mon') { + muteFeedbackID = 'solo_mute' + } channelID += i % 2 ? '_r' : '_l' variableID = feedbackID += i % 2 ? '_r' : '_l' n = ['Main out', 'Monitor out'][m] @@ -138,7 +146,7 @@ export function buildMeterDefs(self) { type: 'dropdown', label: 'Type', id: 'type', - default: 'ch', + default: 'lr', choices: stripType, }, { @@ -146,6 +154,7 @@ export function buildMeterDefs(self) { type: 'number', label: 'Number', id: 'num1', + default: 1, min: 1, max: 16, isVisible: (options) => options.type == 'ch', @@ -155,6 +164,7 @@ export function buildMeterDefs(self) { type: 'number', label: 'Number', id: 'num2', + default: 1, min: 1, max: 4, isVisible: (options) => ['rtn', 'fx'].includes(options.type), @@ -164,6 +174,7 @@ export function buildMeterDefs(self) { type: 'number', label: 'Number', id: 'num3', + default: 1, min: 1, max: 6, isVisible: (options) => options.type == 'bus', diff --git a/buildStripDefs.js b/buildStripDefs.js index 65e52b7..2395db6 100644 --- a/buildStripDefs.js +++ b/buildStripDefs.js @@ -11,6 +11,7 @@ export function buildStripDefs(self) { let procActions = {} let trimActions = {} let panActions = {} + let panFeedbacks = {} // let fadeActions = {} // let storeActions = {} let levelActions = {} @@ -511,6 +512,8 @@ export function buildStripDefs(self) { } } + + for (const theStrip of defStrip) { let stripID = theStrip.id let chID = '/' + stripID @@ -1083,6 +1086,7 @@ export function buildStripDefs(self) { } } } + // apply channel strip configurations Object.assign(self.xStat, stat) Object.assign(self.fbToStat, fbToStat) diff --git a/index.js b/index.js index 5bdb03e..701bf5a 100644 --- a/index.js +++ b/index.js @@ -800,12 +800,11 @@ class BAirInstance extends InstanceBase { let total = mv.total const oldVal = mv.dbVal mv.valid = true - mv.count = ++mv.count % 10 + mv.count = ++mv.count % 2 total -= mv.samples[mv.count] mv.samples[mv.count] = newVal total += newVal mv.total = total - let val = Math.round(total) / 10 // Math.round(total / 256.0 ) / 10 mv.dbVal = newVal if (mv.fbSubs.size > 0 && newVal != oldVal) { feedbacks.push(...mv.fbSubs) @@ -815,7 +814,8 @@ class BAirInstance extends InstanceBase { // console.log(`${mv.vName} = ${val}`) // } if (this.lastMeter && Date.now() - this.lastMeter > 50) { - variables[mv.vName] = Math.max(val, -60.0) +// let val = Math.round(total) / 10 // Math.round(total / 256.0 ) / 10 + variables[mv.vName] = Math.max(Math.round(total) / 10, -60.0) } } this.setVariableValues(variables) diff --git a/package.json b/package.json index 1b9ce6e..d5c7303 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "behringer-xair", - "version": "2.5.1", + "version": "2.5.2", "type": "module", "main": "index.js", "scripts": { From f86becf3c69711d618164ac11976ffe1c814731b Mon Sep 17 00:00:00 2001 From: John A Knight Jr Date: Sat, 2 Nov 2024 13:16:05 -0700 Subject: [PATCH 2/2] Improve meter response. --- index.js | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/index.js b/index.js index 701bf5a..e65f7a0 100644 --- a/index.js +++ b/index.js @@ -44,9 +44,9 @@ class BAirInstance extends InstanceBase { async init(config) { this.config = config - if (!this.config.model) { - this.config.model = 'X18' - } + if (!this.config.model) { + this.config.model = 'X18' + } if (!this.config.channels) { this.config.channels = parseInt(this.config.model.replace(/\D/g, '')) @@ -169,7 +169,11 @@ class BAirInstance extends InstanceBase { pulse() { this.sendOSC('/xremote', []) // subscribe for meter data - this.sendOSC('/meters', [{ type: 's', value: '/meters/1' }]) + this.sendOSC('/-local/updrate', [{ type: 'i', value: 1 }]) + this.sendOSC('/meters', [ + { type: 's', value: '/meters/1' }, + { type: 'i', value: 0 }, + ]) // any leftover status needed? if (this.needStats) { this.pollStats() @@ -549,7 +553,7 @@ class BAirInstance extends InstanceBase { if (this.oscPort) { this.oscPort.close() } - // no host or still default '0.0.0.0' + // no host or still default '0.0.0.0' if (!this.config.host || this.config.host.split('.').reduce((acc, b) => acc + b, 0) == 0) { this.updateStatus(InstanceStatus.ConnectionFailure, 'No host IP') } else { @@ -800,26 +804,20 @@ class BAirInstance extends InstanceBase { let total = mv.total const oldVal = mv.dbVal mv.valid = true - mv.count = ++mv.count % 2 + mv.dbVal = newVal + if (mv.fbSubs.size > 0 && newVal != oldVal) { + this.checkFeedbacksById(...mv.fbSubs) + } + mv.count = ++mv.count % 10 total -= mv.samples[mv.count] mv.samples[mv.count] = newVal total += newVal mv.total = total - mv.dbVal = newVal - if (mv.fbSubs.size > 0 && newVal != oldVal) { - feedbacks.push(...mv.fbSubs) - } - // newVal = Math.round((val / 256.0) * 10) / 10 - // if (['v_ch15','v_ch16'].includes(mv.vName)) { - // console.log(`${mv.vName} = ${val}`) - // } if (this.lastMeter && Date.now() - this.lastMeter > 50) { -// let val = Math.round(total) / 10 // Math.round(total / 256.0 ) / 10 variables[mv.vName] = Math.max(Math.round(total) / 10, -60.0) } } this.setVariableValues(variables) - this.checkFeedbacksById(feedbacks) this.lastMeter = Date.now() }