Skip to content

Commit

Permalink
Merge pull request #105 from istnv/feat/mons
Browse files Browse the repository at this point in the history
Add missing commands for monitor setup
  • Loading branch information
istnv authored Sep 18, 2024
2 parents cce8b1e + b69d2c0 commit 9870c80
Show file tree
Hide file tree
Showing 8 changed files with 342 additions and 92 deletions.
46 changes: 39 additions & 7 deletions buildHADefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,56 @@ import { pad0 } from './helpers.js'

export function buildHADefs(self) {
let haActions = {}
let haVariables = {}
let haVariables = []
let ppRange = [1,4]
const mc = self.config.channels

for (let s = 1; s <= 24; s++) {
let c = pad0(s)
let baseID = `/headamp/${c}/`
let baseFID = 'ha' + c
let fID = `ha_gain${c}`
let vID = `ha_gain${s}`
let theID = baseID + 'gain'
self.fbToStat[fID] = theID
self.xStat[theID] = {
name: 'ha' + c + '_gain',
varID: vID,
valid: false,
fbID: fID,
polled: 0,
}
haVariables.push({
name: 'Head Amp ' + c ,
variableId: fID,
})
if (self.HA_CONFIG[s][mc].has) {
let haName = self.HA_CONFIG[s][mc].name + 'Gain'




haVariables.push({
name: haName + ' %',
variableId: vID + '_p',
})
haVariables.push({
name: haName + ' dB',
variableId: vID + '_d',
})
if (self.HA_CONFIG[s].ph) {
fID = `ha_pp${c}`
vID = `ha_pp${s}`
theID = baseID + 'phantom'
self.fbToStat[fID] = theID
self.xStat[theID] = {
varID: vID,
valid: false,
fbID: fID,
polled: 0,
pp: false,
}
haVariables.push({
name: self.HA_CONFIG[s][mc].name + ' Phantom',
variableId: vID,
})
ppRange[2] = Math.max(ppRange[2],s)
}
}

}
self.variableDefs.push(...haVariables)
Expand Down
186 changes: 142 additions & 44 deletions buildSoloDefs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export function buildSoloDefs(self) {
for (const cmd of defSolo) {
const pfx = cmd.prefix
const cMap = cmd.cmdMap
let fbDescription
switch (cmd.id) {
case 'solosw':
for (const cm in cmd.cmdMap) {
Expand Down Expand Up @@ -148,6 +149,7 @@ export function buildSoloDefs(self) {
varID: soloID,
valid: false,
polled: 0,
fbSubs: new Set(),
}
soloFbToStat[actID] = c
if (ch.isFader) {
Expand Down Expand Up @@ -215,56 +217,152 @@ export function buildSoloDefs(self) {
variableId: soloID + '_rp',
})
} else {
soloActions[actID] = {
name: 'Solo ' + ch.description,
options: [],
callback: async (action, context) => {
let strip = `${c}`
let arg = { type: 'i', value: setToggle(self.xStat[strip].isOn, action.options.set) }
await self.sendOSC(strip, arg)
},
}
soloActions[actID].options.push({
type: 'dropdown',
label: 'Value',
id: 'set',
default: '2',
choices: [
{ id: '1', label: 'On' },
{ id: '0', label: 'Off' },
{ id: '2', label: 'Toggle' },
],
})
soloActions[actID]
stat[c].isOn = false
let fbDescription = 'Solo ' + ch.description + ' status'
soloFeedbacks[actID] = {
type: 'boolean',
name: 'Indicate ' + fbDescription,
description: 'Indicate ' + fbDescription + ' on button',
options: [
{
switch (ch.actID) {
case 'source':
soloActions[actID] = {
name: 'Monitor Source',
options: [
{
type: 'dropdown',
label: 'Source',
id: 'source',
default: 0,
choices: self.MONITOR_SOURCES,
},
],
callback: async (action, context) => {
let arg = { type: 'i', value: action.options.source }
await self.sendOSC(c, arg)
},
}
stat[c].varID = 'm_source'
soloVariables.push({
name: 'Monitor Source',
variableId: 'm_source',
})
fbDescription = 'Monitor Source'
soloFeedbacks[actID] = {
type: 'boolean',
name: fbDescription,
description: 'Indicate ' + fbDescription + ' is on button',
options: [
{
type: 'dropdown',
label: 'Source',
id: 'source',
default: 0,
choices: self.MONITOR_SOURCES,
},
],
defaultStyle: {
color: combineRgb(255, 255, 255),
bgcolor: combineRgb.apply(this, ch.bg),
},
// subscribe: async (feedback, context) => {
// const fbID = feedback.feedbackId
// if (fbID) {
// self.xStat[self.fbToStat[fbID]].fbSubs.add(feedback.id)
// }
// },
// unsubscribe: async (feedback, context) => {
// const fbID = feedback.feedbackId
// if (fbID) {
// self.xStat[self.fbToStat[fbID]].fbSubs.delete(feedback.id)
// }
// },
callback: function (feedback, context) {
var fbWhich = feedback.feedbackId
var stat = self.xStat[self.fbToStat[fbWhich]]
var source = feedback.options.source

return stat.m_source == source
},
}
break
case 'chmode':
case 'busmode':
soloActions[actID] = {
name: ch.description,
options: [
{
type: 'dropdown',
label: 'Value',
id: 'set',
default: '1',
choices: [
{ id: '1', label: 'AFL' },
{ id: '0', label: 'PFL' },
],
},
],
callback: async (action, context) => {
let arg = { type: 'i', value: parseInt(action.options.set) }
await self.sendOSC(c, arg)
},
}
stat[c].varID = 'm_' + ch.actID
soloVariables.push({
name: ch.description,
variableId: stat[c].varID,
})
break
default:
soloActions[actID] = {
name: 'Solo ' + ch.description,
options: [],
callback: async (action, context) => {
let strip = `${c}`
let arg = { type: 'i', value: setToggle(self.xStat[strip].isOn, action.options.set) }
await self.sendOSC(c, arg)
},
}
soloActions[actID].options.push({
type: 'dropdown',
label: 'State',
id: 'state',
default: '1',
label: 'Value',
id: 'set',
default: '2',
choices: [
{ id: '1', label: 'On' },
{ id: '0', label: 'Off' },
{ id: '2', label: 'Toggle' },
],
},
],
defaultStyle: {
color: combineRgb(255, 255, 255),
bgcolor: combineRgb.apply(this, ch.bg),
},
callback: function (feedback, context) {
var fbWhich = feedback.feedbackId
var stat = self.xStat[self.fbToStat[fbWhich]]
var state = feedback.options.state != '0'
})
stat[c].isOn = false
fbDescription = 'Solo ' + ch.description + ' status'
soloFeedbacks[actID] = {
type: 'boolean',
name: 'Indicate ' + fbDescription,
description: 'Indicate ' + fbDescription + ' on button',
options: [
{
type: 'dropdown',
label: 'State',
id: 'state',
default: '1',
choices: [
{ id: '1', label: 'On' },
{ id: '0', label: 'Off' },
],
},
],
defaultStyle: {
color: combineRgb(255, 255, 255),
bgcolor: combineRgb.apply(this, ch.bg),
},
callback: function (feedback, context) {
var fbWhich = feedback.feedbackId
var stat = self.xStat[self.fbToStat[fbWhich]]
var state = feedback.options.state != '0'

return stat.isOn == state
},
return stat.isOn == state
},
}
stat[c].varID = 's_' + ch.actID
soloVariables.push({
name: ch.description,
variableId: stat[c].varID,
})
break
}
}
}
Expand Down
13 changes: 12 additions & 1 deletion companion/HELP.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ Contributions for development and maintenance of this open source module are alw
| Channel, USB, FX Send, Fx Return, Bus and Main Solo | Solos the selected Channel, USB, FX Send, Fx Return, Bus and Main |
| Clear Solo | Clears all active solos |
| Solo Level Set | Sets the level of the Solo (monitor) output |
| Set Monitor Source | Sets the Source of the Monitor output |
| Channel Solo Mode | Set solo mode for Channels (AFL/PFL) |
| Channel Solo Mode | Set solo mode for Channels (AFL/PFL) |
| PFL Dim | Enable/Disable PFL Dim/Attenuation |
| Solo Level Adjust | Adjust the Solo level up or down by steps **see notes* |
| Solo Dim | Dims the Solo output level to the value configured in the console. |
| Solo Mute | Mutes the Solo output |
Expand Down Expand Up @@ -100,6 +104,11 @@ Contributions for development and maintenance of this open source module are alw
| **$(INSTANCENAME:f_fxsend#_d)** | FX Bus Master # Fader dB |
| **$(INSTANCENAME:f_fxsend#_p)** | FX Bus Master # Fader Percent |
| **$(INSTANCENAME:f_fxsend#_rp)** | FX Bus Master # Fader Relative Loudness Percent |
| **$(INSTANCENAME:m_source)** | Current Monitor Output Source |
| **$(INSTANCENAME:m_chmode)** | Channel Solo Mode (AFL/PFL) |
| **$(INSTANCENAME:m_busmode)** | Bus Solo Mode (AFL/PFL) |
| **$(INSTANCENAME:m_dimpfl)** | Solo PFL Attenuation Enabled (true/false) |
| **$(INSTANCENAME:m_dim)** | Solo Dim Enabled (true/false) |
| **$(INSTANCENAME:f_solo_d)** | Solo (monitor) output level dB |
| **$(INSTANCENAME:f_solo_p)** | Solo (monitor) output level Percent |
| **$(INSTANCENAME:f_fxsend#_rp)** | FX Bus Master # Fader Relative Loudness Percent |
Expand Down Expand Up @@ -142,11 +151,13 @@ Contributions for development and maintenance of this open source module are alw
| **Indicate Main LR Solo** * | Changes the button when Main LR Solo on |
| **Indicate USB/Aux Solo** * | Changes the button when USB/Aux Solo on |
| **Indicate processing status** * | Changes the button according to the selected channel/process status |
| **Indicate Monitor Source** * | Changes the button when Monitor Source is set to selected option |
| **Color when Solo Mute** * | Sets the button color when the Solo output is muted |
| **Color when Solo Mono** * | Sets the button color when the Solo output is mono |
| **Color when Solo Dim PFL** * | Sets the button color when the Solo PFL is dimmed |
| **Color when Solo Dim** * | Sets the button color when the Solo output is dimmed |
| **Color when Any Solo Active** | Sets the button color when 'Clr Solo' is active |
| **Meter Bar** | Adds a graphic meter bar for the selected channel/bus to the button |
| **Meter Bar** | Adds a graphic meter bar for the selected channel/bus to the button |

## Notes

Expand Down
59 changes: 35 additions & 24 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,53 @@
import { Regex } from '@companion-module/base'

// Return config fields for web config
export function getConfigFields() {
let cf = []
cf.push({
export function getConfigFields() {
let cf = [
{
type: 'textinput',
id: 'host',
label: 'Target IP',
tooltip: 'The IP of the MR / XR console',
width: 6,
default: '0.0.0.0',
regex: Regex.IP,
})
cf.push({
},
{
type: 'checkbox',
id: 'scan',
label: 'Scan network for XAir mixers?',
default: true,
width: 12,
})
},
{
type: 'dropdown',
id: 'model',
label: 'Select Model',
tooltip: 'This model is assumed when mixer is offline',
width: 6,
default: 'X18',
choices: this.MIXER_CHOICES,
},
]

let ch = []
if (Object.keys(this.unitsFound || {}).length == 0) {
ch = [{ id: 'none', label: 'No XAir units located' }]
} else {
let unit = this.unitsFound
for (let u in unit) {
ch.push({ id: unit[u].m_name, label: `${unit[u].m_name} (${unit[u].m_ip})` })
}
let ch = []
if (Object.keys(this.unitsFound || {}).length == 0) {
ch = [{ id: 'none', label: 'No XAir units located' }]
} else {
let unit = this.unitsFound
for (let u in unit) {
ch.push({ id: unit[u].m_name, label: `${unit[u].m_name} (${unit[u].m_ip})` })
}
cf.push({
type: 'dropdown',
id: 'mixer',
label: 'Select Mixer by Name',
tooltip: 'Name and IP of mixers on the network',
width: 12,
default: ch[0].id,
choices: ch,
})
return cf
}

cf.push({
type: 'dropdown',
id: 'mixer',
label: 'Select Mixer by Name',
tooltip: 'Name and IP of mixers on the network',
width: 12,
default: ch[0].id,
choices: ch,
})
return cf
}
Loading

0 comments on commit 9870c80

Please sign in to comment.