Skip to content

Commit

Permalink
Merge pull request #57 from istnv/V3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian authored Mar 6, 2023
2 parents b683f63 + a5280b8 commit 423e7a8
Show file tree
Hide file tree
Showing 25 changed files with 5,177 additions and 2,943 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
node_modules/
.eslintrc
/pkg
/pkg.tgz
DEBUG-INSPECT
DEBUG-INSPECTx
DEBUG-PACKAGE
DEBUG-PACKAGED
218 changes: 218 additions & 0 deletions actions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,218 @@
import { Regex } from '@companion-module/base'
import { pad0 } from './helpers.js'

export function buildStaticActions(self) {
const sendOSCCmd = async(cmd, arg) => (
await self.sendOSC(cmd, arg)
)

let actions = {
label: {
name: 'Set label',
options: [
{
type: 'dropdown',
label: 'Type',
id: 'type',
choices: [
{ id: '/ch/', label: 'Channel 1-16' },
{ id: '/rtn/', label: 'Fx Return 1-4' },
{ id: '/fxsend/', label: 'Fx Send 1-4' },
{ id: '/bus/', label: 'Bus 1-6' },
],
default: '/ch/',
},
{
type: 'textinput',
label: 'Channel, Fx Return, Fx Send or Bus Number',
id: 'num',
default: '1',
regex: Regex.NUMBER,
},
{
type: 'textinput',
label: 'Label',
id: 'lab',
default: '',
},
],
callback: async (action, context) => {
const opt = action.options
const arg = {
type: 's',
value: '' + opt.lab,
}
nVal = opt.type == '/ch/' ? pad0(opt.num) : opt.num
await sendOSCCmd(opt.type + nVal + '/config/name', arg)
},
},

mLabel: {
name: 'Set Main label',
options: [
{
type: 'textinput',
label: 'Label',
id: 'lab',
default: '',
},
],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/lr/config/name', { type: 's', value: '' + opt.lab })
},
},

usbLabel: {
name: 'Set USB/Aux label',
options: [
{
type: 'textinput',
label: 'Label',
id: 'lab',
default: 'USB',
},
],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/rtn/aux/config/name', { type: 's', value: '' + opt.lab })
},
},

color: {
name: 'Set color',
options: [
{
type: 'dropdown',
label: 'Type',
id: 'type',
choices: [
{ id: '/ch/', label: 'Channel 1-16' },
{ id: '/rtn/', label: 'Fx Return 1-4' },
{ id: '/fxsend/', label: 'Fx Send 1-4' },
{ id: '/bus/', label: 'Bus 1-6' },
],
default: '/ch/',
},
{
type: 'textinput',
label: 'Channel, Fx Return, Fx Send or Bus Number',
id: 'num',
default: '1',
regex: Regex.NUMBER,
},
{
type: 'dropdown',
label: 'color',
id: 'col',
choices: self.COLOR_VALUES,
},
],
callback: async (action, context) => {
const opt = action.options
const arg = {
type: 'i',
value: parseInt(opt.col),
}
nVal = opt.type == '/ch/' ? pad0(opt.num) : opt.num
await sendOSCCmd(opt.type + nval + '/config/color', arg)
},
},

mColor: {
name: 'Set Main color',
options: [
{
type: 'dropdown',
label: 'color',
id: 'col',
choices: self.COLOR_VALUES,
},
],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/lr/config/color', { type: 'i', value: parseInt(opt.col) })
},
},

usbColor: {
name: 'Set USB color',
options: [
{
type: 'dropdown',
label: 'color',
id: 'col',
choices: self.COLOR_VALUES,
},
],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/rtn/aux/config/color', { type: 'i', value: parseInt(opt.col) })
},
},

load_snap: {
name: 'Load Console Snapshot',
options: [
{
type: 'textinput',
label: 'Snapshot Number 1-64',
id: 'snap',
default: 1,
min: 1,
max: 64,
regex: Regex.NUMBER,
},
],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/-snap/load', { type: 'i', value: parseInt(opt.snap) })
},
},

next_snap: {
name: 'Load Next Console Snapshot',
options: [],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/-snap/load', { type: 'i', value: parseInt(opt.snap) })
},
},

prev_snap: {
name: 'Load Prior Console Snapshot',
options: [],
callback: async (action, context) => {
const snap = Math.max(--self.currentSnapshot,1)
await sendOSCCmd('/-snap/load', { type: 'i', value: snap })
},
},

save_snap: {
name: 'Save Current Console Snapshot',
options: [],
callback: async (action, context) => {
const snap = Math.min(--self.currentSnapshot,1)
await sendOSCCmd('/-snap/save', { type: 'i', value: snap } )
},
},

tape: {
name: 'Tape Operation',
options: [
{
type: 'dropdown',
label: 'Function',
id: 'tFunc',
choices: self.TAPE_FUNCTIONS,
},
],
callback: async (action, context) => {
const opt = action.options
await sendOSCCmd('/-stat/tape/state', { type: 'i', value: parseInt(opt.tFunc) })
},

},
}
Object.assign(self.actionDefs, actions)
}
25 changes: 25 additions & 0 deletions buildSnapshotDefs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { pad0 } from './helpers.js'

export function buildSnapshotDefs(self) {
let snapVars = []

for (let s = 1; s <= 64; s++) {
let c = pad0(s)
let theID = `/-snap/${c}/name`
let fID = 's_name_' + c
self.fbToStat[fID] = theID
self.xStat[theID] = {
name: '#' + c,
defaultName: '#' + c,
valid: false,
fbID: fID,
polled: 0,
}
snapVars.push({
name: 'Snapshot ' + c + ' Name',
variableId: fID,
})
self.snapshot[s] = theID
}
self.variableDefs.push(...snapVars)
}
Loading

0 comments on commit 423e7a8

Please sign in to comment.