mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-04-18 06:43:33 +00:00
Compare commits
27 Commits
v0.14.3
...
68b8ab2018
| Author | SHA1 | Date | |
|---|---|---|---|
| 68b8ab2018 | |||
| 6ec3c55383 | |||
| 847dffd842 | |||
| 283511b94d | |||
|
|
a1c27a3f1b | ||
| 828d7cc248 | |||
| 5fa2aabecb | |||
| ac8a677f99 | |||
| e0c15f3ba5 | |||
| 1f4b261fc4 | |||
| 739ce44288 | |||
| 1b9cc1f66a | |||
|
|
3f6e8c4209 | ||
|
|
e8f324cba5 | ||
|
|
9564510c9e | ||
| 229bc4a15f | |||
|
|
5057029267 | ||
| 4ed567e464 | |||
| c8cfef858c | |||
| 23285e6e50 | |||
| b6b64781ed | |||
| 9bc4d21739 | |||
| 7a0d5c56e5 | |||
| ac8f635263 | |||
| 19fda4daec | |||
| 58866b794b | |||
| 32a09db1a4 |
9
.github/workflows/golang-ci.yml
vendored
9
.github/workflows/golang-ci.yml
vendored
@@ -23,7 +23,8 @@ jobs:
|
|||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
with:
|
with:
|
||||||
go-version: '1.24'
|
go-version: '1.24'
|
||||||
- name: Install golangci-lint
|
- name: golangci-lint
|
||||||
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
|
uses: golangci/golangci-lint-action@v9
|
||||||
- name: Run golangci-lint
|
with:
|
||||||
run: golangci-lint run ./...
|
version: v2.6.0
|
||||||
|
args: --config .golangci.yml
|
||||||
|
|||||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -38,4 +38,8 @@ go.work.sum
|
|||||||
|
|
||||||
# End of ignr
|
# End of ignr
|
||||||
|
|
||||||
update_readme.py
|
# Man pages
|
||||||
|
xair-cli.1
|
||||||
|
x32-cli.1
|
||||||
|
|
||||||
|
update_readme.py
|
||||||
|
|||||||
174
.golangci.yml
174
.golangci.yml
@@ -1,54 +1,142 @@
|
|||||||
|
version: '2'
|
||||||
|
|
||||||
run:
|
run:
|
||||||
# timeout for analysis, e.g. 30s, 3m, default is 1m
|
|
||||||
timeout: 3m
|
timeout: 3m
|
||||||
# exclude test files
|
|
||||||
tests: true
|
tests: true
|
||||||
|
go: '1.24'
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
# Set to true runs only fast linters.
|
disable: [dupl]
|
||||||
# Good option for 'lint on save', pre-commit hook or CI.
|
|
||||||
fast: true
|
|
||||||
|
|
||||||
disable-all: true
|
|
||||||
|
|
||||||
enable:
|
enable:
|
||||||
- gosimple
|
# Default enabled linters
|
||||||
- govet
|
- errcheck # Check for unchecked errors
|
||||||
- ineffassign
|
- govet # Go's built-in vetting tool
|
||||||
- staticcheck
|
- ineffassign # Detect ineffectual assignments
|
||||||
- unused
|
- staticcheck # Advanced static analysis
|
||||||
- gofmt
|
- unused # Check for unused code
|
||||||
- gofumpt
|
# Additional useful linters
|
||||||
- misspell
|
- misspell # Detect common misspellings
|
||||||
- unparam
|
- unparam # Check for unused function parameters
|
||||||
- gosec
|
- gosec # Security checks
|
||||||
- asciicheck
|
- asciicheck # Check for non-ASCII characters
|
||||||
- errname
|
- errname # Check error variable names
|
||||||
- gci
|
- godot # Check for missing periods in comments
|
||||||
- godot
|
- revive # Highly configurable linter for style and correctness
|
||||||
- goimports
|
- gocritic # Detect code issues and suggest improvements
|
||||||
- revive
|
- gocyclo # Check for cyclomatic complexity
|
||||||
|
- dupl # Check for code duplication
|
||||||
|
- predeclared # Check for shadowing of predeclared identifiers
|
||||||
|
- copyloopvar # Check for loop variable capture in goroutines
|
||||||
|
- errorlint # Check for common mistakes in error handling
|
||||||
|
- goconst # Check for repeated strings that could be constants
|
||||||
|
- gosmopolitan # Check for non-portable code
|
||||||
|
|
||||||
linters-settings:
|
settings:
|
||||||
gofmt:
|
misspell:
|
||||||
rewrite-rules:
|
locale: UK
|
||||||
- pattern: 'interface{}'
|
|
||||||
replacement: 'any'
|
|
||||||
- pattern: 'a[b:len(a)]'
|
|
||||||
replacement: 'a[b:]'
|
|
||||||
|
|
||||||
misspell:
|
errcheck:
|
||||||
locale: UK
|
check-type-assertions: true
|
||||||
|
check-blank: true
|
||||||
|
exclude-functions:
|
||||||
|
- fmt.Fprintf
|
||||||
|
- fmt.Fprintln
|
||||||
|
- fmt.Printf
|
||||||
|
- fmt.Println
|
||||||
|
- fmt.Errorf
|
||||||
|
|
||||||
errcheck:
|
revive:
|
||||||
check-type-assertions: true
|
severity: warning
|
||||||
|
rules:
|
||||||
|
# Code quality and style
|
||||||
|
- name: exported
|
||||||
|
arguments:
|
||||||
|
- 'checkPrivateReceivers'
|
||||||
|
- 'sayRepetitiveInsteadOfStutters'
|
||||||
|
- name: var-naming
|
||||||
|
- name: package-comments
|
||||||
|
- name: range-val-in-closure
|
||||||
|
- name: time-naming
|
||||||
|
- name: context-as-argument
|
||||||
|
- name: context-keys-type
|
||||||
|
- name: dot-imports
|
||||||
|
- name: empty-block
|
||||||
|
- name: error-return
|
||||||
|
- name: error-strings
|
||||||
|
- name: error-naming
|
||||||
|
- name: if-return
|
||||||
|
- name: increment-decrement
|
||||||
|
- name: indent-error-flow
|
||||||
|
- name: receiver-naming
|
||||||
|
- name: redefines-builtin-id
|
||||||
|
- name: superfluous-else
|
||||||
|
- name: unexported-return
|
||||||
|
- name: unreachable-code
|
||||||
|
- name: unused-parameter
|
||||||
|
- name: var-declaration
|
||||||
|
- name: blank-imports
|
||||||
|
- name: range
|
||||||
|
|
||||||
|
# Disabled rules (can be enabled if needed)
|
||||||
|
# - name: line-length-limit
|
||||||
|
# arguments: [120]
|
||||||
|
# - name: function-length
|
||||||
|
# arguments: [50, 0]
|
||||||
|
# - name: cyclomatic
|
||||||
|
# arguments: [10]
|
||||||
|
|
||||||
|
gosec:
|
||||||
|
excludes:
|
||||||
|
- G104 # Duplicated errcheck checks
|
||||||
|
- G115 # integer overflow conversion int -> uint32
|
||||||
|
|
||||||
|
exclusions:
|
||||||
|
warn-unused: false
|
||||||
|
rules:
|
||||||
|
# Exclude some linters from running on tests files.
|
||||||
|
- path: _test\.go
|
||||||
|
linters:
|
||||||
|
- gocyclo
|
||||||
|
- errcheck
|
||||||
|
- dupl
|
||||||
|
- gosec
|
||||||
|
|
||||||
|
paths:
|
||||||
|
- vendor
|
||||||
|
|
||||||
|
# Formatters configuration
|
||||||
|
formatters:
|
||||||
|
# Enable specific formatters
|
||||||
|
enable:
|
||||||
|
- gofumpt # Stricter gofmt alternative
|
||||||
|
- goimports # Organizes imports
|
||||||
|
- gci # Controls import order/grouping
|
||||||
|
- golines # Enforces line length
|
||||||
|
|
||||||
|
# Formatter-specific settings
|
||||||
|
settings:
|
||||||
|
goimports:
|
||||||
|
local-prefixes: [github.com/onyx-and-iris/xair-cli]
|
||||||
|
|
||||||
|
gci:
|
||||||
|
# Define import sections order
|
||||||
|
sections:
|
||||||
|
- standard # Standard library
|
||||||
|
- default # Everything else
|
||||||
|
- prefix(github.com/onyx-and-iris/xair-cli) # Current module
|
||||||
|
|
||||||
|
gofumpt:
|
||||||
|
extra-rules: true # Enable additional formatting rules
|
||||||
|
|
||||||
|
exclusions:
|
||||||
|
warn-unused: true
|
||||||
|
|
||||||
|
paths:
|
||||||
|
- vendor
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
max-same-issues: 0
|
# Limit the number of same issues reported to avoid spam
|
||||||
max-issues-per-linter: 0
|
max-same-issues: 50
|
||||||
exclude-use-default: false
|
|
||||||
exclude:
|
# Limit the number of issues per linter to keep output manageable
|
||||||
# gosec: Duplicated errcheck checks
|
max-issues-per-linter: 100
|
||||||
- G104
|
|
||||||
# gosec: integer overflow conversion int -> uint32
|
|
||||||
- G115
|
|
||||||
|
|||||||
@@ -3,6 +3,11 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: update-readme
|
- id: update-readme
|
||||||
name: update-readme
|
name: update-readme
|
||||||
entry: python update_readme.py
|
entry: task generate
|
||||||
language: python
|
language: system
|
||||||
pass_filenames: false
|
pass_filenames: false
|
||||||
|
|
||||||
|
- repo: https://github.com/tekwizely/pre-commit-golang
|
||||||
|
rev: v1.0.0-rc.4
|
||||||
|
hooks:
|
||||||
|
- id: go-mod-tidy
|
||||||
|
|||||||
42
README.md
42
README.md
@@ -1,5 +1,15 @@
|
|||||||
# xair-cli
|
# xair-cli
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Table of Contents
|
||||||
|
|
||||||
|
- [Installation](#installation)
|
||||||
|
- [Configuration](#configuration)
|
||||||
|
- [Use](#use)
|
||||||
|
- [Shell Completion](#shell-completion)
|
||||||
|
- [License](#license)
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
*xair-cli*
|
*xair-cli*
|
||||||
@@ -60,8 +70,8 @@ export X32_CLI_LOGLEVEL=warn
|
|||||||
|
|
||||||
For each command/subcommand in the tree there exists a `--help` flag, use it to print usage information.
|
For each command/subcommand in the tree there exists a `--help` flag, use it to print usage information.
|
||||||
|
|
||||||
- [xair-cli](./xair-help.md)
|
- [xair-cli](./tools/xair-help.md)
|
||||||
- [x32-cli](./x32-help.md)
|
- [x32-cli](./tools/x32-help.md)
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
@@ -113,6 +123,34 @@ xair-cli snapshot 20 save 'twitch live'
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## Shell Completion
|
||||||
|
|
||||||
|
- completion:
|
||||||
|
|
||||||
|
*optional*
|
||||||
|
- args: Shell
|
||||||
|
- If no shell is passed completion will attempt to detect the current login shell.
|
||||||
|
|
||||||
|
*xair-cli*
|
||||||
|
|
||||||
|
```console
|
||||||
|
xair-cli completion
|
||||||
|
|
||||||
|
xair-cli completion bash
|
||||||
|
```
|
||||||
|
|
||||||
|
*x32-cli*
|
||||||
|
|
||||||
|
```console
|
||||||
|
x32-cli completion
|
||||||
|
|
||||||
|
x32-cli completion bash
|
||||||
|
```
|
||||||
|
|
||||||
|
Currently supported shells: *bash* *zsh* *fish*.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### License
|
### License
|
||||||
|
|
||||||
`xair-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
`xair-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
version: '3'
|
|
||||||
|
|
||||||
vars:
|
|
||||||
WINDOWS: '{{.BIN_DIR}}/{{.PROGRAM}}_windows_amd64.exe'
|
|
||||||
LINUX: '{{.BIN_DIR}}/{{.PROGRAM}}_linux_amd64'
|
|
||||||
MACOS: '{{.BIN_DIR}}/{{.PROGRAM}}_darwin_amd64'
|
|
||||||
|
|
||||||
tasks:
|
|
||||||
windows-amd64:
|
|
||||||
desc: Build the xair-cli project for Windows
|
|
||||||
cmds:
|
|
||||||
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
|
||||||
|
|
||||||
linux-amd64:
|
|
||||||
desc: Build the xair-cli project for Linux
|
|
||||||
cmds:
|
|
||||||
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
|
||||||
|
|
||||||
darwin-amd64:
|
|
||||||
desc: Build the xair-cli project for macOS
|
|
||||||
cmds:
|
|
||||||
- GOOS=darwin GOARCH=amd64 go build -o {{.MACOS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
|
||||||
@@ -7,16 +7,16 @@ vars:
|
|||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
windows-amd64:
|
windows-amd64:
|
||||||
desc: Build the x32-cli project for Windows
|
desc: Build the project for Windows
|
||||||
cmds:
|
cmds:
|
||||||
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
- GOOS=windows GOARCH=amd64 go build -o {{.WINDOWS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
||||||
|
|
||||||
linux-amd64:
|
linux-amd64:
|
||||||
desc: Build the x32-cli project for Linux
|
desc: Build the project for Linux
|
||||||
cmds:
|
cmds:
|
||||||
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
- GOOS=linux GOARCH=amd64 go build -o {{.LINUX}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
||||||
|
|
||||||
darwin-amd64:
|
darwin-amd64:
|
||||||
desc: Build the x32-cli project for macOS
|
desc: Build the project for macOS
|
||||||
cmds:
|
cmds:
|
||||||
- GOOS=darwin GOARCH=amd64 go build -o {{.MACOS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
- GOOS=darwin GOARCH=amd64 go build -o {{.MACOS}} -ldflags="-X main.version={{.VERSION}}" ./cmd/{{.PROGRAM}}
|
||||||
17
Taskfile.man.yml
Normal file
17
Taskfile.man.yml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
default:
|
||||||
|
desc: View man page
|
||||||
|
cmds:
|
||||||
|
- task: view
|
||||||
|
|
||||||
|
view:
|
||||||
|
desc: View man page
|
||||||
|
cmds:
|
||||||
|
- go run ./cmd/{{.PROGRAM}} --man | man -l -
|
||||||
|
|
||||||
|
generate:
|
||||||
|
desc: Generate man page
|
||||||
|
cmds:
|
||||||
|
- go run ./cmd/{{.PROGRAM}} --man > {{.PROGRAM}}.1
|
||||||
17
Taskfile.yml
17
Taskfile.yml
@@ -2,15 +2,23 @@ version: '3'
|
|||||||
|
|
||||||
includes:
|
includes:
|
||||||
build-xair:
|
build-xair:
|
||||||
taskfile: ./Taskfile.build-xair.yml
|
taskfile: ./Taskfile.build.yml
|
||||||
internal: true
|
internal: true
|
||||||
vars:
|
vars:
|
||||||
PROGRAM: xair-cli
|
PROGRAM: xair-cli
|
||||||
build-x32:
|
build-x32:
|
||||||
taskfile: ./Taskfile.build-x32.yml
|
taskfile: ./Taskfile.build.yml
|
||||||
internal: true
|
internal: true
|
||||||
vars:
|
vars:
|
||||||
PROGRAM: x32-cli
|
PROGRAM: x32-cli
|
||||||
|
man-xair:
|
||||||
|
taskfile: ./Taskfile.man.yml
|
||||||
|
vars:
|
||||||
|
PROGRAM: xair-cli
|
||||||
|
man-x32:
|
||||||
|
taskfile: ./Taskfile.man.yml
|
||||||
|
vars:
|
||||||
|
PROGRAM: x32-cli
|
||||||
|
|
||||||
vars:
|
vars:
|
||||||
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
|
SHELL: '{{if eq .OS "Windows_NT"}}powershell{{end}}'
|
||||||
@@ -54,3 +62,8 @@ tasks:
|
|||||||
desc: Clean the build artifacts
|
desc: Clean the build artifacts
|
||||||
cmds:
|
cmds:
|
||||||
- '{{.SHELL}} rm -r {{.BIN_DIR}}'
|
- '{{.SHELL}} rm -r {{.BIN_DIR}}'
|
||||||
|
|
||||||
|
generate:
|
||||||
|
desc: Run code generation
|
||||||
|
cmds:
|
||||||
|
- COLUMNS=120 go generate ./...
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ func (cmd *BusMuteCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.SetMute(bus.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Bus.SetMute(bus.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d mute state set to: %s\n", bus.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Bus %d mute state set to: %s\n", bus.Index.Index, *cmd.State)
|
||||||
@@ -101,7 +101,12 @@ func (cmd *BusFadeinCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d fade-in complete. Final level: %.2f dB\n", bus.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d fade-in complete. Final level: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +145,12 @@ func (cmd *BusFadeoutCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d fade-out complete. Final level: %.2f dB\n", bus.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d fade-out complete. Final level: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,7 +218,7 @@ func (cmd *BusEqOnCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetOn(bus.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Bus.Eq.SetOn(bus.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ on state set to: %s\n", bus.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Bus %d EQ on state set to: %s\n", bus.Index.Index, *cmd.State)
|
||||||
@@ -250,14 +260,26 @@ func (cmd *BusEqBandGainCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d gain: %.2f dB\n", bus.Index.Index, *busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d gain: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetGain(bus.Index.Index, *busEq.Band.Band, *cmd.Gain); err != nil {
|
if err := ctx.Client.Bus.Eq.SetGain(bus.Index.Index, *busEq.Band.Band, *cmd.Gain); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d gain set to: %.2f dB\n", bus.Index.Index, *busEq.Band.Band, *cmd.Gain)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d gain set to: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Gain,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,14 +295,30 @@ func (cmd *BusEqBandFreqCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d frequency: %.2f Hz\n", bus.Index.Index, *busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d frequency: %.2f Hz\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetFrequency(bus.Index.Index, *busEq.Band.Band, *cmd.Freq); err != nil {
|
if err := ctx.Client.Bus.Eq.SetFrequency(
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Freq,
|
||||||
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d frequency set to: %.2f Hz\n", bus.Index.Index, *busEq.Band.Band, *cmd.Freq)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d frequency set to: %.2f Hz\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Freq,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,14 +334,26 @@ func (cmd *BusEqBandQCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d Q factor: %.2f\n", bus.Index.Index, *busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d Q factor: %.2f\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetQ(bus.Index.Index, *busEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.Bus.Eq.SetQ(bus.Index.Index, *busEq.Band.Band, *cmd.Q); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d Q factor set to: %.2f\n", bus.Index.Index, *busEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d Q factor set to: %.2f\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Q,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,14 +369,26 @@ func (cmd *BusEqBandTypeCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d type: %s\n", bus.Index.Index, *busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d type: %s\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetType(bus.Index.Index, *busEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.Bus.Eq.SetType(bus.Index.Index, *busEq.Band.Band, *cmd.Type); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d type set to: %s\n", bus.Index.Index, *busEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d type set to: %s\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Type,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +421,7 @@ func (cmd *BusCompOnCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Comp.SetOn(bus.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Bus.Comp.SetOn(bus.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor on state set to: %s\n", bus.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Bus %d compressor on state set to: %s\n", bus.Index.Index, *cmd.State)
|
||||||
@@ -408,7 +470,12 @@ func (cmd *BusCompThresholdCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetThreshold(bus.Index.Index, *cmd.Threshold); err != nil {
|
if err := ctx.Client.Bus.Comp.SetThreshold(bus.Index.Index, *cmd.Threshold); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor threshold set to: %.2f dB\n", bus.Index.Index, *cmd.Threshold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor threshold set to: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Threshold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +544,12 @@ func (cmd *BusCompMakeupCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetMakeup(bus.Index.Index, *cmd.Makeup); err != nil {
|
if err := ctx.Client.Bus.Comp.SetMakeup(bus.Index.Index, *cmd.Makeup); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor makeup gain set to: %.2f dB\n", bus.Index.Index, *cmd.Makeup)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor makeup gain set to: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Makeup,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,7 +572,12 @@ func (cmd *BusCompAttackCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetAttack(bus.Index.Index, *cmd.Attack); err != nil {
|
if err := ctx.Client.Bus.Comp.SetAttack(bus.Index.Index, *cmd.Attack); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor attack time set to: %.2f ms\n", bus.Index.Index, *cmd.Attack)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor attack time set to: %.2f ms\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Attack,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,7 +600,12 @@ func (cmd *BusCompHoldCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetHold(bus.Index.Index, *cmd.Hold); err != nil {
|
if err := ctx.Client.Bus.Comp.SetHold(bus.Index.Index, *cmd.Hold); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor hold time set to: %.2f ms\n", bus.Index.Index, *cmd.Hold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor hold time set to: %.2f ms\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Hold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,6 +628,11 @@ func (cmd *BusCompReleaseCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetRelease(bus.Index.Index, *cmd.Release); err != nil {
|
if err := ctx.Client.Bus.Comp.SetRelease(bus.Index.Index, *cmd.Release); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor release time set to: %.2f ms\n", bus.Index.Index, *cmd.Release)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor release time set to: %.2f ms\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Release,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
"github.com/alecthomas/kong"
|
||||||
|
mangokong "github.com/alecthomas/mango-kong"
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
kongcompletion "github.com/jotaen/kong-completion"
|
kongcompletion "github.com/jotaen/kong-completion"
|
||||||
|
|
||||||
"github.com/onyx-and-iris/xair-cli/internal/xair"
|
"github.com/onyx-and-iris/xair-cli/internal/xair"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
trueStr = "true"
|
||||||
|
falseStr = "false"
|
||||||
|
)
|
||||||
|
|
||||||
var version string // Version of the CLI, set at build time.
|
var version string // Version of the CLI, set at build time.
|
||||||
|
|
||||||
// VersionFlag is a custom flag type that prints the version and exits.
|
// VersionFlag is a custom flag type that prints the version and exits.
|
||||||
@@ -33,10 +40,10 @@ type context struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Host string `default:"mixer.local" help:"The host of the X32 device." env:"X32_CLI_HOST" short:"H"`
|
Host string `flag:"" default:"mixer.local" help:"The host of the X32 device." env:"X32_CLI_HOST" short:"H"`
|
||||||
Port int `default:"10023" help:"The port of the X32 device." env:"X32_CLI_PORT" short:"P"`
|
Port int `flag:"" default:"10023" help:"The port of the X32 device." env:"X32_CLI_PORT" short:"P"`
|
||||||
Timeout time.Duration `default:"100ms" help:"Timeout for OSC operations." env:"X32_CLI_TIMEOUT" short:"T"`
|
Timeout time.Duration `flag:"" default:"100ms" help:"Timeout for OSC operations." env:"X32_CLI_TIMEOUT" short:"T"`
|
||||||
Loglevel string `default:"warn" help:"Log level for the CLI." env:"X32_CLI_LOGLEVEL" short:"L" enum:"debug,info,warn,error,fatal"`
|
Loglevel string `flag:"" default:"warn" help:"Log level for the CLI." env:"X32_CLI_LOGLEVEL" short:"L" enum:"debug,info,warn,error,fatal"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CLI is the main struct for the command-line interface.
|
// CLI is the main struct for the command-line interface.
|
||||||
@@ -44,19 +51,21 @@ type Config struct {
|
|||||||
type CLI struct {
|
type CLI struct {
|
||||||
Config `embed:"" prefix:"" help:"The configuration for the CLI."`
|
Config `embed:"" prefix:"" help:"The configuration for the CLI."`
|
||||||
|
|
||||||
Version VersionFlag `help:"Print x32-cli version information and quit" name:"version" short:"v"`
|
Man mangokong.ManFlag `help:"Print man page."`
|
||||||
|
Version VersionFlag `help:"Print x32-cli version information and quit" name:"version" short:"v"`
|
||||||
|
|
||||||
Completion kongcompletion.Completion `help:"Generate shell completion scripts." cmd:"" aliases:"c"`
|
Completion kongcompletion.Completion `cmd:"" help:"Generate shell completion scripts."`
|
||||||
|
Info InfoCmd `cmd:"" help:"Print mixer information."`
|
||||||
|
Raw RawCmd `cmd:"" help:"Send raw OSC messages to the mixer."`
|
||||||
|
|
||||||
Raw RawCmd `help:"Send raw OSC messages to the mixer." cmd:"" group:"Raw"`
|
Main MainCmdGroup `cmd:"" help:"Control the Main L/R output" group:"Main"`
|
||||||
Main MainCmdGroup `help:"Control the Main L/R output" cmd:"" group:"Main"`
|
Mainmono MainMonoCmdGroup `cmd:"" help:"Control the Main Mono output" group:"MainMono"`
|
||||||
Mainmono MainMonoCmdGroup `help:"Control the Main Mono output" cmd:"" group:"MainMono"`
|
Matrix MatrixCmdGroup `cmd:"" help:"Control the matrix outputs." group:"Matrix"`
|
||||||
Matrix MatrixCmdGroup `help:"Control the matrix outputs." cmd:"" group:"Matrix"`
|
Strip StripCmdGroup `cmd:"" help:"Control the strips." group:"Strip"`
|
||||||
Strip StripCmdGroup `help:"Control the strips." cmd:"" group:"Strip"`
|
Bus BusCmdGroup `cmd:"" help:"Control the buses." group:"Bus"`
|
||||||
Bus BusCmdGroup `help:"Control the buses." cmd:"" group:"Bus"`
|
Headamp HeadampCmdGroup `cmd:"" help:"Control input gain and phantom power." group:"Headamp"`
|
||||||
Headamp HeadampCmdGroup `help:"Control input gain and phantom power." cmd:"" group:"Headamp"`
|
Snapshot SnapshotCmdGroup `cmd:"" help:"Save and load mixer states." group:"Snapshot"`
|
||||||
Snapshot SnapshotCmdGroup `help:"Save and load mixer states." cmd:"" group:"Snapshot"`
|
Dca DCACmdGroup `cmd:"" help:"Control DCA groups." group:"DCA"`
|
||||||
Dca DCACmdGroup `help:"Control DCA groups." cmd:"" group:"DCA"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -72,14 +81,15 @@ func main() {
|
|||||||
}),
|
}),
|
||||||
kong.Vars{
|
kong.Vars{
|
||||||
"version": func() string {
|
"version": func() string {
|
||||||
if version == "" {
|
if version != "" {
|
||||||
info, ok := debug.ReadBuildInfo()
|
return version
|
||||||
if !ok {
|
|
||||||
return "(unable to read build info)"
|
|
||||||
}
|
|
||||||
version = strings.Split(info.Main.Version, "-")[0]
|
|
||||||
}
|
}
|
||||||
return version
|
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return "(unable to read version)"
|
||||||
|
}
|
||||||
|
return strings.Split(info.Main.Version, "-")[0]
|
||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -100,7 +110,11 @@ func run(ctx *kong.Context, config Config) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to connect to X32 device: %w", err)
|
return fmt.Errorf("failed to connect to X32 device: %w", err)
|
||||||
}
|
}
|
||||||
defer client.Close()
|
defer func() {
|
||||||
|
if err := client.Close(); err != nil {
|
||||||
|
log.Errorf("failed to close client connection: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
client.StartListening()
|
client.StartListening()
|
||||||
resp, err := client.RequestInfo()
|
resp, err := client.RequestInfo()
|
||||||
@@ -125,7 +139,7 @@ func connect(config Config) (*xair.X32Client, error) {
|
|||||||
xair.WithTimeout(config.Timeout),
|
xair.WithTimeout(config.Timeout),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("failed to create X32 client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ import (
|
|||||||
type DCACmdGroup struct {
|
type DCACmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the DCA group (1-8)."`
|
Index int `arg:"" help:"The index of the DCA group (1-8)."`
|
||||||
Mute DCAMuteCmd `help:"Get or set the mute status of the DCA group." cmd:""`
|
Mute DCAMuteCmd `cmd:"" help:"Get or set the mute status of the DCA group."`
|
||||||
Name DCANameCmd `help:"Get or set the name of the DCA group." cmd:""`
|
Name DCANameCmd `cmd:"" help:"Get or set the name of the DCA group."`
|
||||||
} `arg:"" help:"Control a specific DCA group by its index."`
|
} `arg:"" help:"Control a specific DCA group by its index."`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ func (cmd *DCAMuteCmd) Run(ctx *context, dca *DCACmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.DCA.SetMute(dca.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.DCA.SetMute(dca.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set DCA mute status: %w", err)
|
return fmt.Errorf("failed to set DCA mute status: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -11,8 +11,8 @@ import (
|
|||||||
type HeadampCmdGroup struct {
|
type HeadampCmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the headamp."`
|
Index int `arg:"" help:"The index of the headamp."`
|
||||||
Gain HeadampGainCmd `help:"Get or set the gain of the headamp." cmd:""`
|
Gain HeadampGainCmd `cmd:"" help:"Get or set the gain of the headamp."`
|
||||||
Phantom HeadampPhantomCmd `help:"Get or set the phantom power state of the headamp." cmd:""`
|
Phantom HeadampPhantomCmd `cmd:"" help:"Get or set the phantom power state of the headamp."`
|
||||||
} `arg:"" help:"Control a specific headamp by index."`
|
} `arg:"" help:"Control a specific headamp by index."`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,14 +38,20 @@ func (cmd *HeadampGainCmd) Run(ctx *context, headamp *HeadampCmdGroup) error {
|
|||||||
return fmt.Errorf("failed to get current headamp gain: %w", err)
|
return fmt.Errorf("failed to get current headamp gain: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := gradualGainAdjust(ctx, headamp.Index.Index, currentGain, *cmd.Gain, cmd.Duration); err != nil {
|
if err := gradualGainAdjust(
|
||||||
|
ctx,
|
||||||
|
headamp.Index.Index,
|
||||||
|
currentGain,
|
||||||
|
*cmd.Gain,
|
||||||
|
cmd.Duration,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set headamp gain: %w", err)
|
return fmt.Errorf("failed to set headamp gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Headamp %d gain set to: %.2f dB\n", headamp.Index.Index, *cmd.Gain)
|
fmt.Fprintf(ctx.Out, "Headamp %d gain set to: %.2f dB\n", headamp.Index.Index, *cmd.Gain)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// gradualGainAdjust gradually adjusts gain from current to target over specified duration
|
// gradualGainAdjust gradually adjusts gain from current to target over specified duration.
|
||||||
func gradualGainAdjust(
|
func gradualGainAdjust(
|
||||||
ctx *context,
|
ctx *context,
|
||||||
index int,
|
index int,
|
||||||
@@ -93,17 +99,17 @@ func gradualGainAdjust(
|
|||||||
|
|
||||||
// HeadampPhantomCmd defines the command for getting or setting the phantom power state of a headamp, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// HeadampPhantomCmd defines the command for getting or setting the phantom power state of a headamp, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
type HeadampPhantomCmd struct {
|
type HeadampPhantomCmd struct {
|
||||||
State *string `help:"The phantom power state of the headamp." arg:"" enum:"true,on,false,off" optional:""`
|
State *string `arg:"" help:"The phantom power state of the headamp." enum:"true,on,false,off" optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided phantom power state is valid and normalizes it to "true" or "false".
|
// Validate checks if the provided phantom power state is valid and normalises it to "true" or "false".
|
||||||
func (cmd *HeadampPhantomCmd) Validate() error {
|
func (cmd *HeadampPhantomCmd) Validate() error {
|
||||||
if cmd.State != nil {
|
if cmd.State != nil {
|
||||||
switch *cmd.State {
|
switch *cmd.State {
|
||||||
case "true", "on":
|
case trueStr, "on":
|
||||||
*cmd.State = "true"
|
*cmd.State = trueStr
|
||||||
case "false", "off":
|
case falseStr, "off":
|
||||||
*cmd.State = "false"
|
*cmd.State = falseStr
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid phantom power state: %s", *cmd.State)
|
return fmt.Errorf("invalid phantom power state: %s", *cmd.State)
|
||||||
}
|
}
|
||||||
@@ -122,7 +128,10 @@ func (cmd *HeadampPhantomCmd) Run(ctx *context, headamp *HeadampCmdGroup) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.HeadAmp.SetPhantomPower(headamp.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.HeadAmp.SetPhantomPower(
|
||||||
|
headamp.Index.Index,
|
||||||
|
*cmd.State == trueStr,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set headamp phantom power state: %w", err)
|
return fmt.Errorf("failed to set headamp phantom power state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Headamp %d phantom power set to: %s\n", headamp.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Headamp %d phantom power set to: %s\n", headamp.Index.Index, *cmd.State)
|
||||||
|
|||||||
17
cmd/x32-cli/info.go
Normal file
17
cmd/x32-cli/info.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type InfoCmd struct{}
|
||||||
|
|
||||||
|
func (cmd *InfoCmd) Run(ctx *context) error { // nolint: unparam
|
||||||
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Host: %s | Name: %s | Model: %s | Firmware: %s\n",
|
||||||
|
ctx.Client.Info.Host,
|
||||||
|
ctx.Client.Info.Name,
|
||||||
|
ctx.Client.Info.Model,
|
||||||
|
ctx.Client.Info.Firmware,
|
||||||
|
)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package main implements the command-line interface for controlling an X32 digital mixer.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -7,14 +8,14 @@ import (
|
|||||||
|
|
||||||
// MainCmdGroup defines the command group for controlling the Main L/R output, including commands for mute state, fader level, and fade-in/fade-out times.
|
// MainCmdGroup defines the command group for controlling the Main L/R output, including commands for mute state, fader level, and fade-in/fade-out times.
|
||||||
type MainCmdGroup struct {
|
type MainCmdGroup struct {
|
||||||
Mute MainMuteCmd `help:"Get or set the mute state of the Main L/R output." cmd:""`
|
Mute MainMuteCmd `cmd:"" help:"Get or set the mute state of the Main L/R output."`
|
||||||
|
|
||||||
Fader MainFaderCmd `help:"Get or set the fader level of the Main L/R output." cmd:""`
|
Fader MainFaderCmd `cmd:"" help:"Get or set the fader level of the Main L/R output."`
|
||||||
Fadein MainFadeinCmd `help:"Fade in the Main L/R output over a specified duration." cmd:""`
|
Fadein MainFadeinCmd `cmd:"" help:"Fade in the Main L/R output over a specified duration."`
|
||||||
Fadeout MainFadeoutCmd `help:"Fade out the Main L/R output over a specified duration." cmd:""`
|
Fadeout MainFadeoutCmd `cmd:"" help:"Fade out the Main L/R output over a specified duration."`
|
||||||
|
|
||||||
Eq MainEqCmdGroup `help:"Commands for controlling the equalizer settings of the Main L/R output." cmd:"eq"`
|
Eq MainEqCmdGroup `cmd:"" help:"Commands for controlling the equaliser settings of the Main L/R output."`
|
||||||
Comp MainCompCmdGroup `help:"Commands for controlling the compressor settings of the Main L/R output." cmd:"comp"`
|
Comp MainCompCmdGroup `cmd:"" help:"Commands for controlling the compressor settings of the Main L/R output."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainMuteCmd defines the command for getting or setting the mute state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// MainMuteCmd defines the command for getting or setting the mute state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
@@ -33,7 +34,7 @@ func (cmd *MainMuteCmd) Run(ctx *context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.SetMute(*cmd.Mute == "true"); err != nil {
|
if err := ctx.Client.Main.SetMute(*cmd.Mute == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R mute state: %w", err)
|
return fmt.Errorf("failed to set Main L/R mute state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R mute state set to: %s\n", *cmd.Mute)
|
fmt.Fprintf(ctx.Out, "Main L/R mute state set to: %s\n", *cmd.Mute)
|
||||||
@@ -131,16 +132,16 @@ func (cmd *MainFadeoutCmd) Run(ctx *context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainEqCmdGroup defines the command group for controlling the equalizer settings of the Main L/R output, including commands for getting or setting the EQ parameters.
|
// MainEqCmdGroup defines the command group for controlling the equaliser settings of the Main L/R output, including commands for getting or setting the EQ parameters.
|
||||||
type MainEqCmdGroup struct {
|
type MainEqCmdGroup struct {
|
||||||
On MainEqOnCmd `help:"Get or set the EQ on/off state of the Main L/R output." cmd:"on"`
|
On MainEqOnCmd `cmd:"" help:"Get or set the EQ on/off state of the Main L/R output."`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band *int `arg:"" help:"The EQ band number." optional:""`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain MainEqBandGainCmd `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
Gain MainEqBandGainCmd `cmd:"" help:"Get or set the gain of the specified EQ band." `
|
||||||
Freq MainEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MainEqBandFreqCmd `cmd:"" help:"Get or set the frequency of the specified EQ band."`
|
||||||
Q MainEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MainEqBandQCmd `cmd:"" help:"Get or set the Q factor of the specified EQ band."`
|
||||||
Type MainEqBandTypeCmd `help:"Get or set the type of the specified EQ band." cmd:"type"`
|
Type MainEqBandTypeCmd `cmd:"" help:"Get or set the type of the specified EQ band."`
|
||||||
} `help:"Commands for controlling individual EQ bands of the Main L/R output." arg:""`
|
} ` help:"Commands for controlling individual EQ bands of the Main L/R output." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Main L/R output.
|
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Main L/R output.
|
||||||
@@ -161,7 +162,7 @@ type MainEqOnCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqOnCmd command, either retrieving the current EQ on/off state of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqOnCmd command, either retrieving the current EQ on/off state of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainEqOnCmd) Run(ctx *context) error {
|
||||||
if cmd.Enable == nil {
|
if cmd.Enable == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.On(0)
|
resp, err := ctx.Client.Main.Eq.On(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -171,10 +172,10 @@ func (cmd *MainEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Eq.SetOn(0, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Main.Eq.SetOn(0, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ on/off state: %w", err)
|
return fmt.Errorf("failed to set Main L/R EQ on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Main L/R EQ on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ type MainEqBandGainCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandGainCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Level == nil {
|
if cmd.Level == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Gain(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Gain(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -197,7 +198,12 @@ func (cmd *MainEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *Main
|
|||||||
if err := ctx.Client.Main.Eq.SetGain(0, *mainEq.Band.Band, *cmd.Level); err != nil {
|
if err := ctx.Client.Main.Eq.SetGain(0, *mainEq.Band.Band, *cmd.Level); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d gain: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main L/R EQ band %d gain: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d gain set to: %.2f dB\n", *mainEq.Band.Band, *cmd.Level)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Main L/R EQ band %d gain set to: %.2f dB\n",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
*cmd.Level,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,11 +213,15 @@ type MainEqBandFreqCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandFreqCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandFreqCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Frequency == nil {
|
if cmd.Frequency == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Frequency(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Frequency(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Main L/R EQ band %d frequency: %w",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d frequency: %.2f Hz\n", *mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d frequency: %.2f Hz\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
@@ -220,7 +230,12 @@ func (cmd *MainEqBandFreqCmd) Run(ctx *context, main *MainCmdGroup, mainEq *Main
|
|||||||
if err := ctx.Client.Main.Eq.SetFrequency(0, *mainEq.Band.Band, *cmd.Frequency); err != nil {
|
if err := ctx.Client.Main.Eq.SetFrequency(0, *mainEq.Band.Band, *cmd.Frequency); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main L/R EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d frequency set to: %.2f Hz\n", *mainEq.Band.Band, *cmd.Frequency)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Main L/R EQ band %d frequency set to: %.2f Hz\n",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
*cmd.Frequency,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,11 +245,15 @@ type MainEqBandQCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandQCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandQCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Q(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Q(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d Q factor: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Main L/R EQ band %d Q factor: %w",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d Q factor: %.2f\n", *mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d Q factor: %.2f\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
@@ -253,7 +272,7 @@ type MainEqBandTypeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandTypeCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Type(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Type(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -272,15 +291,15 @@ func (cmd *MainEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *Main
|
|||||||
|
|
||||||
// MainCompCmdGroup defines the command group for controlling the compressor settings of the Main L/R output, including commands for getting or setting the compressor parameters.
|
// MainCompCmdGroup defines the command group for controlling the compressor settings of the Main L/R output, including commands for getting or setting the compressor parameters.
|
||||||
type MainCompCmdGroup struct {
|
type MainCompCmdGroup struct {
|
||||||
On MainCompOnCmd `help:"Get or set the compressor on/off state of the Main L/R output." cmd:"on"`
|
On MainCompOnCmd `cmd:"" help:"Get or set the compressor on/off state of the Main L/R output."`
|
||||||
Mode MainCompModeCmd `help:"Get or set the compressor mode of the Main L/R output." cmd:"mode"`
|
Mode MainCompModeCmd `cmd:"" help:"Get or set the compressor mode of the Main L/R output."`
|
||||||
Threshold MainCompThresholdCmd `help:"Get or set the compressor threshold of the Main L/R output." cmd:"threshold"`
|
Threshold MainCompThresholdCmd `cmd:"" help:"Get or set the compressor threshold of the Main L/R output."`
|
||||||
Ratio MainCompRatioCmd `help:"Get or set the compressor ratio of the Main L/R output." cmd:"ratio"`
|
Ratio MainCompRatioCmd `cmd:"" help:"Get or set the compressor ratio of the Main L/R output."`
|
||||||
Mix MainCompMixCmd `help:"Get or set the compressor mix level of the Main L/R output." cmd:"mix"`
|
Mix MainCompMixCmd `cmd:"" help:"Get or set the compressor mix level of the Main L/R output."`
|
||||||
Makeup MainCompMakeupCmd `help:"Get or set the compressor makeup gain of the Main L/R output." cmd:"makeup"`
|
Makeup MainCompMakeupCmd `cmd:"" help:"Get or set the compressor makeup gain of the Main L/R output."`
|
||||||
Attack MainCompAttackCmd `help:"Get or set the compressor attack time of the Main L/R output." cmd:"attack"`
|
Attack MainCompAttackCmd `cmd:"" help:"Get or set the compressor attack time of the Main L/R output."`
|
||||||
Hold MainCompHoldCmd `help:"Get or set the compressor hold time of the Main L/R output." cmd:"hold"`
|
Hold MainCompHoldCmd `cmd:"" help:"Get or set the compressor hold time of the Main L/R output."`
|
||||||
Release MainCompReleaseCmd `help:"Get or set the compressor release time of the Main L/R output." cmd:"release"`
|
Release MainCompReleaseCmd `cmd:"" help:"Get or set the compressor release time of the Main L/R output."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainCompOnCmd defines the command for getting or setting the compressor on/off state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// MainCompOnCmd defines the command for getting or setting the compressor on/off state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
@@ -289,7 +308,7 @@ type MainCompOnCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompOnCmd command, either retrieving the current compressor on/off state of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompOnCmd command, either retrieving the current compressor on/off state of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompOnCmd) Run(ctx *context) error {
|
||||||
if cmd.Enable == nil {
|
if cmd.Enable == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.On(0)
|
resp, err := ctx.Client.Main.Comp.On(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -299,10 +318,10 @@ func (cmd *MainCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Comp.SetOn(0, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Main.Comp.SetOn(0, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R compressor on/off state: %w", err)
|
return fmt.Errorf("failed to set Main L/R compressor on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R compressor on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Main L/R compressor on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +331,7 @@ type MainCompModeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompModeCmd command, either retrieving the current compressor mode of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompModeCmd command, either retrieving the current compressor mode of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompModeCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompModeCmd) Run(ctx *context) error {
|
||||||
if cmd.Mode == nil {
|
if cmd.Mode == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Mode(0)
|
resp, err := ctx.Client.Main.Comp.Mode(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -335,7 +354,7 @@ type MainCompThresholdCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompThresholdCmd command, either retrieving the current compressor threshold of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompThresholdCmd command, either retrieving the current compressor threshold of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompThresholdCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompThresholdCmd) Run(ctx *context) error {
|
||||||
if cmd.Threshold == nil {
|
if cmd.Threshold == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Threshold(0)
|
resp, err := ctx.Client.Main.Comp.Threshold(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -358,7 +377,7 @@ type MainCompRatioCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompRatioCmd command, either retrieving the current compressor ratio of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompRatioCmd command, either retrieving the current compressor ratio of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompRatioCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompRatioCmd) Run(ctx *context) error {
|
||||||
if cmd.Ratio == nil {
|
if cmd.Ratio == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Ratio(0)
|
resp, err := ctx.Client.Main.Comp.Ratio(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -381,7 +400,7 @@ type MainCompMixCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompMixCmd command, either retrieving the current compressor mix level of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompMixCmd command, either retrieving the current compressor mix level of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompMixCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompMixCmd) Run(ctx *context) error {
|
||||||
if cmd.Mix == nil {
|
if cmd.Mix == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Mix(0)
|
resp, err := ctx.Client.Main.Comp.Mix(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -404,7 +423,7 @@ type MainCompMakeupCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompMakeupCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompMakeupCmd) Run(ctx *context) error {
|
||||||
if cmd.Makeup == nil {
|
if cmd.Makeup == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Makeup(0)
|
resp, err := ctx.Client.Main.Comp.Makeup(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -427,7 +446,7 @@ type MainCompAttackCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompAttackCmd command, either retrieving the current compressor attack time of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompAttackCmd command, either retrieving the current compressor attack time of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompAttackCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompAttackCmd) Run(ctx *context) error {
|
||||||
if cmd.Attack == nil {
|
if cmd.Attack == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Attack(0)
|
resp, err := ctx.Client.Main.Comp.Attack(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -450,7 +469,7 @@ type MainCompHoldCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompHoldCmd command, either retrieving the current compressor hold time of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompHoldCmd command, either retrieving the current compressor hold time of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompHoldCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompHoldCmd) Run(ctx *context) error {
|
||||||
if cmd.Hold == nil {
|
if cmd.Hold == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Hold(0)
|
resp, err := ctx.Client.Main.Comp.Hold(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -473,7 +492,7 @@ type MainCompReleaseCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompReleaseCmd command, either retrieving the current compressor release time of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompReleaseCmd command, either retrieving the current compressor release time of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompReleaseCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompReleaseCmd) Run(ctx *context) error {
|
||||||
if cmd.Release == nil {
|
if cmd.Release == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Release(0)
|
resp, err := ctx.Client.Main.Comp.Release(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -7,14 +7,14 @@ import (
|
|||||||
|
|
||||||
// MainMonoCmdGroup defines the command group for controlling the Main Mono output, including commands for mute state, fader level, and fade-in/fade-out times.
|
// MainMonoCmdGroup defines the command group for controlling the Main Mono output, including commands for mute state, fader level, and fade-in/fade-out times.
|
||||||
type MainMonoCmdGroup struct {
|
type MainMonoCmdGroup struct {
|
||||||
Mute MainMonoMuteCmd `help:"Get or set the mute state of the Main Mono output." cmd:""`
|
Mute MainMonoMuteCmd `cmd:"" help:"Get or set the mute state of the Main Mono output."`
|
||||||
|
|
||||||
Fader MainMonoFaderCmd `help:"Get or set the fader level of the Main Mono output." cmd:""`
|
Fader MainMonoFaderCmd `cmd:"" help:"Get or set the fader level of the Main Mono output."`
|
||||||
Fadein MainMonoFadeinCmd `help:"Fade in the Main Mono output over a specified duration." cmd:""`
|
Fadein MainMonoFadeinCmd `cmd:"" help:"Fade in the Main Mono output over a specified duration."`
|
||||||
Fadeout MainMonoFadeoutCmd `help:"Fade out the Main Mono output over a specified duration." cmd:""`
|
Fadeout MainMonoFadeoutCmd `cmd:"" help:"Fade out the Main Mono output over a specified duration."`
|
||||||
|
|
||||||
Eq MainMonoEqCmdGroup `help:"Commands for controlling the equalizer settings of the Main Mono output." cmd:"eq"`
|
Eq MainMonoEqCmdGroup `cmd:"" help:"Commands for controlling the equaliser settings of the Main Mono output."`
|
||||||
Comp MainMonoCompCmdGroup `help:"Commands for controlling the compressor settings of the Main Mono output." cmd:"comp"`
|
Comp MainMonoCompCmdGroup `cmd:"" help:"Commands for controlling the compressor settings of the Main Mono output."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainMonoMuteCmd defines the command for getting or setting the mute state of the Main Mono output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// MainMonoMuteCmd defines the command for getting or setting the mute state of the Main Mono output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
@@ -33,7 +33,7 @@ func (cmd *MainMonoMuteCmd) Run(ctx *context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.MainMono.SetMute(*cmd.Mute == "true"); err != nil {
|
if err := ctx.Client.MainMono.SetMute(*cmd.Mute == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main Mono mute state: %w", err)
|
return fmt.Errorf("failed to set Main Mono mute state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono mute state set to: %s\n", *cmd.Mute)
|
fmt.Fprintf(ctx.Out, "Main Mono mute state set to: %s\n", *cmd.Mute)
|
||||||
@@ -131,15 +131,15 @@ func (cmd *MainMonoFadeoutCmd) Run(ctx *context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainMonoEqCmdGroup defines the command group for controlling the equalizer settings of the Main Mono output, including commands for getting or setting the EQ parameters.
|
// MainMonoEqCmdGroup defines the command group for controlling the equaliser settings of the Main Mono output, including commands for getting or setting the EQ parameters.
|
||||||
type MainMonoEqCmdGroup struct {
|
type MainMonoEqCmdGroup struct {
|
||||||
On MainMonoEqOnCmd `help:"Get or set the EQ on/off state of the Main Mono output." cmd:"on"`
|
On MainMonoEqOnCmd `help:"Get or set the EQ on/off state of the Main Mono output." cmd:"on"`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band *int `arg:"" help:"The EQ band number." optional:""`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain MainMonoEqBandGainCmd `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
Gain MainMonoEqBandGainCmd `cmd:"" help:"Get or set the gain of the specified EQ band."`
|
||||||
Freq MainMonoEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MainMonoEqBandFreqCmd `cmd:"" help:"Get or set the frequency of the specified EQ band."`
|
||||||
Q MainMonoEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MainMonoEqBandQCmd `cmd:"" help:"Get or set the Q factor of the specified EQ band."`
|
||||||
Type MainMonoEqBandTypeCmd `help:"Get or set the type of the specified EQ band." cmd:"type"`
|
Type MainMonoEqBandTypeCmd `cmd:"" help:"Get or set the type of the specified EQ band."`
|
||||||
} `help:"Commands for controlling individual EQ bands of the Main Mono output." arg:""`
|
} `help:"Commands for controlling individual EQ bands of the Main Mono output." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ type MainMonoEqOnCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoEqOnCmd command, either retrieving the current EQ on/off state of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoEqOnCmd command, either retrieving the current EQ on/off state of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoEqOnCmd) Run(ctx *context) error {
|
||||||
if cmd.Enable == nil {
|
if cmd.Enable == nil {
|
||||||
resp, err := ctx.Client.MainMono.Eq.On(0)
|
resp, err := ctx.Client.MainMono.Eq.On(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -171,10 +171,10 @@ func (cmd *MainMonoEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.MainMono.Eq.SetOn(0, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.MainMono.Eq.SetOn(0, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main Mono EQ on/off state: %w", err)
|
return fmt.Errorf("failed to set Main Mono EQ on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Main Mono EQ on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +184,10 @@ type MainMonoEqBandGainCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainMonoEqCmdGroup) error {
|
func (cmd *MainMonoEqBandGainCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
mainEq *MainMonoEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Level == nil {
|
if cmd.Level == nil {
|
||||||
resp, err := ctx.Client.MainMono.Eq.Gain(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.MainMono.Eq.Gain(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -197,7 +200,12 @@ func (cmd *MainMonoEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *
|
|||||||
if err := ctx.Client.MainMono.Eq.SetGain(0, *mainEq.Band.Band, *cmd.Level); err != nil {
|
if err := ctx.Client.MainMono.Eq.SetGain(0, *mainEq.Band.Band, *cmd.Level); err != nil {
|
||||||
return fmt.Errorf("failed to set Main Mono EQ band %d gain: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main Mono EQ band %d gain: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d gain set to: %.2f dB\n", *mainEq.Band.Band, *cmd.Level)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Main Mono EQ band %d gain set to: %.2f dB\n",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
*cmd.Level,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,20 +215,40 @@ type MainMonoEqBandFreqCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoEqBandFreqCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainMonoEqCmdGroup) error {
|
func (cmd *MainMonoEqBandFreqCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
mainEq *MainMonoEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Frequency == nil {
|
if cmd.Frequency == nil {
|
||||||
resp, err := ctx.Client.MainMono.Eq.Frequency(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.MainMono.Eq.Frequency(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Main Mono EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Main Mono EQ band %d frequency: %w",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d frequency: %.2f Hz\n", *mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d frequency: %.2f Hz\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.MainMono.Eq.SetFrequency(0, *mainEq.Band.Band, *cmd.Frequency); err != nil {
|
if err := ctx.Client.MainMono.Eq.SetFrequency(
|
||||||
return fmt.Errorf("failed to set Main Mono EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
0,
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
*cmd.Frequency,
|
||||||
|
); err != nil {
|
||||||
|
return fmt.Errorf(
|
||||||
|
"failed to set Main Mono EQ band %d frequency: %w",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d frequency set to: %.2f Hz\n", *mainEq.Band.Band, *cmd.Frequency)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Main Mono EQ band %d frequency set to: %.2f Hz\n",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
*cmd.Frequency,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,11 +258,18 @@ type MainMonoEqBandQCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoEqBandQCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainMonoEqCmdGroup) error {
|
func (cmd *MainMonoEqBandQCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
mainEq *MainMonoEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.MainMono.Eq.Q(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.MainMono.Eq.Q(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Main Mono EQ band %d Q factor: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Main Mono EQ band %d Q factor: %w",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d Q factor: %.2f\n", *mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d Q factor: %.2f\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
@@ -253,7 +288,10 @@ type MainMonoEqBandTypeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainMonoEqCmdGroup) error {
|
func (cmd *MainMonoEqBandTypeCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
mainEq *MainMonoEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.MainMono.Eq.Type(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.MainMono.Eq.Type(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -272,15 +310,15 @@ func (cmd *MainMonoEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *
|
|||||||
|
|
||||||
// MainMonoCompCmdGroup defines the command group for controlling the compressor settings of the Main Mono output, including commands for getting or setting the compressor parameters.
|
// MainMonoCompCmdGroup defines the command group for controlling the compressor settings of the Main Mono output, including commands for getting or setting the compressor parameters.
|
||||||
type MainMonoCompCmdGroup struct {
|
type MainMonoCompCmdGroup struct {
|
||||||
On MainMonoCompOnCmd `help:"Get or set the compressor on/off state of the Main Mono output." cmd:"on"`
|
On MainMonoCompOnCmd `cmd:"" help:"Get or set the compressor on/off state of the Main Mono output."`
|
||||||
Mode MainMonoCompModeCmd `help:"Get or set the compressor mode of the Main Mono output." cmd:"mode"`
|
Mode MainMonoCompModeCmd `cmd:"" help:"Get or set the compressor mode of the Main Mono output."`
|
||||||
Threshold MainMonoCompThresholdCmd `help:"Get or set the compressor threshold of the Main Mono output." cmd:"threshold"`
|
Threshold MainMonoCompThresholdCmd `cmd:"" help:"Get or set the compressor threshold of the Main Mono output."`
|
||||||
Ratio MainMonoCompRatioCmd `help:"Get or set the compressor ratio of the Main Mono output." cmd:"ratio"`
|
Ratio MainMonoCompRatioCmd `cmd:"" help:"Get or set the compressor ratio of the Main Mono output."`
|
||||||
Mix MainMonoCompMixCmd `help:"Get or set the compressor mix level of the Main Mono output." cmd:"mix"`
|
Mix MainMonoCompMixCmd `cmd:"" help:"Get or set the compressor mix level of the Main Mono output."`
|
||||||
Makeup MainMonoCompMakeupCmd `help:"Get or set the compressor makeup gain of the Main Mono output." cmd:"makeup"`
|
Makeup MainMonoCompMakeupCmd `cmd:"" help:"Get or set the compressor makeup gain of the Main Mono output."`
|
||||||
Attack MainMonoCompAttackCmd `help:"Get or set the compressor attack time of the Main Mono output." cmd:"attack"`
|
Attack MainMonoCompAttackCmd `cmd:"" help:"Get or set the compressor attack time of the Main Mono output."`
|
||||||
Hold MainMonoCompHoldCmd `help:"Get or set the compressor hold time of the Main Mono output." cmd:"hold"`
|
Hold MainMonoCompHoldCmd `cmd:"" help:"Get or set the compressor hold time of the Main Mono output."`
|
||||||
Release MainMonoCompReleaseCmd `help:"Get or set the compressor release time of the Main Mono output." cmd:"release"`
|
Release MainMonoCompReleaseCmd `cmd:"" help:"Get or set the compressor release time of the Main Mono output."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainMonoCompOnCmd defines the command for getting or setting the compressor on/off state of the Main Mono output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// MainMonoCompOnCmd defines the command for getting or setting the compressor on/off state of the Main Mono output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
@@ -289,7 +327,7 @@ type MainMonoCompOnCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompOnCmd command, either retrieving the current compressor on/off state of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompOnCmd command, either retrieving the current compressor on/off state of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompOnCmd) Run(ctx *context) error {
|
||||||
if cmd.Enable == nil {
|
if cmd.Enable == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.On(0)
|
resp, err := ctx.Client.MainMono.Comp.On(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -299,10 +337,10 @@ func (cmd *MainMonoCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.MainMono.Comp.SetOn(0, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.MainMono.Comp.SetOn(0, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main Mono compressor on/off state: %w", err)
|
return fmt.Errorf("failed to set Main Mono compressor on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono compressor on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Main Mono compressor on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +350,7 @@ type MainMonoCompModeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompModeCmd command, either retrieving the current compressor mode of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompModeCmd command, either retrieving the current compressor mode of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompModeCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompModeCmd) Run(ctx *context) error {
|
||||||
if cmd.Mode == nil {
|
if cmd.Mode == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Mode(0)
|
resp, err := ctx.Client.MainMono.Comp.Mode(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -335,7 +373,7 @@ type MainMonoCompThresholdCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompThresholdCmd command, either retrieving the current compressor threshold of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompThresholdCmd command, either retrieving the current compressor threshold of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompThresholdCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompThresholdCmd) Run(ctx *context) error {
|
||||||
if cmd.Threshold == nil {
|
if cmd.Threshold == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Threshold(0)
|
resp, err := ctx.Client.MainMono.Comp.Threshold(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -358,7 +396,7 @@ type MainMonoCompRatioCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompRatioCmd command, either retrieving the current compressor ratio of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompRatioCmd command, either retrieving the current compressor ratio of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompRatioCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompRatioCmd) Run(ctx *context) error {
|
||||||
if cmd.Ratio == nil {
|
if cmd.Ratio == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Ratio(0)
|
resp, err := ctx.Client.MainMono.Comp.Ratio(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -381,7 +419,7 @@ type MainMonoCompMixCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompMixCmd command, either retrieving the current compressor mix level of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompMixCmd command, either retrieving the current compressor mix level of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompMixCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompMixCmd) Run(ctx *context) error {
|
||||||
if cmd.Mix == nil {
|
if cmd.Mix == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Mix(0)
|
resp, err := ctx.Client.MainMono.Comp.Mix(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -404,7 +442,7 @@ type MainMonoCompMakeupCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompMakeupCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompMakeupCmd) Run(ctx *context) error {
|
||||||
if cmd.Makeup == nil {
|
if cmd.Makeup == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Makeup(0)
|
resp, err := ctx.Client.MainMono.Comp.Makeup(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -427,7 +465,7 @@ type MainMonoCompAttackCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompAttackCmd command, either retrieving the current compressor attack time of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompAttackCmd command, either retrieving the current compressor attack time of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompAttackCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompAttackCmd) Run(ctx *context) error {
|
||||||
if cmd.Attack == nil {
|
if cmd.Attack == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Attack(0)
|
resp, err := ctx.Client.MainMono.Comp.Attack(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -450,7 +488,7 @@ type MainMonoCompHoldCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompHoldCmd command, either retrieving the current compressor hold time of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompHoldCmd command, either retrieving the current compressor hold time of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompHoldCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompHoldCmd) Run(ctx *context) error {
|
||||||
if cmd.Hold == nil {
|
if cmd.Hold == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Hold(0)
|
resp, err := ctx.Client.MainMono.Comp.Hold(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -473,7 +511,7 @@ type MainMonoCompReleaseCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainMonoCompReleaseCmd command, either retrieving the current compressor release time of the Main Mono output or setting it based on the provided argument.
|
// Run executes the MainMonoCompReleaseCmd command, either retrieving the current compressor release time of the Main Mono output or setting it based on the provided argument.
|
||||||
func (cmd *MainMonoCompReleaseCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainMonoCompReleaseCmd) Run(ctx *context) error {
|
||||||
if cmd.Release == nil {
|
if cmd.Release == nil {
|
||||||
resp, err := ctx.Client.MainMono.Comp.Release(0)
|
resp, err := ctx.Client.MainMono.Comp.Release(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -9,20 +9,20 @@ import (
|
|||||||
type MatrixCmdGroup struct {
|
type MatrixCmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the Matrix output (1-6)."`
|
Index int `arg:"" help:"The index of the Matrix output (1-6)."`
|
||||||
Mute MatrixMuteCmd `help:"Get or set the mute state of the Matrix output." cmd:""`
|
Mute MatrixMuteCmd `cmd:"" help:"Get or set the mute state of the Matrix output."`
|
||||||
|
|
||||||
Fader MatrixFaderCmd `help:"Get or set the fader level of the Matrix output." cmd:""`
|
Fader MatrixFaderCmd `cmd:"" help:"Get or set the fader level of the Matrix output."`
|
||||||
Fadein MatrixFadeinCmd `help:"Fade in the Matrix output over a specified duration." cmd:""`
|
Fadein MatrixFadeinCmd `cmd:"" help:"Fade in the Matrix output over a specified duration."`
|
||||||
Fadeout MatrixFadeoutCmd `help:"Fade out the Matrix output over a specified duration." cmd:""`
|
Fadeout MatrixFadeoutCmd `cmd:"" help:"Fade out the Matrix output over a specified duration."`
|
||||||
|
|
||||||
Eq MatrixEqCmdGroup `help:"Commands for controlling the equalizer settings of the Matrix output." cmd:"eq"`
|
Eq MatrixEqCmdGroup `cmd:"" help:"Commands for controlling the equaliser settings of the Matrix output."`
|
||||||
Comp MatrixCompCmdGroup `help:"Commands for controlling the compressor settings of the Matrix output." cmd:"comp"`
|
Comp MatrixCompCmdGroup `cmd:"" help:"Commands for controlling the compressor settings of the Matrix output."`
|
||||||
} `help:"Commands for controlling individual Matrix outputs." arg:""`
|
} `arg:"" help:"Commands for controlling individual Matrix outputs."`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *MatrixCmdGroup) Validate() error {
|
func (cmd *MatrixCmdGroup) Validate() error {
|
||||||
if cmd.Index.Index < 1 || cmd.Index.Index > 6 {
|
if cmd.Index.Index < 1 || cmd.Index.Index > 6 {
|
||||||
return fmt.Errorf("Matrix output index must be between 1 and 6, got %d", cmd.Index.Index)
|
return fmt.Errorf("matrix output index must be between 1 and 6, got %d", cmd.Index.Index)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,7 @@ func (cmd *MatrixMuteCmd) Run(ctx *context, matrix *MatrixCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Matrix.SetMute(matrix.Index.Index, *cmd.Mute == "true"); err != nil {
|
if err := ctx.Client.Matrix.SetMute(matrix.Index.Index, *cmd.Mute == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Matrix mute state: %w", err)
|
return fmt.Errorf("failed to set Matrix mute state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix mute state set to: %s\n", *cmd.Mute)
|
fmt.Fprintf(ctx.Out, "Matrix mute state set to: %s\n", *cmd.Mute)
|
||||||
@@ -141,16 +141,16 @@ func (cmd *MatrixFadeoutCmd) Run(ctx *context, matrix *MatrixCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatrixEqCmdGroup defines the command group for controlling the equalizer settings of the Matrix output, including commands for getting or setting the EQ parameters.
|
// MatrixEqCmdGroup defines the command group for controlling the equaliser settings of the Matrix output, including commands for getting or setting the EQ parameters.
|
||||||
type MatrixEqCmdGroup struct {
|
type MatrixEqCmdGroup struct {
|
||||||
On MatrixEqOnCmd `help:"Get or set the EQ on/off state of the Matrix output." cmd:"on"`
|
On MatrixEqOnCmd `cmd:"" help:"Get or set the EQ on/off state of the Matrix output."`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band *int `arg:"" help:"The EQ band number." optional:""`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain MatrixEqBandGainCmd `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
Gain MatrixEqBandGainCmd `cmd:"" help:"Get or set the gain of the specified EQ band."`
|
||||||
Freq MatrixEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MatrixEqBandFreqCmd `cmd:"" help:"Get or set the frequency of the specified EQ band."`
|
||||||
Q MatrixEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MatrixEqBandQCmd `cmd:"" help:"Get or set the Q factor of the specified EQ band."`
|
||||||
Type MatrixEqBandTypeCmd `help:"Get or set the type of the specified EQ band." cmd:"type"`
|
Type MatrixEqBandTypeCmd `cmd:"" help:"Get or set the type of the specified EQ band."`
|
||||||
} `help:"Commands for controlling individual EQ bands of the Matrix output." arg:""`
|
} ` help:"Commands for controlling individual EQ bands of the Matrix output." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Matrix output.
|
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Matrix output.
|
||||||
@@ -181,10 +181,10 @@ func (cmd *MatrixEqOnCmd) Run(ctx *context, matrix *MatrixCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Matrix.Eq.SetOn(matrix.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Matrix.Eq.SetOn(matrix.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Matrix EQ on/off state: %w", err)
|
return fmt.Errorf("failed to set Matrix EQ on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Matrix EQ on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -194,7 +194,11 @@ type MatrixEqBandGainCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MatrixEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
// Run executes the MatrixEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
||||||
func (cmd *MatrixEqBandGainCmd) Run(ctx *context, matrix *MatrixCmdGroup, matrixEq *MatrixEqCmdGroup) error {
|
func (cmd *MatrixEqBandGainCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
matrix *MatrixCmdGroup,
|
||||||
|
matrixEq *MatrixEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Level == nil {
|
if cmd.Level == nil {
|
||||||
resp, err := ctx.Client.Matrix.Eq.Gain(matrix.Index.Index, *matrixEq.Band.Band)
|
resp, err := ctx.Client.Matrix.Eq.Gain(matrix.Index.Index, *matrixEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -204,10 +208,19 @@ func (cmd *MatrixEqBandGainCmd) Run(ctx *context, matrix *MatrixCmdGroup, matrix
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Matrix.Eq.SetGain(matrix.Index.Index, *matrixEq.Band.Band, *cmd.Level); err != nil {
|
if err := ctx.Client.Matrix.Eq.SetGain(
|
||||||
|
matrix.Index.Index,
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
*cmd.Level,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set Matrix EQ band %d gain: %w", *matrixEq.Band.Band, err)
|
return fmt.Errorf("failed to set Matrix EQ band %d gain: %w", *matrixEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d gain set to: %.2f dB\n", *matrixEq.Band.Band, *cmd.Level)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Matrix EQ band %d gain set to: %.2f dB\n",
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
*cmd.Level,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -217,20 +230,37 @@ type MatrixEqBandFreqCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MatrixEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
// Run executes the MatrixEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
||||||
func (cmd *MatrixEqBandFreqCmd) Run(ctx *context, matrix *MatrixCmdGroup, matrixEq *MatrixEqCmdGroup) error {
|
func (cmd *MatrixEqBandFreqCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
matrix *MatrixCmdGroup,
|
||||||
|
matrixEq *MatrixEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Frequency == nil {
|
if cmd.Frequency == nil {
|
||||||
resp, err := ctx.Client.Matrix.Eq.Frequency(matrix.Index.Index, *matrixEq.Band.Band)
|
resp, err := ctx.Client.Matrix.Eq.Frequency(matrix.Index.Index, *matrixEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Matrix EQ band %d frequency: %w", *matrixEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Matrix EQ band %d frequency: %w",
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d frequency: %.2f Hz\n", *matrixEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Matrix EQ band %d frequency: %.2f Hz\n", *matrixEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Matrix.Eq.SetFrequency(matrix.Index.Index, *matrixEq.Band.Band, *cmd.Frequency); err != nil {
|
if err := ctx.Client.Matrix.Eq.SetFrequency(
|
||||||
|
matrix.Index.Index,
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
*cmd.Frequency,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set Matrix EQ band %d frequency: %w", *matrixEq.Band.Band, err)
|
return fmt.Errorf("failed to set Matrix EQ band %d frequency: %w", *matrixEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d frequency set to: %.2f Hz\n", *matrixEq.Band.Band, *cmd.Frequency)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Matrix EQ band %d frequency set to: %.2f Hz\n",
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
*cmd.Frequency,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,17 +270,29 @@ type MatrixEqBandQCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MatrixEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
// Run executes the MatrixEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
||||||
func (cmd *MatrixEqBandQCmd) Run(ctx *context, matrix *MatrixCmdGroup, matrixEq *MatrixEqCmdGroup) error {
|
func (cmd *MatrixEqBandQCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
matrix *MatrixCmdGroup,
|
||||||
|
matrixEq *MatrixEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.Matrix.Eq.Q(matrix.Index.Index, *matrixEq.Band.Band)
|
resp, err := ctx.Client.Matrix.Eq.Q(matrix.Index.Index, *matrixEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Matrix EQ band %d Q factor: %w", *matrixEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Matrix EQ band %d Q factor: %w",
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d Q factor: %.2f\n", *matrixEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Matrix EQ band %d Q factor: %.2f\n", *matrixEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Matrix.Eq.SetQ(matrix.Index.Index, *matrixEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.Matrix.Eq.SetQ(
|
||||||
|
matrix.Index.Index,
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
*cmd.Q,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set Matrix EQ band %d Q factor: %w", *matrixEq.Band.Band, err)
|
return fmt.Errorf("failed to set Matrix EQ band %d Q factor: %w", *matrixEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d Q factor set to: %.2f\n", *matrixEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(ctx.Out, "Matrix EQ band %d Q factor set to: %.2f\n", *matrixEq.Band.Band, *cmd.Q)
|
||||||
@@ -263,7 +305,11 @@ type MatrixEqBandTypeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MatrixEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
// Run executes the MatrixEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Matrix output or setting it based on the provided argument.
|
||||||
func (cmd *MatrixEqBandTypeCmd) Run(ctx *context, matrix *MatrixCmdGroup, matrixEq *MatrixEqCmdGroup) error {
|
func (cmd *MatrixEqBandTypeCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
matrix *MatrixCmdGroup,
|
||||||
|
matrixEq *MatrixEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.Matrix.Eq.Type(matrix.Index.Index, *matrixEq.Band.Band)
|
resp, err := ctx.Client.Matrix.Eq.Type(matrix.Index.Index, *matrixEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -273,7 +319,11 @@ func (cmd *MatrixEqBandTypeCmd) Run(ctx *context, matrix *MatrixCmdGroup, matrix
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Matrix.Eq.SetType(matrix.Index.Index, *matrixEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.Matrix.Eq.SetType(
|
||||||
|
matrix.Index.Index,
|
||||||
|
*matrixEq.Band.Band,
|
||||||
|
*cmd.Type,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set Matrix EQ band %d type: %w", *matrixEq.Band.Band, err)
|
return fmt.Errorf("failed to set Matrix EQ band %d type: %w", *matrixEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d type set to: %s\n", *matrixEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(ctx.Out, "Matrix EQ band %d type set to: %s\n", *matrixEq.Band.Band, *cmd.Type)
|
||||||
@@ -282,15 +332,15 @@ func (cmd *MatrixEqBandTypeCmd) Run(ctx *context, matrix *MatrixCmdGroup, matrix
|
|||||||
|
|
||||||
// MatrixCompCmdGroup defines the command group for controlling the compressor settings of the Matrix output, including commands for getting or setting the compressor parameters.
|
// MatrixCompCmdGroup defines the command group for controlling the compressor settings of the Matrix output, including commands for getting or setting the compressor parameters.
|
||||||
type MatrixCompCmdGroup struct {
|
type MatrixCompCmdGroup struct {
|
||||||
On MatrixCompOnCmd `help:"Get or set the compressor on/off state of the Matrix output." cmd:"on"`
|
On MatrixCompOnCmd `cmd:"" help:"Get or set the compressor on/off state of the Matrix output."`
|
||||||
Mode MatrixCompModeCmd `help:"Get or set the compressor mode of the Matrix output." cmd:"mode"`
|
Mode MatrixCompModeCmd `cmd:"" help:"Get or set the compressor mode of the Matrix output."`
|
||||||
Threshold MatrixCompThresholdCmd `help:"Get or set the compressor threshold of the Matrix output." cmd:"threshold"`
|
Threshold MatrixCompThresholdCmd `cmd:"" help:"Get or set the compressor threshold of the Matrix output."`
|
||||||
Ratio MatrixCompRatioCmd `help:"Get or set the compressor ratio of the Matrix output." cmd:"ratio"`
|
Ratio MatrixCompRatioCmd `cmd:"" help:"Get or set the compressor ratio of the Matrix output."`
|
||||||
Mix MatrixCompMixCmd `help:"Get or set the compressor mix level of the Matrix output." cmd:"mix"`
|
Mix MatrixCompMixCmd `cmd:"" help:"Get or set the compressor mix level of the Matrix output."`
|
||||||
Makeup MatrixCompMakeupCmd `help:"Get or set the compressor makeup gain of the Matrix output." cmd:"makeup"`
|
Makeup MatrixCompMakeupCmd `cmd:"" help:"Get or set the compressor makeup gain of the Matrix output."`
|
||||||
Attack MatrixCompAttackCmd `help:"Get or set the compressor attack time of the Matrix output." cmd:"attack"`
|
Attack MatrixCompAttackCmd `cmd:"" help:"Get or set the compressor attack time of the Matrix output."`
|
||||||
Hold MatrixCompHoldCmd `help:"Get or set the compressor hold time of the Matrix output." cmd:"hold"`
|
Hold MatrixCompHoldCmd `cmd:"" help:"Get or set the compressor hold time of the Matrix output."`
|
||||||
Release MatrixCompReleaseCmd `help:"Get or set the compressor release time of the Matrix output." cmd:"release"`
|
Release MatrixCompReleaseCmd `cmd:"" help:"Get or set the compressor release time of the Matrix output."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MatrixCompOnCmd defines the command for getting or setting the compressor on/off state of the Matrix output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// MatrixCompOnCmd defines the command for getting or setting the compressor on/off state of the Matrix output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
@@ -309,10 +359,10 @@ func (cmd *MatrixCompOnCmd) Run(ctx *context, matrix *MatrixCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Matrix.Comp.SetOn(matrix.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Matrix.Comp.SetOn(matrix.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Matrix compressor on/off state: %w", err)
|
return fmt.Errorf("failed to set Matrix compressor on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix compressor on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Matrix compressor on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
// RawCmd represents the command to send raw OSC messages to the mixer.
|
// RawCmd represents the command to send raw OSC messages to the mixer.
|
||||||
type RawCmd struct {
|
type RawCmd struct {
|
||||||
Address string `help:"The OSC address to send the message to." arg:""`
|
Address string `arg:"" help:"The OSC address to send the message to."`
|
||||||
Args []string `help:"The arguments to include in the OSC message." arg:"" optional:""`
|
Args []string `arg:"" help:"The arguments to include in the OSC message." optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the RawCmd by sending the specified OSC message to the mixer and optionally waiting for a response.
|
// Run executes the RawCmd by sending the specified OSC message to the mixer and optionally waiting for a response.
|
||||||
|
|||||||
@@ -3,37 +3,36 @@ package main
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
type SnapshotCmdGroup struct {
|
type SnapshotCmdGroup struct {
|
||||||
List ListCmd `help:"List all snapshots." cmd:"list"`
|
List ListCmd `cmd:"" help:"List all snapshots."`
|
||||||
Index struct {
|
Index struct {
|
||||||
Index *int `arg:"" help:"The index of the snapshot." optional:""`
|
Index *int `arg:"" help:"The index of the snapshot." optional:""`
|
||||||
Name NameCmd `help:"Get or set the name of a snapshot." cmd:"name"`
|
Name NameCmd `cmd:"" help:"Get or set the name of a snapshot."`
|
||||||
Save SaveCmd `help:"Save the current mixer state to a snapshot." cmd:"save"`
|
Save SaveCmd `cmd:"" help:"Save the current mixer state to a snapshot."`
|
||||||
Load LoadCmd `help:"Load a mixer state from a snapshot." cmd:"load"`
|
Load LoadCmd `cmd:"" help:"Load a mixer state from a snapshot."`
|
||||||
Delete DeleteCmd `help:"Delete a snapshot." cmd:"delete"`
|
Delete DeleteCmd `cmd:"" help:"Delete a snapshot."`
|
||||||
} `help:"The index of the snapshot." arg:""`
|
} ` help:"The index of the snapshot." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided snapshot index is within the valid range (1-64) when any of the subcommands that require an index are used.
|
// Validate checks if the provided snapshot index is within the valid range (1-64) when any of the subcommands that require an index are used.
|
||||||
func (c *SnapshotCmdGroup) Validate() error {
|
func (cmd *SnapshotCmdGroup) Validate() error {
|
||||||
if c.Index.Index == nil {
|
if cmd.Index.Index == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if *c.Index.Index < 1 || *c.Index.Index > 64 {
|
if *cmd.Index.Index < 1 || *cmd.Index.Index > 64 {
|
||||||
return fmt.Errorf("snapshot index must be between 1 and 64")
|
return fmt.Errorf("snapshot index must be between 1 and 64")
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListCmd struct {
|
type ListCmd struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ListCmd) Run(ctx *context) error {
|
func (cmd *ListCmd) Run(ctx *context) error {
|
||||||
for i := range 64 {
|
for i := range 64 {
|
||||||
name, err := ctx.Client.Snapshot.Name(i + 1)
|
name, err := ctx.Client.Snapshot.Name(i + 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
return fmt.Errorf("failed to get name for snapshot %d: %w", i+1, err)
|
||||||
}
|
}
|
||||||
if name == "" {
|
if name == "" {
|
||||||
continue
|
continue
|
||||||
@@ -47,8 +46,8 @@ type NameCmd struct {
|
|||||||
Name *string `arg:"" help:"The name of the snapshot." optional:""`
|
Name *string `arg:"" help:"The name of the snapshot." optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (cmd *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
if c.Name == nil {
|
if cmd.Name == nil {
|
||||||
name, err := ctx.Client.Snapshot.Name(*snapshot.Index.Index)
|
name, err := ctx.Client.Snapshot.Name(*snapshot.Index.Index)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -57,15 +56,15 @@ func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctx.Client.Snapshot.SetName(*snapshot.Index.Index, *c.Name)
|
return ctx.Client.Snapshot.SetName(*snapshot.Index.Index, *cmd.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SaveCmd struct {
|
type SaveCmd struct {
|
||||||
Name string `arg:"" help:"The name of the snapshot."`
|
Name string `arg:"" help:"The name of the snapshot."`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (cmd *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
err := ctx.Client.Snapshot.CurrentName(c.Name)
|
err := ctx.Client.Snapshot.CurrentName(cmd.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -73,16 +72,14 @@ func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
|||||||
return ctx.Client.Snapshot.CurrentSave(*snapshot.Index.Index)
|
return ctx.Client.Snapshot.CurrentSave(*snapshot.Index.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoadCmd struct {
|
type LoadCmd struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *LoadCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (cmd *LoadCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
return ctx.Client.Snapshot.CurrentLoad(*snapshot.Index.Index)
|
return ctx.Client.Snapshot.CurrentLoad(*snapshot.Index.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteCmd struct {
|
type DeleteCmd struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DeleteCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (cmd *DeleteCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
return ctx.Client.Snapshot.CurrentDelete(*snapshot.Index.Index)
|
return ctx.Client.Snapshot.CurrentDelete(*snapshot.Index.Index)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,16 +9,16 @@ import (
|
|||||||
type StripCmdGroup struct {
|
type StripCmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the strip. (1-based indexing)"`
|
Index int `arg:"" help:"The index of the strip. (1-based indexing)"`
|
||||||
Mute StripMuteCmd ` help:"Get or set the mute state of the strip." cmd:""`
|
Mute StripMuteCmd `cmd:"" help:"Get or set the mute state of the strip." `
|
||||||
Fader StripFaderCmd ` help:"Get or set the fader level of the strip." cmd:""`
|
Fader StripFaderCmd `cmd:"" help:"Get or set the fader level of the strip."`
|
||||||
Fadein StripFadeinCmd ` help:"Fade in the strip over a specified duration." cmd:""`
|
Fadein StripFadeinCmd `cmd:"" help:"Fade in the strip over a specified duration."`
|
||||||
Fadeout StripFadeoutCmd ` help:"Fade out the strip over a specified duration." cmd:""`
|
Fadeout StripFadeoutCmd `cmd:"" help:"Fade out the strip over a specified duration."`
|
||||||
Send StripSendCmd ` help:"Get or set the send level for a specific bus." cmd:""`
|
Send StripSendCmd `cmd:"" help:"Get or set the send level for a specific bus."`
|
||||||
Name StripNameCmd ` help:"Get or set the name of the strip." cmd:""`
|
Name StripNameCmd `cmd:"" help:"Get or set the name of the strip."`
|
||||||
|
|
||||||
Gate StripGateCmdGroup ` help:"Commands related to the strip gate." cmd:"gate"`
|
Gate StripGateCmdGroup `cmd:"" help:"Commands related to the strip gate."`
|
||||||
Eq StripEqCmdGroup ` help:"Commands related to the strip EQ." cmd:"eq"`
|
Eq StripEqCmdGroup `cmd:"" help:"Commands related to the strip EQ."`
|
||||||
Comp StripCompCmdGroup ` help:"Commands related to the strip compressor." cmd:"comp"`
|
Comp StripCompCmdGroup `cmd:"" help:"Commands related to the strip compressor."`
|
||||||
} `arg:"" help:"Control a specific strip by index."`
|
} `arg:"" help:"Control a specific strip by index."`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ func (cmd *StripMuteCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.SetMute(strip.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Strip.SetMute(strip.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set mute state: %w", err)
|
return fmt.Errorf("failed to set mute state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d mute state set to: %s\n", strip.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Strip %d mute state set to: %s\n", strip.Index.Index, *cmd.State)
|
||||||
@@ -99,7 +99,12 @@ func (cmd *StripFadeinCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d fade-in complete. Final level: %.2f dB\n", strip.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d fade-in complete. Final level: %.2f dB\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +140,12 @@ func (cmd *StripFadeoutCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d fade-out complete. Final level: %.2f dB\n", strip.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d fade-out complete. Final level: %.2f dB\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -165,7 +175,11 @@ func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.SetSendLevel(strip.Index.Index, cmd.SendIndex, *cmd.Level); err != nil {
|
if err := ctx.Client.Strip.SetSendLevel(
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.SendIndex,
|
||||||
|
*cmd.Level,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set send level: %w", err)
|
return fmt.Errorf("failed to set send level: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
@@ -178,7 +192,7 @@ func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripNameCmd defines the command for getting or setting the name of a strip, allowing users to assign custom names to strips for easier identification and organization.
|
// StripNameCmd defines the command for getting or setting the name of a strip, allowing users to assign custom names to strips for easier identification and organisation.
|
||||||
type StripNameCmd struct {
|
type StripNameCmd struct {
|
||||||
Name *string `arg:"" help:"The name to set for the strip." optional:""`
|
Name *string `arg:"" help:"The name to set for the strip." optional:""`
|
||||||
}
|
}
|
||||||
@@ -203,13 +217,13 @@ func (cmd *StripNameCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
|
|
||||||
// StripGateCmdGroup defines the command group for controlling the gate settings of a strip, including commands for getting and setting the gate on/off state, mode, threshold, range, attack time, hold time, and release time.
|
// StripGateCmdGroup defines the command group for controlling the gate settings of a strip, including commands for getting and setting the gate on/off state, mode, threshold, range, attack time, hold time, and release time.
|
||||||
type StripGateCmdGroup struct {
|
type StripGateCmdGroup struct {
|
||||||
On StripGateOnCmd `help:"Get or set the gate on/off state of the strip." cmd:""`
|
On StripGateOnCmd `cmd:"" help:"Get or set the gate on/off state of the strip."`
|
||||||
Mode StripGateModeCmd `help:"Get or set the gate mode of the strip." cmd:""`
|
Mode StripGateModeCmd `cmd:"" help:"Get or set the gate mode of the strip."`
|
||||||
Threshold StripGateThresholdCmd `help:"Get or set the gate threshold of the strip." cmd:""`
|
Threshold StripGateThresholdCmd `cmd:"" help:"Get or set the gate threshold of the strip."`
|
||||||
Range StripGateRangeCmd `help:"Get or set the gate range of the strip." cmd:""`
|
Range StripGateRangeCmd `cmd:"" help:"Get or set the gate range of the strip."`
|
||||||
Attack StripGateAttackCmd `help:"Get or set the gate attack time of the strip." cmd:""`
|
Attack StripGateAttackCmd `cmd:"" help:"Get or set the gate attack time of the strip."`
|
||||||
Hold StripGateHoldCmd `help:"Get or set the gate hold time of the strip." cmd:""`
|
Hold StripGateHoldCmd `cmd:"" help:"Get or set the gate hold time of the strip."`
|
||||||
Release StripGateReleaseCmd `help:"Get or set the gate release time of the strip." cmd:""`
|
Release StripGateReleaseCmd `cmd:"" help:"Get or set the gate release time of the strip."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripGateOnCmd defines the command for getting or setting the gate on/off state of a strip, allowing users to enable or disable the gate effect on the strip.
|
// StripGateOnCmd defines the command for getting or setting the gate on/off state of a strip, allowing users to enable or disable the gate effect on the strip.
|
||||||
@@ -228,7 +242,7 @@ func (cmd *StripGateOnCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Gate.SetOn(strip.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Strip.Gate.SetOn(strip.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set gate state: %w", err)
|
return fmt.Errorf("failed to set gate state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
fmt.Fprintf(ctx.Out, "Strip %d gate state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
||||||
@@ -277,7 +291,12 @@ func (cmd *StripGateThresholdCmd) Run(ctx *context, strip *StripCmdGroup) error
|
|||||||
if err := ctx.Client.Strip.Gate.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
if err := ctx.Client.Strip.Gate.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
||||||
return fmt.Errorf("failed to set gate threshold: %w", err)
|
return fmt.Errorf("failed to set gate threshold: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate threshold set to: %.2f\n", strip.Index.Index, *cmd.Threshold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d gate threshold set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Threshold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -323,7 +342,12 @@ func (cmd *StripGateAttackCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Gate.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
if err := ctx.Client.Strip.Gate.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
||||||
return fmt.Errorf("failed to set gate attack time: %w", err)
|
return fmt.Errorf("failed to set gate attack time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate attack time set to: %.2f ms\n", strip.Index.Index, *cmd.Attack)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d gate attack time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Attack,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -369,20 +393,25 @@ func (cmd *StripGateReleaseCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Gate.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
if err := ctx.Client.Strip.Gate.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
||||||
return fmt.Errorf("failed to set gate release time: %w", err)
|
return fmt.Errorf("failed to set gate release time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate release time set to: %.2f ms\n", strip.Index.Index, *cmd.Release)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d gate release time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Release,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripEqCmdGroup defines the command group for controlling the EQ settings of a strip, including commands for getting and setting the EQ on/off state and parameters for each EQ band such as gain, frequency, Q factor, and type.
|
// StripEqCmdGroup defines the command group for controlling the EQ settings of a strip, including commands for getting and setting the EQ on/off state and parameters for each EQ band such as gain, frequency, Q factor, and type.
|
||||||
type StripEqCmdGroup struct {
|
type StripEqCmdGroup struct {
|
||||||
On StripEqOnCmd `help:"Get or set the EQ on/off state of the strip." cmd:""`
|
On StripEqOnCmd `cmd:"" help:"Get or set the EQ on/off state of the strip."`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band *int `arg:"" help:"The EQ band number." optional:""`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain StripEqBandGainCmd `help:"Get or set the gain of the EQ band." cmd:""`
|
Gain StripEqBandGainCmd `cmd:"" help:"Get or set the gain of the EQ band."`
|
||||||
Freq StripEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:""`
|
Freq StripEqBandFreqCmd `cmd:"" help:"Get or set the frequency of the EQ band."`
|
||||||
Q StripEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:""`
|
Q StripEqBandQCmd `cmd:"" help:"Get or set the Q factor of the EQ band."`
|
||||||
Type StripEqBandTypeCmd `help:"Get or set the type of the EQ band." cmd:""`
|
Type StripEqBandTypeCmd `cmd:"" help:"Get or set the type of the EQ band."`
|
||||||
} `help:"Commands for controlling a specific EQ band of the strip." arg:""`
|
} ` help:"Commands for controlling a specific EQ band of the strip." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided EQ band number is valid (between 1 and 4) and returns an error if it is not.
|
// Validate checks if the provided EQ band number is valid (between 1 and 4) and returns an error if it is not.
|
||||||
@@ -413,7 +442,7 @@ func (cmd *StripEqOnCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetOn(strip.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Strip.Eq.SetOn(strip.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ state: %w", err)
|
return fmt.Errorf("failed to set EQ state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
fmt.Fprintf(ctx.Out, "Strip %d EQ state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
||||||
@@ -426,40 +455,74 @@ type StripEqBandGainCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandGainCmd command, either retrieving the current gain of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandGainCmd command, either retrieving the current gain of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandGainCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandGainCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Gain == nil {
|
if cmd.Gain == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Gain(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Gain(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band gain: %w", err)
|
return fmt.Errorf("failed to get EQ band gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d gain: %.2f\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d gain: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetGain(strip.Index.Index, *stripEq.Band.Band, *cmd.Gain); err != nil {
|
if err := ctx.Client.Strip.Eq.SetGain(
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Gain,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band gain: %w", err)
|
return fmt.Errorf("failed to set EQ band gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d gain set to: %.2f\n", strip.Index.Index, *stripEq.Band.Band, *cmd.Gain)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d gain set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Gain,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripEqBandFreqCmd defines the command for getting or setting the frequency of a specific EQ band on a strip, allowing users to adjust the center frequency of the band in hertz (Hz).
|
// StripEqBandFreqCmd defines the command for getting or setting the frequency of a specific EQ band on a strip, allowing users to adjust the centre frequency of the band in hertz (Hz).
|
||||||
type StripEqBandFreqCmd struct {
|
type StripEqBandFreqCmd struct {
|
||||||
Freq *float64 `arg:"" help:"The frequency to set for the EQ band (in Hz)." optional:""`
|
Freq *float64 `arg:"" help:"The frequency to set for the EQ band (in Hz)." optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandFreqCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandFreqCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Freq == nil {
|
if cmd.Freq == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Frequency(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Frequency(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band frequency: %w", err)
|
return fmt.Errorf("failed to get EQ band frequency: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d frequency: %.2f Hz\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d frequency: %.2f Hz\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetFrequency(strip.Index.Index, *stripEq.Band.Band, *cmd.Freq); err != nil {
|
if err := ctx.Client.Strip.Eq.SetFrequency(
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Freq,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band frequency: %w", err)
|
return fmt.Errorf("failed to set EQ band frequency: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
@@ -478,20 +541,36 @@ type StripEqBandQCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandQCmd command, either retrieving the current Q factor of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandQCmd command, either retrieving the current Q factor of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandQCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandQCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Q(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Q(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band Q factor: %w", err)
|
return fmt.Errorf("failed to get EQ band Q factor: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d Q factor: %.2f\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d Q factor: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetQ(strip.Index.Index, *stripEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.Strip.Eq.SetQ(strip.Index.Index, *stripEq.Band.Band, *cmd.Q); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band Q factor: %w", err)
|
return fmt.Errorf("failed to set EQ band Q factor: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d Q factor set to: %.2f\n", strip.Index.Index, *stripEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d Q factor set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Q,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -501,34 +580,54 @@ type StripEqBandTypeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandTypeCmd command, either retrieving the current type of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandTypeCmd command, either retrieving the current type of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandTypeCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandTypeCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Type(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Type(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band type: %w", err)
|
return fmt.Errorf("failed to get EQ band type: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d type: %s\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d type: %s\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetType(strip.Index.Index, *stripEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.Strip.Eq.SetType(
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Type,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band type: %w", err)
|
return fmt.Errorf("failed to set EQ band type: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d type set to: %s\n", strip.Index.Index, *stripEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d type set to: %s\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Type,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripCompCmdGroup defines the command group for controlling the compressor settings of a strip, including commands for getting and setting the compressor on/off state, mode, threshold, ratio, mix, makeup gain, attack time, hold time, and release time.
|
// StripCompCmdGroup defines the command group for controlling the compressor settings of a strip, including commands for getting and setting the compressor on/off state, mode, threshold, ratio, mix, makeup gain, attack time, hold time, and release time.
|
||||||
type StripCompCmdGroup struct {
|
type StripCompCmdGroup struct {
|
||||||
On StripCompOnCmd `help:"Get or set the compressor on/off state of the strip." cmd:""`
|
On StripCompOnCmd `cmd:"" help:"Get or set the compressor on/off state of the strip."`
|
||||||
Mode StripCompModeCmd `help:"Get or set the compressor mode of the strip." cmd:""`
|
Mode StripCompModeCmd `cmd:"" help:"Get or set the compressor mode of the strip."`
|
||||||
Threshold StripCompThresholdCmd `help:"Get or set the compressor threshold of the strip." cmd:""`
|
Threshold StripCompThresholdCmd `cmd:"" help:"Get or set the compressor threshold of the strip."`
|
||||||
Ratio StripCompRatioCmd `help:"Get or set the compressor ratio of the strip." cmd:""`
|
Ratio StripCompRatioCmd `cmd:"" help:"Get or set the compressor ratio of the strip."`
|
||||||
Mix StripCompMixCmd `help:"Get or set the compressor mix of the strip." cmd:""`
|
Mix StripCompMixCmd `cmd:"" help:"Get or set the compressor mix of the strip."`
|
||||||
Makeup StripCompMakeupCmd `help:"Get or set the compressor makeup gain of the strip." cmd:""`
|
Makeup StripCompMakeupCmd `cmd:"" help:"Get or set the compressor makeup gain of the strip."`
|
||||||
Attack StripCompAttackCmd `help:"Get or set the compressor attack time of the strip." cmd:""`
|
Attack StripCompAttackCmd `cmd:"" help:"Get or set the compressor attack time of the strip."`
|
||||||
Hold StripCompHoldCmd `help:"Get or set the compressor hold time of the strip." cmd:""`
|
Hold StripCompHoldCmd `cmd:"" help:"Get or set the compressor hold time of the strip."`
|
||||||
Release StripCompReleaseCmd `help:"Get or set the compressor release time of the strip." cmd:""`
|
Release StripCompReleaseCmd `cmd:"" help:"Get or set the compressor release time of the strip."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripCompOnCmd defines the command for getting or setting the compressor on/off state of a strip, allowing users to enable or disable the compressor effect on the strip.
|
// StripCompOnCmd defines the command for getting or setting the compressor on/off state of a strip, allowing users to enable or disable the compressor effect on the strip.
|
||||||
@@ -547,7 +646,7 @@ func (cmd *StripCompOnCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Comp.SetOn(strip.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Strip.Comp.SetOn(strip.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor state: %w", err)
|
return fmt.Errorf("failed to set compressor state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
fmt.Fprintf(ctx.Out, "Strip %d compressor state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
||||||
@@ -596,7 +695,12 @@ func (cmd *StripCompThresholdCmd) Run(ctx *context, strip *StripCmdGroup) error
|
|||||||
if err := ctx.Client.Strip.Comp.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
if err := ctx.Client.Strip.Comp.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor threshold: %w", err)
|
return fmt.Errorf("failed to set compressor threshold: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor threshold set to: %.2f\n", strip.Index.Index, *cmd.Threshold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor threshold set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Threshold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -665,7 +769,12 @@ func (cmd *StripCompMakeupCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetMakeup(strip.Index.Index, *cmd.Makeup); err != nil {
|
if err := ctx.Client.Strip.Comp.SetMakeup(strip.Index.Index, *cmd.Makeup); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor makeup gain: %w", err)
|
return fmt.Errorf("failed to set compressor makeup gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor makeup gain set to: %.2f\n", strip.Index.Index, *cmd.Makeup)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor makeup gain set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Makeup,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -688,7 +797,12 @@ func (cmd *StripCompAttackCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
if err := ctx.Client.Strip.Comp.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor attack time: %w", err)
|
return fmt.Errorf("failed to set compressor attack time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor attack time set to: %.2f ms\n", strip.Index.Index, *cmd.Attack)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor attack time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Attack,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,7 +825,12 @@ func (cmd *StripCompHoldCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetHold(strip.Index.Index, *cmd.Hold); err != nil {
|
if err := ctx.Client.Strip.Comp.SetHold(strip.Index.Index, *cmd.Hold); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor hold time: %w", err)
|
return fmt.Errorf("failed to set compressor hold time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor hold time set to: %.2f ms\n", strip.Index.Index, *cmd.Hold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor hold time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Hold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -734,6 +853,11 @@ func (cmd *StripCompReleaseCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
if err := ctx.Client.Strip.Comp.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor release time: %w", err)
|
return fmt.Errorf("failed to set compressor release time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor release time set to: %.2f ms\n", strip.Index.Index, *cmd.Release)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor release time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Release,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ import (
|
|||||||
type BusCmdGroup struct {
|
type BusCmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the bus. (1-based indexing)"`
|
Index int `arg:"" help:"The index of the bus. (1-based indexing)"`
|
||||||
Mute BusMuteCmd ` help:"Get or set the mute state of the bus." cmd:""`
|
Mute BusMuteCmd `cmd:"" help:"Get or set the mute state of the bus."`
|
||||||
Fader BusFaderCmd ` help:"Get or set the fader level of the bus." cmd:""`
|
Fader BusFaderCmd `cmd:"" help:"Get or set the fader level of the bus."`
|
||||||
Fadein BusFadeinCmd ` help:"Fade in the bus over a specified duration." cmd:""`
|
Fadein BusFadeinCmd `cmd:"" help:"Fade in the bus over a specified duration."`
|
||||||
Fadeout BusFadeoutCmd ` help:"Fade out the bus over a specified duration." cmd:""`
|
Fadeout BusFadeoutCmd `cmd:"" help:"Fade out the bus over a specified duration."`
|
||||||
Name BusNameCmd ` help:"Get or set the name of the bus." cmd:""`
|
Name BusNameCmd `cmd:"" help:"Get or set the name of the bus."`
|
||||||
|
|
||||||
Eq BusEqCmdGroup ` help:"Commands related to the bus EQ." cmd:"eq"`
|
Eq BusEqCmdGroup `cmd:"" help:"Commands related to the bus EQ."`
|
||||||
Comp BusCompCmdGroup ` help:"Commands related to the bus compressor." cmd:"comp"`
|
Comp BusCompCmdGroup `cmd:"" help:"Commands related to the bus compressor."`
|
||||||
} `arg:"" help:"Control a specific bus by index."`
|
} `arg:"" help:"Control a specific bus by index."`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +36,7 @@ func (cmd *BusMuteCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.SetMute(bus.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Bus.SetMute(bus.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d mute state set to: %s\n", bus.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Bus %d mute state set to: %s\n", bus.Index.Index, *cmd.State)
|
||||||
@@ -101,7 +101,12 @@ func (cmd *BusFadeinCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d fade-in complete. Final level: %.2f dB\n", bus.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d fade-in complete. Final level: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +145,12 @@ func (cmd *BusFadeoutCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d fade-out complete. Final level: %.2f dB\n", bus.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d fade-out complete. Final level: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,15 +179,15 @@ func (cmd *BusNameCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
|
|
||||||
// BusEqCmdGroup defines the commands related to controlling the EQ of a bus.
|
// BusEqCmdGroup defines the commands related to controlling the EQ of a bus.
|
||||||
type BusEqCmdGroup struct {
|
type BusEqCmdGroup struct {
|
||||||
On BusEqOnCmd `help:"Get or set the EQ on/off state of the bus." cmd:"on"`
|
On BusEqOnCmd `cmd:"" help:"Get or set the EQ on/off state of the bus."`
|
||||||
Mode BusEqModeCmd `help:"Get or set the EQ mode of the bus (peq, geq or teq)." cmd:"mode"`
|
Mode BusEqModeCmd `cmd:"" help:"Get or set the EQ mode of the bus (peq, geq or teq)."`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band *int `arg:"" help:"The EQ band number." optional:""`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain BusEqBandGainCmd `help:"Get or set the gain of the EQ band." cmd:"gain"`
|
Gain BusEqBandGainCmd `cmd:"" help:"Get or set the gain of the EQ band."`
|
||||||
Freq BusEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:"freq"`
|
Freq BusEqBandFreqCmd `cmd:"" help:"Get or set the frequency of the EQ band."`
|
||||||
Q BusEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:"q"`
|
Q BusEqBandQCmd `cmd:"" help:"Get or set the Q factor of the EQ band."`
|
||||||
Type BusEqBandTypeCmd `help:"Get or set the type of the EQ band (lcut, lshv, peq, veq, hshv, hcut)." cmd:"type"`
|
Type BusEqBandTypeCmd `cmd:"" help:"Get or set the type of the EQ band (lcut, lshv, peq, veq, hshv, hcut)."`
|
||||||
} `help:"Commands for controlling a specific EQ band of the bus." arg:""`
|
} ` help:"Commands for controlling a specific EQ band of the bus." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks that the provided EQ band number is within the valid range (1-6).
|
// Validate checks that the provided EQ band number is within the valid range (1-6).
|
||||||
@@ -208,7 +218,7 @@ func (cmd *BusEqOnCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetOn(bus.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Bus.Eq.SetOn(bus.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ on state set to: %s\n", bus.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Bus %d EQ on state set to: %s\n", bus.Index.Index, *cmd.State)
|
||||||
@@ -250,14 +260,26 @@ func (cmd *BusEqBandGainCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d gain: %.2f dB\n", bus.Index.Index, busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d gain: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetGain(bus.Index.Index, *busEq.Band.Band, *cmd.Gain); err != nil {
|
if err := ctx.Client.Bus.Eq.SetGain(bus.Index.Index, *busEq.Band.Band, *cmd.Gain); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d gain set to: %.2f dB\n", bus.Index.Index, *busEq.Band.Band, *cmd.Gain)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d gain set to: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Gain,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,14 +295,30 @@ func (cmd *BusEqBandFreqCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d frequency: %.2f Hz\n", bus.Index.Index, *busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d frequency: %.2f Hz\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetFrequency(bus.Index.Index, *busEq.Band.Band, *cmd.Freq); err != nil {
|
if err := ctx.Client.Bus.Eq.SetFrequency(
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Freq,
|
||||||
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d frequency set to: %.2f Hz\n", bus.Index.Index, *busEq.Band.Band, *cmd.Freq)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d frequency set to: %.2f Hz\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Freq,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -296,14 +334,26 @@ func (cmd *BusEqBandQCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGro
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d Q factor: %.2f\n", bus.Index.Index, *busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d Q factor: %.2f\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetQ(bus.Index.Index, *busEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.Bus.Eq.SetQ(bus.Index.Index, *busEq.Band.Band, *cmd.Q); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d Q factor set to: %.2f\n", bus.Index.Index, *busEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d Q factor set to: %.2f\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Q,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -319,28 +369,40 @@ func (cmd *BusEqBandTypeCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmd
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d type: %s\n", bus.Index.Index, *busEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d type: %s\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Eq.SetType(bus.Index.Index, *busEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.Bus.Eq.SetType(bus.Index.Index, *busEq.Band.Band, *cmd.Type); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d EQ band %d type set to: %s\n", bus.Index.Index, *busEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d EQ band %d type set to: %s\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*busEq.Band.Band,
|
||||||
|
*cmd.Type,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// BusCompCmdGroup defines the commands related to controlling the compressor of a bus.
|
// BusCompCmdGroup defines the commands related to controlling the compressor of a bus.
|
||||||
type BusCompCmdGroup struct {
|
type BusCompCmdGroup struct {
|
||||||
On BusCompOnCmd `help:"Get or set the compressor on/off state of the bus." cmd:"on"`
|
On BusCompOnCmd `cmd:"" help:"Get or set the compressor on/off state of the bus."`
|
||||||
Mode BusCompModeCmd `help:"Get or set the compressor mode of the bus (comp, exp)." cmd:"mode"`
|
Mode BusCompModeCmd `cmd:"" help:"Get or set the compressor mode of the bus (comp, exp)."`
|
||||||
Threshold BusCompThresholdCmd `help:"Get or set the compressor threshold of the bus (in dB)." cmd:"threshold"`
|
Threshold BusCompThresholdCmd `cmd:"" help:"Get or set the compressor threshold of the bus (in dB)."`
|
||||||
Ratio BusCompRatioCmd `help:"Get or set the compressor ratio of the bus." cmd:"ratio"`
|
Ratio BusCompRatioCmd `cmd:"" help:"Get or set the compressor ratio of the bus."`
|
||||||
Mix BusCompMixCmd `help:"Get or set the compressor mix level of the bus (in %)." cmd:"mix"`
|
Mix BusCompMixCmd `cmd:"" help:"Get or set the compressor mix level of the bus (in %)."`
|
||||||
Makeup BusCompMakeupCmd `help:"Get or set the compressor makeup gain of the bus (in dB)." cmd:"makeup"`
|
Makeup BusCompMakeupCmd `cmd:"" help:"Get or set the compressor makeup gain of the bus (in dB)."`
|
||||||
Attack BusCompAttackCmd `help:"Get or set the compressor attack time of the bus (in ms)." cmd:"attack"`
|
Attack BusCompAttackCmd `cmd:"" help:"Get or set the compressor attack time of the bus (in ms)."`
|
||||||
Hold BusCompHoldCmd `help:"Get or set the compressor hold time of the bus (in ms)." cmd:"hold"`
|
Hold BusCompHoldCmd `cmd:"" help:"Get or set the compressor hold time of the bus (in ms)."`
|
||||||
Release BusCompReleaseCmd `help:"Get or set the compressor release time of the bus (in ms)." cmd:"release"`
|
Release BusCompReleaseCmd `cmd:"" help:"Get or set the compressor release time of the bus (in ms)."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// BusCompOnCmd defines the command for getting or setting the compressor on/off state of a bus.
|
// BusCompOnCmd defines the command for getting or setting the compressor on/off state of a bus.
|
||||||
@@ -359,7 +421,7 @@ func (cmd *BusCompOnCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Bus.Comp.SetOn(bus.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Bus.Comp.SetOn(bus.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor on state set to: %s\n", bus.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Bus %d compressor on state set to: %s\n", bus.Index.Index, *cmd.State)
|
||||||
@@ -408,7 +470,12 @@ func (cmd *BusCompThresholdCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetThreshold(bus.Index.Index, *cmd.Threshold); err != nil {
|
if err := ctx.Client.Bus.Comp.SetThreshold(bus.Index.Index, *cmd.Threshold); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor threshold set to: %.2f dB\n", bus.Index.Index, *cmd.Threshold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor threshold set to: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Threshold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,7 +544,12 @@ func (cmd *BusCompMakeupCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetMakeup(bus.Index.Index, *cmd.Makeup); err != nil {
|
if err := ctx.Client.Bus.Comp.SetMakeup(bus.Index.Index, *cmd.Makeup); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor makeup gain set to: %.2f dB\n", bus.Index.Index, *cmd.Makeup)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor makeup gain set to: %.2f dB\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Makeup,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,7 +572,12 @@ func (cmd *BusCompAttackCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetAttack(bus.Index.Index, *cmd.Attack); err != nil {
|
if err := ctx.Client.Bus.Comp.SetAttack(bus.Index.Index, *cmd.Attack); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor attack time set to: %.2f ms\n", bus.Index.Index, *cmd.Attack)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor attack time set to: %.2f ms\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Attack,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -523,7 +600,12 @@ func (cmd *BusCompHoldCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetHold(bus.Index.Index, *cmd.Hold); err != nil {
|
if err := ctx.Client.Bus.Comp.SetHold(bus.Index.Index, *cmd.Hold); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor hold time set to: %.2f ms\n", bus.Index.Index, *cmd.Hold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor hold time set to: %.2f ms\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Hold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -546,6 +628,11 @@ func (cmd *BusCompReleaseCmd) Run(ctx *context, bus *BusCmdGroup) error {
|
|||||||
if err := ctx.Client.Bus.Comp.SetRelease(bus.Index.Index, *cmd.Release); err != nil {
|
if err := ctx.Client.Bus.Comp.SetRelease(bus.Index.Index, *cmd.Release); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Bus %d compressor release time set to: %.2f ms\n", bus.Index.Index, *cmd.Release)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Bus %d compressor release time set to: %.2f ms\n",
|
||||||
|
bus.Index.Index,
|
||||||
|
*cmd.Release,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,18 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
"github.com/alecthomas/kong"
|
||||||
|
mangokong "github.com/alecthomas/mango-kong"
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
kongcompletion "github.com/jotaen/kong-completion"
|
kongcompletion "github.com/jotaen/kong-completion"
|
||||||
|
|
||||||
"github.com/onyx-and-iris/xair-cli/internal/xair"
|
"github.com/onyx-and-iris/xair-cli/internal/xair"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
trueStr = "true"
|
||||||
|
falseStr = "false"
|
||||||
|
)
|
||||||
|
|
||||||
var version string // Version of the CLI, set at build time.
|
var version string // Version of the CLI, set at build time.
|
||||||
|
|
||||||
// VersionFlag is a custom flag type that prints the version and exits.
|
// VersionFlag is a custom flag type that prints the version and exits.
|
||||||
@@ -33,10 +40,10 @@ type context struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Host string `default:"mixer.local" help:"The host of the X-Air device." env:"XAIR_CLI_HOST" short:"H"`
|
Host string `flag:"" default:"mixer.local" help:"The host of the X-Air device." env:"XAIR_CLI_HOST" short:"H"`
|
||||||
Port int `default:"10024" help:"The port of the X-Air device." env:"XAIR_CLI_PORT" short:"P"`
|
Port int `flag:"" default:"10024" help:"The port of the X-Air device." env:"XAIR_CLI_PORT" short:"P"`
|
||||||
Timeout time.Duration `default:"100ms" help:"Timeout for OSC operations." env:"XAIR_CLI_TIMEOUT" short:"T"`
|
Timeout time.Duration `flag:"" default:"100ms" help:"Timeout for OSC operations." env:"XAIR_CLI_TIMEOUT" short:"T"`
|
||||||
Loglevel string `default:"warn" help:"Log level for the CLI." env:"XAIR_CLI_LOGLEVEL" short:"L" enum:"debug,info,warn,error,fatal"`
|
Loglevel string `flag:"" default:"warn" help:"Log level for the CLI." env:"XAIR_CLI_LOGLEVEL" short:"L" enum:"debug,info,warn,error,fatal"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// CLI is the main struct for the command-line interface.
|
// CLI is the main struct for the command-line interface.
|
||||||
@@ -44,17 +51,19 @@ type Config struct {
|
|||||||
type CLI struct {
|
type CLI struct {
|
||||||
Config `embed:"" prefix:"" help:"The configuration for the CLI."`
|
Config `embed:"" prefix:"" help:"The configuration for the CLI."`
|
||||||
|
|
||||||
Version VersionFlag `help:"Print xair-cli version information and quit" name:"version" short:"v"`
|
Man mangokong.ManFlag `help:"Print man page."`
|
||||||
|
Version VersionFlag `help:"Print xair-cli version information and quit" name:"version" short:"v"`
|
||||||
|
|
||||||
Completion kongcompletion.Completion `help:"Generate shell completion scripts." cmd:"" aliases:"c"`
|
Completion kongcompletion.Completion `cmd:"" help:"Generate shell completion scripts."`
|
||||||
|
Info InfoCmd `cmd:"" help:"Print mixer information."`
|
||||||
|
Raw RawCmd `cmd:"" help:"Send raw OSC messages to the mixer."`
|
||||||
|
|
||||||
Raw RawCmd `help:"Send raw OSC messages to the mixer." cmd:"" group:"Raw"`
|
Main MainCmdGroup `cmd:"" help:"Control the Main L/R output" group:"Main"`
|
||||||
Main MainCmdGroup `help:"Control the Main L/R output" cmd:"" group:"Main"`
|
Strip StripCmdGroup `cmd:"" help:"Control the strips." group:"Strip"`
|
||||||
Strip StripCmdGroup `help:"Control the strips." cmd:"" group:"Strip"`
|
Bus BusCmdGroup `cmd:"" help:"Control the buses." group:"Bus"`
|
||||||
Bus BusCmdGroup `help:"Control the buses." cmd:"" group:"Bus"`
|
Headamp HeadampCmdGroup `cmd:"" help:"Control input gain and phantom power." group:"Headamp"`
|
||||||
Headamp HeadampCmdGroup `help:"Control input gain and phantom power." cmd:"" group:"Headamp"`
|
Snapshot SnapshotCmdGroup `cmd:"" help:"Save and load mixer states." group:"Snapshot"`
|
||||||
Snapshot SnapshotCmdGroup `help:"Save and load mixer states." cmd:"" group:"Snapshot"`
|
Dca DCACmdGroup `cmd:"" help:"Control DCA groups." group:"DCA"`
|
||||||
Dca DCACmdGroup `help:"Control DCA groups." cmd:"" group:"DCA"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
@@ -70,14 +79,15 @@ func main() {
|
|||||||
}),
|
}),
|
||||||
kong.Vars{
|
kong.Vars{
|
||||||
"version": func() string {
|
"version": func() string {
|
||||||
if version == "" {
|
if version != "" {
|
||||||
info, ok := debug.ReadBuildInfo()
|
return version
|
||||||
if !ok {
|
|
||||||
return "(unable to read build info)"
|
|
||||||
}
|
|
||||||
version = strings.Split(info.Main.Version, "-")[0]
|
|
||||||
}
|
}
|
||||||
return version
|
|
||||||
|
info, ok := debug.ReadBuildInfo()
|
||||||
|
if !ok {
|
||||||
|
return "(unable to read version)"
|
||||||
|
}
|
||||||
|
return strings.Split(info.Main.Version, "-")[0]
|
||||||
}(),
|
}(),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -98,7 +108,11 @@ func run(ctx *kong.Context, config Config) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to connect to X-Air device: %w", err)
|
return fmt.Errorf("failed to connect to X-Air device: %w", err)
|
||||||
}
|
}
|
||||||
defer client.Close()
|
defer func() {
|
||||||
|
if err := client.Close(); err != nil {
|
||||||
|
log.Errorf("failed to close client connection: %v", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
client.StartListening()
|
client.StartListening()
|
||||||
resp, err := client.RequestInfo()
|
resp, err := client.RequestInfo()
|
||||||
@@ -123,7 +137,7 @@ func connect(config Config) (*xair.XAirClient, error) {
|
|||||||
xair.WithTimeout(config.Timeout),
|
xair.WithTimeout(config.Timeout),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("failed to create X-Air client: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return client, nil
|
return client, nil
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
type DCACmdGroup struct {
|
type DCACmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the DCA group (1-4)."`
|
Index int `arg:"" help:"The index of the DCA group (1-4)."`
|
||||||
Mute DCAMuteCmd `help:"Get or set the mute status of the DCA group." cmd:""`
|
Mute DCAMuteCmd `cmd:"" help:"Get or set the mute status of the DCA group."`
|
||||||
Name DCANameCmd `help:"Get or set the name of the DCA group." cmd:""`
|
Name DCANameCmd `cmd:"" help:"Get or set the name of the DCA group."`
|
||||||
} `arg:"" help:"Control a specific DCA group by its index."`
|
} `arg:"" help:"Control a specific DCA group by its index."`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ func (cmd *DCAMuteCmd) Run(ctx *context, dca *DCACmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.DCA.SetMute(dca.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.DCA.SetMute(dca.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set DCA mute status: %w", err)
|
return fmt.Errorf("failed to set DCA mute status: %w", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ import (
|
|||||||
type HeadampCmdGroup struct {
|
type HeadampCmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the headamp."`
|
Index int `arg:"" help:"The index of the headamp."`
|
||||||
Gain HeadampGainCmd `help:"Get or set the gain of the headamp." cmd:""`
|
Gain HeadampGainCmd `cmd:"" help:"Get or set the gain of the headamp."`
|
||||||
Phantom HeadampPhantomCmd `help:"Get or set the phantom power state of the headamp." cmd:""`
|
Phantom HeadampPhantomCmd `cmd:"" help:"Get or set the phantom power state of the headamp."`
|
||||||
} `arg:"" help:"Control a specific headamp by index."`
|
} `arg:"" help:"Control a specific headamp by index."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// HeadampGainCmd defines the command for getting or setting the gain of a headamp, allowing users to specify the gain in dB and an optional duration for a gradual fade when setting the gain.
|
// HeadampGainCmd defines the command for getting or setting the gain of a headamp, allowing users to specify the gain in dB and an optional duration for a gradual fade when setting the gain.
|
||||||
type HeadampGainCmd struct {
|
type HeadampGainCmd struct {
|
||||||
Duration time.Duration `help:"The duration of the fade in/out when setting the gain." default:"5s"`
|
Duration time.Duration `flag:"" help:"The duration of the fade in/out when setting the gain." default:"5s"`
|
||||||
Gain *float64 `help:"The gain of the headamp in dB." arg:"" optional:""`
|
Gain *float64 ` help:"The gain of the headamp in dB." arg:"" optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the HeadampGainCmd command, either retrieving the current gain of the headamp or setting it based on the provided argument, with an optional fade duration for smooth transitions.
|
// Run executes the HeadampGainCmd command, either retrieving the current gain of the headamp or setting it based on the provided argument, with an optional fade duration for smooth transitions.
|
||||||
@@ -38,14 +38,20 @@ func (cmd *HeadampGainCmd) Run(ctx *context, headamp *HeadampCmdGroup) error {
|
|||||||
return fmt.Errorf("failed to get current headamp gain: %w", err)
|
return fmt.Errorf("failed to get current headamp gain: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := gradualGainAdjust(ctx, headamp.Index.Index, currentGain, *cmd.Gain, cmd.Duration); err != nil {
|
if err := gradualGainAdjust(
|
||||||
|
ctx,
|
||||||
|
headamp.Index.Index,
|
||||||
|
currentGain,
|
||||||
|
*cmd.Gain,
|
||||||
|
cmd.Duration,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set headamp gain: %w", err)
|
return fmt.Errorf("failed to set headamp gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Headamp %d gain set to: %.2f dB\n", headamp.Index.Index, *cmd.Gain)
|
fmt.Fprintf(ctx.Out, "Headamp %d gain set to: %.2f dB\n", headamp.Index.Index, *cmd.Gain)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// gradualGainAdjust gradually adjusts gain from current to target over specified duration
|
// gradualGainAdjust gradually adjusts gain from current to target over specified duration.
|
||||||
func gradualGainAdjust(
|
func gradualGainAdjust(
|
||||||
ctx *context,
|
ctx *context,
|
||||||
index int,
|
index int,
|
||||||
@@ -93,17 +99,17 @@ func gradualGainAdjust(
|
|||||||
|
|
||||||
// HeadampPhantomCmd defines the command for getting or setting the phantom power state of a headamp, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// HeadampPhantomCmd defines the command for getting or setting the phantom power state of a headamp, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
type HeadampPhantomCmd struct {
|
type HeadampPhantomCmd struct {
|
||||||
State *string `help:"The phantom power state of the headamp." arg:"" enum:"true,on,false,off" optional:""`
|
State *string `arg:"" help:"The phantom power state of the headamp." enum:"true,on,false,off" optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided phantom power state is valid and normalizes it to "true" or "false".
|
// Validate checks if the provided phantom power state is valid and normalises it to "true" or "false".
|
||||||
func (cmd *HeadampPhantomCmd) Validate() error {
|
func (cmd *HeadampPhantomCmd) Validate() error {
|
||||||
if cmd.State != nil {
|
if cmd.State != nil {
|
||||||
switch *cmd.State {
|
switch *cmd.State {
|
||||||
case "true", "on":
|
case trueStr, "on":
|
||||||
*cmd.State = "true"
|
*cmd.State = trueStr
|
||||||
case "false", "off":
|
case falseStr, "off":
|
||||||
*cmd.State = "false"
|
*cmd.State = falseStr
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("invalid phantom power state: %s", *cmd.State)
|
return fmt.Errorf("invalid phantom power state: %s", *cmd.State)
|
||||||
}
|
}
|
||||||
@@ -122,7 +128,10 @@ func (cmd *HeadampPhantomCmd) Run(ctx *context, headamp *HeadampCmdGroup) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.HeadAmp.SetPhantomPower(headamp.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.HeadAmp.SetPhantomPower(
|
||||||
|
headamp.Index.Index,
|
||||||
|
*cmd.State == trueStr,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set headamp phantom power state: %w", err)
|
return fmt.Errorf("failed to set headamp phantom power state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Headamp %d phantom power set to: %s\n", headamp.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Headamp %d phantom power set to: %s\n", headamp.Index.Index, *cmd.State)
|
||||||
|
|||||||
17
cmd/xair-cli/info.go
Normal file
17
cmd/xair-cli/info.go
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type InfoCmd struct{}
|
||||||
|
|
||||||
|
func (cmd *InfoCmd) Run(ctx *context) error { // nolint: unparam
|
||||||
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Host: %s | Name: %s | Model: %s | Firmware: %s\n",
|
||||||
|
ctx.Client.Info.Host,
|
||||||
|
ctx.Client.Info.Name,
|
||||||
|
ctx.Client.Info.Model,
|
||||||
|
ctx.Client.Info.Firmware,
|
||||||
|
)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package main implements the command-line interface for controlling an XAir digital mixer.
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -7,14 +8,14 @@ import (
|
|||||||
|
|
||||||
// MainCmdGroup defines the command group for controlling the Main L/R output, including commands for mute state, fader level, and fade-in/fade-out times.
|
// MainCmdGroup defines the command group for controlling the Main L/R output, including commands for mute state, fader level, and fade-in/fade-out times.
|
||||||
type MainCmdGroup struct {
|
type MainCmdGroup struct {
|
||||||
Mute MainMuteCmd `help:"Get or set the mute state of the Main L/R output." cmd:""`
|
Mute MainMuteCmd `cmd:"" help:"Get or set the mute state of the Main L/R output."`
|
||||||
|
|
||||||
Fader MainFaderCmd `help:"Get or set the fader level of the Main L/R output." cmd:""`
|
Fader MainFaderCmd `cmd:"" help:"Get or set the fader level of the Main L/R output."`
|
||||||
Fadein MainFadeinCmd `help:"Fade in the Main L/R output over a specified duration." cmd:""`
|
Fadein MainFadeinCmd `cmd:"" help:"Fade in the Main L/R output over a specified duration."`
|
||||||
Fadeout MainFadeoutCmd `help:"Fade out the Main L/R output over a specified duration." cmd:""`
|
Fadeout MainFadeoutCmd `cmd:"" help:"Fade out the Main L/R output over a specified duration."`
|
||||||
|
|
||||||
Eq MainEqCmdGroup `help:"Commands for controlling the equalizer settings of the Main L/R output." cmd:"eq"`
|
Eq MainEqCmdGroup `cmd:"" help:"Commands for controlling the equaliser settings of the Main L/R output."`
|
||||||
Comp MainCompCmdGroup `help:"Commands for controlling the compressor settings of the Main L/R output." cmd:"comp"`
|
Comp MainCompCmdGroup `cmd:"" help:"Commands for controlling the compressor settings of the Main L/R output."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainMuteCmd defines the command for getting or setting the mute state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// MainMuteCmd defines the command for getting or setting the mute state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
@@ -33,7 +34,7 @@ func (cmd *MainMuteCmd) Run(ctx *context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.SetMute(*cmd.Mute == "true"); err != nil {
|
if err := ctx.Client.Main.SetMute(*cmd.Mute == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R mute state: %w", err)
|
return fmt.Errorf("failed to set Main L/R mute state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R mute state set to: %s\n", *cmd.Mute)
|
fmt.Fprintf(ctx.Out, "Main L/R mute state set to: %s\n", *cmd.Mute)
|
||||||
@@ -131,16 +132,16 @@ func (cmd *MainFadeoutCmd) Run(ctx *context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainEqCmdGroup defines the command group for controlling the equalizer settings of the Main L/R output, including commands for getting or setting the EQ parameters.
|
// MainEqCmdGroup defines the command group for controlling the equaliser settings of the Main L/R output, including commands for getting or setting the EQ parameters.
|
||||||
type MainEqCmdGroup struct {
|
type MainEqCmdGroup struct {
|
||||||
On MainEqOnCmd `help:"Get or set the EQ on/off state of the Main L/R output." cmd:"on"`
|
On MainEqOnCmd `cmd:"" help:"Get or set the EQ on/off state of the Main L/R output."`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band *int `arg:"" help:"The EQ band number." optional:""`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain MainEqBandGainCmd `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
Gain MainEqBandGainCmd `cmd:"" help:"Get or set the gain of the specified EQ band."`
|
||||||
Freq MainEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MainEqBandFreqCmd `cmd:"" help:"Get or set the frequency of the specified EQ band."`
|
||||||
Q MainEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MainEqBandQCmd `cmd:"" help:"Get or set the Q factor of the specified EQ band."`
|
||||||
Type MainEqBandTypeCmd `help:"Get or set the type of the specified EQ band." cmd:"type"`
|
Type MainEqBandTypeCmd `cmd:"" help:"Get or set the type of the specified EQ band."`
|
||||||
} `help:"Commands for controlling individual EQ bands of the Main L/R output." arg:""`
|
} ` help:"Commands for controlling individual EQ bands of the Main L/R output." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Main L/R output.
|
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Main L/R output.
|
||||||
@@ -161,7 +162,7 @@ type MainEqOnCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqOnCmd command, either retrieving the current EQ on/off state of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqOnCmd command, either retrieving the current EQ on/off state of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainEqOnCmd) Run(ctx *context) error {
|
||||||
if cmd.Enable == nil {
|
if cmd.Enable == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.On(0)
|
resp, err := ctx.Client.Main.Eq.On(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -171,10 +172,10 @@ func (cmd *MainEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Eq.SetOn(0, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Main.Eq.SetOn(0, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ on/off state: %w", err)
|
return fmt.Errorf("failed to set Main L/R EQ on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Main L/R EQ on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +185,7 @@ type MainEqBandGainCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandGainCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Level == nil {
|
if cmd.Level == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Gain(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Gain(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -197,7 +198,12 @@ func (cmd *MainEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *Main
|
|||||||
if err := ctx.Client.Main.Eq.SetGain(0, *mainEq.Band.Band, *cmd.Level); err != nil {
|
if err := ctx.Client.Main.Eq.SetGain(0, *mainEq.Band.Band, *cmd.Level); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d gain: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main L/R EQ band %d gain: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d gain set to: %.2f dB\n", *mainEq.Band.Band, *cmd.Level)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Main L/R EQ band %d gain set to: %.2f dB\n",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
*cmd.Level,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -207,11 +213,15 @@ type MainEqBandFreqCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandFreqCmd command, either retrieving the current frequency of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandFreqCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandFreqCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Frequency == nil {
|
if cmd.Frequency == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Frequency(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Frequency(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Main L/R EQ band %d frequency: %w",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d frequency: %.2f Hz\n", *mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d frequency: %.2f Hz\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
@@ -220,7 +230,12 @@ func (cmd *MainEqBandFreqCmd) Run(ctx *context, main *MainCmdGroup, mainEq *Main
|
|||||||
if err := ctx.Client.Main.Eq.SetFrequency(0, *mainEq.Band.Band, *cmd.Frequency); err != nil {
|
if err := ctx.Client.Main.Eq.SetFrequency(0, *mainEq.Band.Band, *cmd.Frequency); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main L/R EQ band %d frequency: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d frequency set to: %.2f Hz\n", *mainEq.Band.Band, *cmd.Frequency)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Main L/R EQ band %d frequency set to: %.2f Hz\n",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
*cmd.Frequency,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,11 +245,15 @@ type MainEqBandQCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandQCmd command, either retrieving the current Q factor of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandQCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandQCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Q(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Q(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d Q factor: %w", *mainEq.Band.Band, err)
|
return fmt.Errorf(
|
||||||
|
"failed to get Main L/R EQ band %d Q factor: %w",
|
||||||
|
*mainEq.Band.Band,
|
||||||
|
err,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d Q factor: %.2f\n", *mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d Q factor: %.2f\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
@@ -253,7 +272,7 @@ type MainEqBandTypeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
|
func (cmd *MainEqBandTypeCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.Main.Eq.Type(0, *mainEq.Band.Band)
|
resp, err := ctx.Client.Main.Eq.Type(0, *mainEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -272,15 +291,15 @@ func (cmd *MainEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *Main
|
|||||||
|
|
||||||
// MainCompCmdGroup defines the command group for controlling the compressor settings of the Main L/R output, including commands for getting or setting the compressor parameters.
|
// MainCompCmdGroup defines the command group for controlling the compressor settings of the Main L/R output, including commands for getting or setting the compressor parameters.
|
||||||
type MainCompCmdGroup struct {
|
type MainCompCmdGroup struct {
|
||||||
On MainCompOnCmd `help:"Get or set the compressor on/off state of the Main L/R output." cmd:"on"`
|
On MainCompOnCmd `cmd:"on" help:"Get or set the compressor on/off state of the Main L/R output."`
|
||||||
Mode MainCompModeCmd `help:"Get or set the compressor mode of the Main L/R output." cmd:"mode"`
|
Mode MainCompModeCmd `cmd:"mode" help:"Get or set the compressor mode of the Main L/R output."`
|
||||||
Threshold MainCompThresholdCmd `help:"Get or set the compressor threshold of the Main L/R output." cmd:"threshold"`
|
Threshold MainCompThresholdCmd `cmd:"threshold" help:"Get or set the compressor threshold of the Main L/R output."`
|
||||||
Ratio MainCompRatioCmd `help:"Get or set the compressor ratio of the Main L/R output." cmd:"ratio"`
|
Ratio MainCompRatioCmd `cmd:"ratio" help:"Get or set the compressor ratio of the Main L/R output."`
|
||||||
Mix MainCompMixCmd `help:"Get or set the compressor mix level of the Main L/R output." cmd:"mix"`
|
Mix MainCompMixCmd `cmd:"mix" help:"Get or set the compressor mix level of the Main L/R output."`
|
||||||
Makeup MainCompMakeupCmd `help:"Get or set the compressor makeup gain of the Main L/R output." cmd:"makeup"`
|
Makeup MainCompMakeupCmd `cmd:"makeup" help:"Get or set the compressor makeup gain of the Main L/R output."`
|
||||||
Attack MainCompAttackCmd `help:"Get or set the compressor attack time of the Main L/R output." cmd:"attack"`
|
Attack MainCompAttackCmd `cmd:"attack" help:"Get or set the compressor attack time of the Main L/R output."`
|
||||||
Hold MainCompHoldCmd `help:"Get or set the compressor hold time of the Main L/R output." cmd:"hold"`
|
Hold MainCompHoldCmd `cmd:"hold" help:"Get or set the compressor hold time of the Main L/R output."`
|
||||||
Release MainCompReleaseCmd `help:"Get or set the compressor release time of the Main L/R output." cmd:"release"`
|
Release MainCompReleaseCmd `cmd:"release" help:"Get or set the compressor release time of the Main L/R output."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// MainCompOnCmd defines the command for getting or setting the compressor on/off state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
// MainCompOnCmd defines the command for getting or setting the compressor on/off state of the Main L/R output, allowing users to specify the desired state as "true"/"on" or "false"/"off".
|
||||||
@@ -289,7 +308,7 @@ type MainCompOnCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompOnCmd command, either retrieving the current compressor on/off state of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompOnCmd command, either retrieving the current compressor on/off state of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompOnCmd) Run(ctx *context) error {
|
||||||
if cmd.Enable == nil {
|
if cmd.Enable == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.On(0)
|
resp, err := ctx.Client.Main.Comp.On(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -299,10 +318,10 @@ func (cmd *MainCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Comp.SetOn(0, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Main.Comp.SetOn(0, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R compressor on/off state: %w", err)
|
return fmt.Errorf("failed to set Main L/R compressor on/off state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R compressor on/off state set to: %t\n", *cmd.Enable == "true")
|
fmt.Fprintf(ctx.Out, "Main L/R compressor on/off state set to: %t\n", *cmd.Enable == trueStr)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,7 +331,7 @@ type MainCompModeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompModeCmd command, either retrieving the current compressor mode of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompModeCmd command, either retrieving the current compressor mode of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompModeCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompModeCmd) Run(ctx *context) error {
|
||||||
if cmd.Mode == nil {
|
if cmd.Mode == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Mode(0)
|
resp, err := ctx.Client.Main.Comp.Mode(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -335,7 +354,7 @@ type MainCompThresholdCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompThresholdCmd command, either retrieving the current compressor threshold of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompThresholdCmd command, either retrieving the current compressor threshold of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompThresholdCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompThresholdCmd) Run(ctx *context) error {
|
||||||
if cmd.Threshold == nil {
|
if cmd.Threshold == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Threshold(0)
|
resp, err := ctx.Client.Main.Comp.Threshold(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -358,7 +377,7 @@ type MainCompRatioCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompRatioCmd command, either retrieving the current compressor ratio of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompRatioCmd command, either retrieving the current compressor ratio of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompRatioCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompRatioCmd) Run(ctx *context) error {
|
||||||
if cmd.Ratio == nil {
|
if cmd.Ratio == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Ratio(0)
|
resp, err := ctx.Client.Main.Comp.Ratio(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -381,7 +400,7 @@ type MainCompMixCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompMixCmd command, either retrieving the current compressor mix level of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompMixCmd command, either retrieving the current compressor mix level of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompMixCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompMixCmd) Run(ctx *context) error {
|
||||||
if cmd.Mix == nil {
|
if cmd.Mix == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Mix(0)
|
resp, err := ctx.Client.Main.Comp.Mix(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -404,7 +423,7 @@ type MainCompMakeupCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompMakeupCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompMakeupCmd) Run(ctx *context) error {
|
||||||
if cmd.Makeup == nil {
|
if cmd.Makeup == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Makeup(0)
|
resp, err := ctx.Client.Main.Comp.Makeup(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -427,7 +446,7 @@ type MainCompAttackCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompAttackCmd command, either retrieving the current compressor attack time of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompAttackCmd command, either retrieving the current compressor attack time of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompAttackCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompAttackCmd) Run(ctx *context) error {
|
||||||
if cmd.Attack == nil {
|
if cmd.Attack == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Attack(0)
|
resp, err := ctx.Client.Main.Comp.Attack(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -450,7 +469,7 @@ type MainCompHoldCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompHoldCmd command, either retrieving the current compressor hold time of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompHoldCmd command, either retrieving the current compressor hold time of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompHoldCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompHoldCmd) Run(ctx *context) error {
|
||||||
if cmd.Hold == nil {
|
if cmd.Hold == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Hold(0)
|
resp, err := ctx.Client.Main.Comp.Hold(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -473,7 +492,7 @@ type MainCompReleaseCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the MainCompReleaseCmd command, either retrieving the current compressor release time of the Main L/R output or setting it based on the provided argument.
|
// Run executes the MainCompReleaseCmd command, either retrieving the current compressor release time of the Main L/R output or setting it based on the provided argument.
|
||||||
func (cmd *MainCompReleaseCmd) Run(ctx *context, main *MainCmdGroup) error {
|
func (cmd *MainCompReleaseCmd) Run(ctx *context) error {
|
||||||
if cmd.Release == nil {
|
if cmd.Release == nil {
|
||||||
resp, err := ctx.Client.Main.Comp.Release(0)
|
resp, err := ctx.Client.Main.Comp.Release(0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
// RawCmd represents the command to send raw OSC messages to the mixer.
|
// RawCmd represents the command to send raw OSC messages to the mixer.
|
||||||
type RawCmd struct {
|
type RawCmd struct {
|
||||||
Address string `help:"The OSC address to send the message to." arg:""`
|
Address string `arg:"" help:"The OSC address to send the message to."`
|
||||||
Args []string `help:"The arguments to include in the OSC message." arg:"" optional:""`
|
Args []string `arg:"" help:"The arguments to include in the OSC message." optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the RawCmd by sending the specified OSC message to the mixer and optionally waiting for a response.
|
// Run executes the RawCmd by sending the specified OSC message to the mixer and optionally waiting for a response.
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package main
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
type SnapshotCmdGroup struct {
|
type SnapshotCmdGroup struct {
|
||||||
List ListCmd `help:"List all snapshots." cmd:"list"`
|
List ListCmd `cmd:"" help:"List all snapshots."`
|
||||||
Index struct {
|
Index struct {
|
||||||
Index *int `arg:"" help:"The index of the snapshot." optional:""`
|
Index *int `arg:"" help:"The index of the snapshot." optional:""`
|
||||||
Name NameCmd `help:"Get or set the name of a snapshot." cmd:"name"`
|
Name NameCmd `cmd:"" help:"Get or set the name of a snapshot."`
|
||||||
Save SaveCmd `help:"Save the current mixer state to a snapshot." cmd:"save"`
|
Save SaveCmd `cmd:"" help:"Save the current mixer state to a snapshot."`
|
||||||
Load LoadCmd `help:"Load a mixer state from a snapshot." cmd:"load"`
|
Load LoadCmd `cmd:"" help:"Load a mixer state from a snapshot."`
|
||||||
Delete DeleteCmd `help:"Delete a snapshot." cmd:"delete"`
|
Delete DeleteCmd `cmd:"" help:"Delete a snapshot."`
|
||||||
} `help:"The index of the snapshot." arg:""`
|
} ` help:"The index of the snapshot." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided snapshot index is within the valid range (1-64) when any of the subcommands that require an index are used.
|
// Validate checks if the provided snapshot index is within the valid range (1-64) when any of the subcommands that require an index are used.
|
||||||
@@ -26,14 +26,13 @@ func (c *SnapshotCmdGroup) Validate() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type ListCmd struct {
|
type ListCmd struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *ListCmd) Run(ctx *context) error {
|
func (c *ListCmd) Run(ctx *context) error {
|
||||||
for i := range 64 {
|
for i := range 64 {
|
||||||
name, err := ctx.Client.Snapshot.Name(i + 1)
|
name, err := ctx.Client.Snapshot.Name(i + 1)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
break
|
return fmt.Errorf("failed to get name for snapshot %d: %w", i+1, err)
|
||||||
}
|
}
|
||||||
if name == "" {
|
if name == "" {
|
||||||
continue
|
continue
|
||||||
@@ -73,15 +72,13 @@ func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
|||||||
return ctx.Client.Snapshot.CurrentSave(*snapshot.Index.Index)
|
return ctx.Client.Snapshot.CurrentSave(*snapshot.Index.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
type LoadCmd struct {
|
type LoadCmd struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *LoadCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (c *LoadCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
return ctx.Client.Snapshot.CurrentLoad(*snapshot.Index.Index)
|
return ctx.Client.Snapshot.CurrentLoad(*snapshot.Index.Index)
|
||||||
}
|
}
|
||||||
|
|
||||||
type DeleteCmd struct {
|
type DeleteCmd struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func (c *DeleteCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (c *DeleteCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
return ctx.Client.Snapshot.CurrentDelete(*snapshot.Index.Index)
|
return ctx.Client.Snapshot.CurrentDelete(*snapshot.Index.Index)
|
||||||
|
|||||||
@@ -9,16 +9,16 @@ import (
|
|||||||
type StripCmdGroup struct {
|
type StripCmdGroup struct {
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the strip. (1-based indexing)"`
|
Index int `arg:"" help:"The index of the strip. (1-based indexing)"`
|
||||||
Mute StripMuteCmd ` help:"Get or set the mute state of the strip." cmd:""`
|
Mute StripMuteCmd `cmd:"" help:"Get or set the mute state of the strip."`
|
||||||
Fader StripFaderCmd ` help:"Get or set the fader level of the strip." cmd:""`
|
Fader StripFaderCmd `cmd:"" help:"Get or set the fader level of the strip."`
|
||||||
Fadein StripFadeinCmd ` help:"Fade in the strip over a specified duration." cmd:""`
|
Fadein StripFadeinCmd `cmd:"" help:"Fade in the strip over a specified duration."`
|
||||||
Fadeout StripFadeoutCmd ` help:"Fade out the strip over a specified duration." cmd:""`
|
Fadeout StripFadeoutCmd `cmd:"" help:"Fade out the strip over a specified duration."`
|
||||||
Send StripSendCmd ` help:"Get or set the send level for a specific bus." cmd:""`
|
Send StripSendCmd `cmd:"" help:"Get or set the send level for a specific bus."`
|
||||||
Name StripNameCmd ` help:"Get or set the name of the strip." cmd:""`
|
Name StripNameCmd `cmd:"" help:"Get or set the name of the strip."`
|
||||||
|
|
||||||
Gate StripGateCmdGroup ` help:"Commands related to the strip gate." cmd:"gate"`
|
Gate StripGateCmdGroup `cmd:"gate" help:"Commands related to the strip gate."`
|
||||||
Eq StripEqCmdGroup ` help:"Commands related to the strip EQ." cmd:"eq"`
|
Eq StripEqCmdGroup `cmd:"eq" help:"Commands related to the strip EQ."`
|
||||||
Comp StripCompCmdGroup ` help:"Commands related to the strip compressor." cmd:"comp"`
|
Comp StripCompCmdGroup `cmd:"comp" help:"Commands related to the strip compressor."`
|
||||||
} `arg:"" help:"Control a specific strip by index."`
|
} `arg:"" help:"Control a specific strip by index."`
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ func (cmd *StripMuteCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.SetMute(strip.Index.Index, *cmd.State == "true"); err != nil {
|
if err := ctx.Client.Strip.SetMute(strip.Index.Index, *cmd.State == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set mute state: %w", err)
|
return fmt.Errorf("failed to set mute state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d mute state set to: %s\n", strip.Index.Index, *cmd.State)
|
fmt.Fprintf(ctx.Out, "Strip %d mute state set to: %s\n", strip.Index.Index, *cmd.State)
|
||||||
@@ -99,7 +99,12 @@ func (cmd *StripFadeinCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d fade-in complete. Final level: %.2f dB\n", strip.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d fade-in complete. Final level: %.2f dB\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,7 +140,12 @@ func (cmd *StripFadeoutCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
time.Sleep(stepDuration)
|
time.Sleep(stepDuration)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d fade-out complete. Final level: %.2f dB\n", strip.Index.Index, cmd.Target)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d fade-out complete. Final level: %.2f dB\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.Target,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -155,18 +165,34 @@ func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get send level: %w", err)
|
return fmt.Errorf("failed to get send level: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d send %d level: %.2f dB\n", strip.Index.Index, cmd.SendIndex, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d send %d level: %.2f dB\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.SendIndex,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.SetSendLevel(strip.Index.Index, cmd.SendIndex, *cmd.Level); err != nil {
|
if err := ctx.Client.Strip.SetSendLevel(
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.SendIndex,
|
||||||
|
*cmd.Level,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set send level: %w", err)
|
return fmt.Errorf("failed to set send level: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d send %d level set to: %.2f dB\n", strip.Index.Index, cmd.SendIndex, *cmd.Level)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d send %d level set to: %.2f dB\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
cmd.SendIndex,
|
||||||
|
*cmd.Level,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripNameCmd defines the command for getting or setting the name of a strip, allowing users to assign custom names to strips for easier identification and organization.
|
// StripNameCmd defines the command for getting or setting the name of a strip, allowing users to assign custom names to strips for easier identification and organisation.
|
||||||
type StripNameCmd struct {
|
type StripNameCmd struct {
|
||||||
Name *string `arg:"" help:"The name to set for the strip." optional:""`
|
Name *string `arg:"" help:"The name to set for the strip." optional:""`
|
||||||
}
|
}
|
||||||
@@ -191,13 +217,13 @@ func (cmd *StripNameCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
|
|
||||||
// StripGateCmdGroup defines the command group for controlling the gate settings of a strip, including commands for getting and setting the gate on/off state, mode, threshold, range, attack time, hold time, and release time.
|
// StripGateCmdGroup defines the command group for controlling the gate settings of a strip, including commands for getting and setting the gate on/off state, mode, threshold, range, attack time, hold time, and release time.
|
||||||
type StripGateCmdGroup struct {
|
type StripGateCmdGroup struct {
|
||||||
On StripGateOnCmd `help:"Get or set the gate on/off state of the strip." cmd:""`
|
On StripGateOnCmd `cmd:"" help:"Get or set the gate on/off state of the strip."`
|
||||||
Mode StripGateModeCmd `help:"Get or set the gate mode of the strip." cmd:""`
|
Mode StripGateModeCmd `cmd:"" help:"Get or set the gate mode of the strip."`
|
||||||
Threshold StripGateThresholdCmd `help:"Get or set the gate threshold of the strip." cmd:""`
|
Threshold StripGateThresholdCmd `cmd:"" help:"Get or set the gate threshold of the strip."`
|
||||||
Range StripGateRangeCmd `help:"Get or set the gate range of the strip." cmd:""`
|
Range StripGateRangeCmd `cmd:"" help:"Get or set the gate range of the strip."`
|
||||||
Attack StripGateAttackCmd `help:"Get or set the gate attack time of the strip." cmd:""`
|
Attack StripGateAttackCmd `cmd:"" help:"Get or set the gate attack time of the strip."`
|
||||||
Hold StripGateHoldCmd `help:"Get or set the gate hold time of the strip." cmd:""`
|
Hold StripGateHoldCmd `cmd:"" help:"Get or set the gate hold time of the strip."`
|
||||||
Release StripGateReleaseCmd `help:"Get or set the gate release time of the strip." cmd:""`
|
Release StripGateReleaseCmd `cmd:"" help:"Get or set the gate release time of the strip."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripGateOnCmd defines the command for getting or setting the gate on/off state of a strip, allowing users to enable or disable the gate effect on the strip.
|
// StripGateOnCmd defines the command for getting or setting the gate on/off state of a strip, allowing users to enable or disable the gate effect on the strip.
|
||||||
@@ -216,7 +242,7 @@ func (cmd *StripGateOnCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Gate.SetOn(strip.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Strip.Gate.SetOn(strip.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set gate state: %w", err)
|
return fmt.Errorf("failed to set gate state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
fmt.Fprintf(ctx.Out, "Strip %d gate state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
||||||
@@ -265,7 +291,12 @@ func (cmd *StripGateThresholdCmd) Run(ctx *context, strip *StripCmdGroup) error
|
|||||||
if err := ctx.Client.Strip.Gate.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
if err := ctx.Client.Strip.Gate.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
||||||
return fmt.Errorf("failed to set gate threshold: %w", err)
|
return fmt.Errorf("failed to set gate threshold: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate threshold set to: %.2f\n", strip.Index.Index, *cmd.Threshold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d gate threshold set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Threshold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +342,12 @@ func (cmd *StripGateAttackCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Gate.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
if err := ctx.Client.Strip.Gate.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
||||||
return fmt.Errorf("failed to set gate attack time: %w", err)
|
return fmt.Errorf("failed to set gate attack time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate attack time set to: %.2f ms\n", strip.Index.Index, *cmd.Attack)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d gate attack time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Attack,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -357,20 +393,25 @@ func (cmd *StripGateReleaseCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Gate.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
if err := ctx.Client.Strip.Gate.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
||||||
return fmt.Errorf("failed to set gate release time: %w", err)
|
return fmt.Errorf("failed to set gate release time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d gate release time set to: %.2f ms\n", strip.Index.Index, *cmd.Release)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d gate release time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Release,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripEqCmdGroup defines the command group for controlling the EQ settings of a strip, including commands for getting and setting the EQ on/off state and parameters for each EQ band such as gain, frequency, Q factor, and type.
|
// StripEqCmdGroup defines the command group for controlling the EQ settings of a strip, including commands for getting and setting the EQ on/off state and parameters for each EQ band such as gain, frequency, Q factor, and type.
|
||||||
type StripEqCmdGroup struct {
|
type StripEqCmdGroup struct {
|
||||||
On StripEqOnCmd `help:"Get or set the EQ on/off state of the strip." cmd:""`
|
On StripEqOnCmd `cmd:"" help:"Get or set the EQ on/off state of the strip."`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band *int `arg:"" help:"The EQ band number." optional:""`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain StripEqBandGainCmd `help:"Get or set the gain of the EQ band." cmd:""`
|
Gain StripEqBandGainCmd `cmd:"" help:"Get or set the gain of the EQ band."`
|
||||||
Freq StripEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:""`
|
Freq StripEqBandFreqCmd `cmd:"" help:"Get or set the frequency of the EQ band."`
|
||||||
Q StripEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:""`
|
Q StripEqBandQCmd `cmd:"" help:"Get or set the Q factor of the EQ band."`
|
||||||
Type StripEqBandTypeCmd `help:"Get or set the type of the EQ band." cmd:""`
|
Type StripEqBandTypeCmd `cmd:"" help:"Get or set the type of the EQ band."`
|
||||||
} `help:"Commands for controlling a specific EQ band of the strip." arg:""`
|
} ` help:"Commands for controlling a specific EQ band of the strip." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided EQ band number is valid (between 1 and 4) and returns an error if it is not.
|
// Validate checks if the provided EQ band number is valid (between 1 and 4) and returns an error if it is not.
|
||||||
@@ -401,7 +442,7 @@ func (cmd *StripEqOnCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetOn(strip.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Strip.Eq.SetOn(strip.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ state: %w", err)
|
return fmt.Errorf("failed to set EQ state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
fmt.Fprintf(ctx.Out, "Strip %d EQ state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
||||||
@@ -414,40 +455,74 @@ type StripEqBandGainCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandGainCmd command, either retrieving the current gain of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandGainCmd command, either retrieving the current gain of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandGainCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandGainCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Gain == nil {
|
if cmd.Gain == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Gain(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Gain(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band gain: %w", err)
|
return fmt.Errorf("failed to get EQ band gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d gain: %.2f\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d gain: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetGain(strip.Index.Index, *stripEq.Band.Band, *cmd.Gain); err != nil {
|
if err := ctx.Client.Strip.Eq.SetGain(
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Gain,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band gain: %w", err)
|
return fmt.Errorf("failed to set EQ band gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d gain set to: %.2f\n", strip.Index.Index, *stripEq.Band.Band, *cmd.Gain)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d gain set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Gain,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripEqBandFreqCmd defines the command for getting or setting the frequency of a specific EQ band on a strip, allowing users to adjust the center frequency of the band in hertz (Hz).
|
// StripEqBandFreqCmd defines the command for getting or setting the frequency of a specific EQ band on a strip, allowing users to adjust the centre frequency of the band in hertz (Hz).
|
||||||
type StripEqBandFreqCmd struct {
|
type StripEqBandFreqCmd struct {
|
||||||
Freq *float64 `arg:"" help:"The frequency to set for the EQ band (in Hz)." optional:""`
|
Freq *float64 `arg:"" help:"The frequency to set for the EQ band (in Hz)." optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandFreqCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandFreqCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Freq == nil {
|
if cmd.Freq == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Frequency(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Frequency(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band frequency: %w", err)
|
return fmt.Errorf("failed to get EQ band frequency: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d frequency: %.2f Hz\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d frequency: %.2f Hz\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetFrequency(strip.Index.Index, *stripEq.Band.Band, *cmd.Freq); err != nil {
|
if err := ctx.Client.Strip.Eq.SetFrequency(
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Freq,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band frequency: %w", err)
|
return fmt.Errorf("failed to set EQ band frequency: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(
|
fmt.Fprintf(
|
||||||
@@ -466,20 +541,36 @@ type StripEqBandQCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandQCmd command, either retrieving the current Q factor of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandQCmd command, either retrieving the current Q factor of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandQCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandQCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Q(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Q(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band Q factor: %w", err)
|
return fmt.Errorf("failed to get EQ band Q factor: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d Q factor: %.2f\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d Q factor: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetQ(strip.Index.Index, *stripEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.Strip.Eq.SetQ(strip.Index.Index, *stripEq.Band.Band, *cmd.Q); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band Q factor: %w", err)
|
return fmt.Errorf("failed to set EQ band Q factor: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d Q factor set to: %.2f\n", strip.Index.Index, *stripEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d Q factor set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Q,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -489,34 +580,54 @@ type StripEqBandTypeCmd struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripEqBandTypeCmd command, either retrieving the current type of the specified EQ band on the strip or setting it based on the provided argument.
|
// Run executes the StripEqBandTypeCmd command, either retrieving the current type of the specified EQ band on the strip or setting it based on the provided argument.
|
||||||
func (cmd *StripEqBandTypeCmd) Run(ctx *context, strip *StripCmdGroup, stripEq *StripEqCmdGroup) error {
|
func (cmd *StripEqBandTypeCmd) Run(
|
||||||
|
ctx *context,
|
||||||
|
strip *StripCmdGroup,
|
||||||
|
stripEq *StripEqCmdGroup,
|
||||||
|
) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.Strip.Eq.Type(strip.Index.Index, *stripEq.Band.Band)
|
resp, err := ctx.Client.Strip.Eq.Type(strip.Index.Index, *stripEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to get EQ band type: %w", err)
|
return fmt.Errorf("failed to get EQ band type: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d type: %s\n", strip.Index.Index, *stripEq.Band.Band, resp)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d type: %s\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
resp,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Eq.SetType(strip.Index.Index, *stripEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.Strip.Eq.SetType(
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Type,
|
||||||
|
); err != nil {
|
||||||
return fmt.Errorf("failed to set EQ band type: %w", err)
|
return fmt.Errorf("failed to set EQ band type: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d EQ band %d type set to: %s\n", strip.Index.Index, *stripEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d EQ band %d type set to: %s\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*stripEq.Band.Band,
|
||||||
|
*cmd.Type,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripCompCmdGroup defines the command group for controlling the compressor settings of a strip, including commands for getting and setting the compressor on/off state, mode, threshold, ratio, mix, makeup gain, attack time, hold time, and release time.
|
// StripCompCmdGroup defines the command group for controlling the compressor settings of a strip, including commands for getting and setting the compressor on/off state, mode, threshold, ratio, mix, makeup gain, attack time, hold time, and release time.
|
||||||
type StripCompCmdGroup struct {
|
type StripCompCmdGroup struct {
|
||||||
On StripCompOnCmd `help:"Get or set the compressor on/off state of the strip." cmd:""`
|
On StripCompOnCmd `cmd:"" help:"Get or set the compressor on/off state of the strip."`
|
||||||
Mode StripCompModeCmd `help:"Get or set the compressor mode of the strip." cmd:""`
|
Mode StripCompModeCmd `cmd:"" help:"Get or set the compressor mode of the strip."`
|
||||||
Threshold StripCompThresholdCmd `help:"Get or set the compressor threshold of the strip." cmd:""`
|
Threshold StripCompThresholdCmd `cmd:"" help:"Get or set the compressor threshold of the strip."`
|
||||||
Ratio StripCompRatioCmd `help:"Get or set the compressor ratio of the strip." cmd:""`
|
Ratio StripCompRatioCmd `cmd:"" help:"Get or set the compressor ratio of the strip."`
|
||||||
Mix StripCompMixCmd `help:"Get or set the compressor mix of the strip." cmd:""`
|
Mix StripCompMixCmd `cmd:"" help:"Get or set the compressor mix of the strip."`
|
||||||
Makeup StripCompMakeupCmd `help:"Get or set the compressor makeup gain of the strip." cmd:""`
|
Makeup StripCompMakeupCmd `cmd:"" help:"Get or set the compressor makeup gain of the strip."`
|
||||||
Attack StripCompAttackCmd `help:"Get or set the compressor attack time of the strip." cmd:""`
|
Attack StripCompAttackCmd `cmd:"" help:"Get or set the compressor attack time of the strip."`
|
||||||
Hold StripCompHoldCmd `help:"Get or set the compressor hold time of the strip." cmd:""`
|
Hold StripCompHoldCmd `cmd:"" help:"Get or set the compressor hold time of the strip."`
|
||||||
Release StripCompReleaseCmd `help:"Get or set the compressor release time of the strip." cmd:""`
|
Release StripCompReleaseCmd `cmd:"" help:"Get or set the compressor release time of the strip."`
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripCompOnCmd defines the command for getting or setting the compressor on/off state of a strip, allowing users to enable or disable the compressor effect on the strip.
|
// StripCompOnCmd defines the command for getting or setting the compressor on/off state of a strip, allowing users to enable or disable the compressor effect on the strip.
|
||||||
@@ -535,7 +646,7 @@ func (cmd *StripCompOnCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Strip.Comp.SetOn(strip.Index.Index, *cmd.Enable == "true"); err != nil {
|
if err := ctx.Client.Strip.Comp.SetOn(strip.Index.Index, *cmd.Enable == trueStr); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor state: %w", err)
|
return fmt.Errorf("failed to set compressor state: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
fmt.Fprintf(ctx.Out, "Strip %d compressor state set to: %s\n", strip.Index.Index, *cmd.Enable)
|
||||||
@@ -584,7 +695,12 @@ func (cmd *StripCompThresholdCmd) Run(ctx *context, strip *StripCmdGroup) error
|
|||||||
if err := ctx.Client.Strip.Comp.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
if err := ctx.Client.Strip.Comp.SetThreshold(strip.Index.Index, *cmd.Threshold); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor threshold: %w", err)
|
return fmt.Errorf("failed to set compressor threshold: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor threshold set to: %.2f\n", strip.Index.Index, *cmd.Threshold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor threshold set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Threshold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -653,7 +769,12 @@ func (cmd *StripCompMakeupCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetMakeup(strip.Index.Index, *cmd.Makeup); err != nil {
|
if err := ctx.Client.Strip.Comp.SetMakeup(strip.Index.Index, *cmd.Makeup); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor makeup gain: %w", err)
|
return fmt.Errorf("failed to set compressor makeup gain: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor makeup gain set to: %.2f\n", strip.Index.Index, *cmd.Makeup)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor makeup gain set to: %.2f\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Makeup,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -676,7 +797,12 @@ func (cmd *StripCompAttackCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
if err := ctx.Client.Strip.Comp.SetAttack(strip.Index.Index, *cmd.Attack); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor attack time: %w", err)
|
return fmt.Errorf("failed to set compressor attack time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor attack time set to: %.2f ms\n", strip.Index.Index, *cmd.Attack)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor attack time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Attack,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -699,7 +825,12 @@ func (cmd *StripCompHoldCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetHold(strip.Index.Index, *cmd.Hold); err != nil {
|
if err := ctx.Client.Strip.Comp.SetHold(strip.Index.Index, *cmd.Hold); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor hold time: %w", err)
|
return fmt.Errorf("failed to set compressor hold time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor hold time set to: %.2f ms\n", strip.Index.Index, *cmd.Hold)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor hold time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Hold,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -722,6 +853,11 @@ func (cmd *StripCompReleaseCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
if err := ctx.Client.Strip.Comp.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
if err := ctx.Client.Strip.Comp.SetRelease(strip.Index.Index, *cmd.Release); err != nil {
|
||||||
return fmt.Errorf("failed to set compressor release time: %w", err)
|
return fmt.Errorf("failed to set compressor release time: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Strip %d compressor release time set to: %.2f ms\n", strip.Index.Index, *cmd.Release)
|
fmt.Fprintf(
|
||||||
|
ctx.Out,
|
||||||
|
"Strip %d compressor release time set to: %.2f ms\n",
|
||||||
|
strip.Index.Index,
|
||||||
|
*cmd.Release,
|
||||||
|
)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
22
go.mod
22
go.mod
@@ -1,35 +1,37 @@
|
|||||||
module github.com/onyx-and-iris/xair-cli
|
module github.com/onyx-and-iris/xair-cli
|
||||||
|
|
||||||
go 1.25
|
go 1.25.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/alecthomas/kong v1.14.0
|
github.com/alecthomas/kong v1.14.0
|
||||||
github.com/charmbracelet/log v0.4.2
|
github.com/alecthomas/mango-kong v0.1.0
|
||||||
|
github.com/charmbracelet/log v1.0.0
|
||||||
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5
|
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5
|
||||||
github.com/jotaen/kong-completion v0.0.11
|
github.com/jotaen/kong-completion v0.0.12
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||||
github.com/charmbracelet/colorprofile v0.4.1 // indirect
|
github.com/charmbracelet/colorprofile v0.4.3 // indirect
|
||||||
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
||||||
github.com/charmbracelet/x/ansi v0.11.6 // indirect
|
github.com/charmbracelet/x/ansi v0.11.6 // indirect
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
|
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
|
||||||
github.com/charmbracelet/x/term v0.2.2 // indirect
|
github.com/charmbracelet/x/term v0.2.2 // indirect
|
||||||
github.com/clipperhouse/displaywidth v0.9.0 // indirect
|
github.com/clipperhouse/displaywidth v0.11.0 // indirect
|
||||||
github.com/clipperhouse/stringish v0.1.1 // indirect
|
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
|
||||||
github.com/clipperhouse/uax29/v2 v2.6.0 // indirect
|
|
||||||
github.com/go-logfmt/logfmt v0.6.1 // indirect
|
github.com/go-logfmt/logfmt v0.6.1 // indirect
|
||||||
github.com/hashicorp/errwrap v1.1.0 // indirect
|
github.com/hashicorp/errwrap v1.1.0 // indirect
|
||||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||||
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
|
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.19 // indirect
|
github.com/mattn/go-runewidth v0.0.21 // indirect
|
||||||
|
github.com/muesli/mango v0.2.0 // indirect
|
||||||
|
github.com/muesli/roff v0.1.0 // indirect
|
||||||
github.com/muesli/termenv v0.16.0 // indirect
|
github.com/muesli/termenv v0.16.0 // indirect
|
||||||
github.com/posener/complete v1.2.3 // indirect
|
github.com/posener/complete v1.2.3 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/riywo/loginshell v0.0.0-20200815045211-7d26008be1ab // indirect
|
github.com/riywo/loginshell v0.0.0-20200815045211-7d26008be1ab // indirect
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||||
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect
|
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 // indirect
|
||||||
golang.org/x/sys v0.41.0 // indirect
|
golang.org/x/sys v0.42.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
40
go.sum
40
go.sum
@@ -2,28 +2,28 @@ github.com/alecthomas/assert/v2 v2.11.0 h1:2Q9r3ki8+JYXvGsDyBXwH3LcJ+WK5D0gc5E8v
|
|||||||
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
github.com/alecthomas/assert/v2 v2.11.0/go.mod h1:Bze95FyfUr7x34QZrjL+XP+0qgp/zg8yS+TtBj1WA3k=
|
||||||
github.com/alecthomas/kong v1.14.0 h1:gFgEUZWu2ZmZ+UhyZ1bDhuutbKN1nTtJTwh19Wsn21s=
|
github.com/alecthomas/kong v1.14.0 h1:gFgEUZWu2ZmZ+UhyZ1bDhuutbKN1nTtJTwh19Wsn21s=
|
||||||
github.com/alecthomas/kong v1.14.0/go.mod h1:wrlbXem1CWqUV5Vbmss5ISYhsVPkBb1Yo7YKJghju2I=
|
github.com/alecthomas/kong v1.14.0/go.mod h1:wrlbXem1CWqUV5Vbmss5ISYhsVPkBb1Yo7YKJghju2I=
|
||||||
|
github.com/alecthomas/mango-kong v0.1.0 h1:iFVfP1k1K4qpml3JUQmD5I8MCQYfIvsD9mRdrw7jJC4=
|
||||||
|
github.com/alecthomas/mango-kong v0.1.0/go.mod h1:t+TYVdsONUolf/BwVcm+15eqcdAj15h4Qe9MMFAwwT4=
|
||||||
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
|
github.com/alecthomas/repr v0.5.2 h1:SU73FTI9D1P5UNtvseffFSGmdNci/O6RsqzeXJtP0Qs=
|
||||||
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
github.com/alecthomas/repr v0.5.2/go.mod h1:Fr0507jx4eOXV7AlPV6AVZLYrLIuIeSOWtW57eE/O/4=
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
|
||||||
github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk=
|
github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
|
||||||
github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=
|
github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
|
||||||
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
|
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
|
||||||
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
|
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
|
||||||
github.com/charmbracelet/log v0.4.2 h1:hYt8Qj6a8yLnvR+h7MwsJv/XvmBJXiueUcI3cIxsyig=
|
github.com/charmbracelet/log v1.0.0 h1:HVVVMmfOorfj3BA9i8X8UL69Hoz9lI0PYwXfJvOdRc4=
|
||||||
github.com/charmbracelet/log v0.4.2/go.mod h1:qifHGX/tc7eluv2R6pWIpyHDDrrb/AG71Pf2ysQu5nw=
|
github.com/charmbracelet/log v1.0.0/go.mod h1:uYgY3SmLpwJWxmlrPwXvzVYujxis1vAKRV/0VQB7yWA=
|
||||||
github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
|
github.com/charmbracelet/x/ansi v0.11.6 h1:GhV21SiDz/45W9AnV2R61xZMRri5NlLnl6CVF7ihZW8=
|
||||||
github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
|
github.com/charmbracelet/x/ansi v0.11.6/go.mod h1:2JNYLgQUsyqaiLovhU2Rv/pb8r6ydXKS3NIttu3VGZQ=
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
|
github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
|
github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
|
||||||
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
|
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
|
||||||
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
|
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
|
||||||
github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA=
|
github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8=
|
||||||
github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA=
|
github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0=
|
||||||
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
|
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
|
||||||
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
|
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
|
||||||
github.com/clipperhouse/uax29/v2 v2.6.0 h1:z0cDbUV+aPASdFb2/ndFnS9ts/WNXgTNNGFoKXuhpos=
|
|
||||||
github.com/clipperhouse/uax29/v2 v2.6.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
@@ -41,14 +41,18 @@ github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUq
|
|||||||
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
|
github.com/hexops/gotextdiff v1.0.3/go.mod h1:pSWU5MAI3yDq+fZBTazCSJysOMbxWL1BSow5/V2vxeg=
|
||||||
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5 h1:fqwINudmUrvGCuw+e3tedZ2UJ0hklSw6t8UPomctKyQ=
|
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5 h1:fqwINudmUrvGCuw+e3tedZ2UJ0hklSw6t8UPomctKyQ=
|
||||||
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5/go.mod h1:lqMjoCs0y0GoRRujSPZRBaGb4c5ER6TfkFKSClxkMbY=
|
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5/go.mod h1:lqMjoCs0y0GoRRujSPZRBaGb4c5ER6TfkFKSClxkMbY=
|
||||||
github.com/jotaen/kong-completion v0.0.11 h1:ZRyQt+IwjcAObbiyxJZ3YR7r/o/f6HYidTK1+7YNtnE=
|
github.com/jotaen/kong-completion v0.0.12 h1:a9jmSaWgkdAUMQT583UxLIJrO9tfdSmYqcIxrBByjPc=
|
||||||
github.com/jotaen/kong-completion v0.0.11/go.mod h1:dyIG20e3qq128SUBtF8jzI7YtkfzjWMlgbqkAJd6xHQ=
|
github.com/jotaen/kong-completion v0.0.12/go.mod h1:dyIG20e3qq128SUBtF8jzI7YtkfzjWMlgbqkAJd6xHQ=
|
||||||
github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=
|
github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=
|
||||||
github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
|
github.com/mattn/go-runewidth v0.0.21 h1:jJKAZiQH+2mIinzCJIaIG9Be1+0NR+5sz/lYEEjdM8w=
|
||||||
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
github.com/mattn/go-runewidth v0.0.21/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||||
|
github.com/muesli/mango v0.2.0 h1:iNNc0c5VLQ6fsMgAqGQofByNUBH2Q2nEbD6TaI+5yyQ=
|
||||||
|
github.com/muesli/mango v0.2.0/go.mod h1:5XFpbC8jY5UUv89YQciiXNlbi+iJgt29VDC5xbzrLL4=
|
||||||
|
github.com/muesli/roff v0.1.0 h1:YD0lalCotmYuF5HhZliKWlIx7IEhiXeSfq7hNjFqGF8=
|
||||||
|
github.com/muesli/roff v0.1.0/go.mod h1:pjAHQM9hdUUwm/krAfrLGgJkXJ+YuhtsfZ42kieB2Ig=
|
||||||
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
|
github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
|
||||||
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
|
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
@@ -65,11 +69,11 @@ github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu
|
|||||||
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
||||||
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 h1:Z/6YuSHTLOHfNFdb8zVZomZr7cqNgTJvA8+Qz75D8gU=
|
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90 h1:jiDhWWeC7jfWqR9c/uplMOqJ0sbNlNWv0UkzE0vX1MA=
|
||||||
golang.org/x/exp v0.0.0-20260112195511-716be5621a96/go.mod h1:nzimsREAkjBCIEFtHiYkrJyT+2uy9YZJB7H1k68CXZU=
|
golang.org/x/exp v0.0.0-20260312153236-7ab1446f8b90/go.mod h1:xE1HEv6b+1SCZ5/uscMRjUBKtIxworgEcEi+/n9NQDQ=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.41.0 h1:Ivj+2Cp/ylzLiEU89QhWblYnOE9zerudt9Ftecq2C6k=
|
golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo=
|
||||||
golang.org/x/sys v0.41.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
|
golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ package xair
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// Bus represents the bus parameters of the mixer.
|
||||||
type Bus struct {
|
type Bus struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
Eq *Eq
|
Eq *Eq
|
||||||
Comp *Comp
|
Comp *Comp
|
||||||
}
|
}
|
||||||
|
|
||||||
// newBus creates a new Bus instance
|
// newBus creates a new Bus instance.
|
||||||
func newBus(c *Client) *Bus {
|
func newBus(c *client) *Bus {
|
||||||
return &Bus{
|
return &Bus{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: c.addressMap["bus"],
|
baseAddress: c.addressMap["bus"],
|
||||||
@@ -19,7 +20,7 @@ func newBus(c *Client) *Bus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mute requests the current mute status for a bus
|
// Mute requests the current mute status for a bus.
|
||||||
func (b *Bus) Mute(bus int) (bool, error) {
|
func (b *Bus) Mute(bus int) (bool, error) {
|
||||||
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/on"
|
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/on"
|
||||||
err := b.client.SendMessage(address)
|
err := b.client.SendMessage(address)
|
||||||
@@ -38,7 +39,7 @@ func (b *Bus) Mute(bus int) (bool, error) {
|
|||||||
return val == 0, nil
|
return val == 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMute sets the mute status for a specific bus (1-based indexing)
|
// SetMute sets the mute status for a specific bus (1-based indexing).
|
||||||
func (b *Bus) SetMute(bus int, muted bool) error {
|
func (b *Bus) SetMute(bus int, muted bool) error {
|
||||||
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/on"
|
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/on"
|
||||||
var value int32
|
var value int32
|
||||||
@@ -48,7 +49,7 @@ func (b *Bus) SetMute(bus int, muted bool) error {
|
|||||||
return b.client.SendMessage(address, value)
|
return b.client.SendMessage(address, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fader requests the current fader level for a bus
|
// Fader requests the current fader level for a bus.
|
||||||
func (b *Bus) Fader(bus int) (float64, error) {
|
func (b *Bus) Fader(bus int) (float64, error) {
|
||||||
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/fader"
|
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/fader"
|
||||||
err := b.client.SendMessage(address)
|
err := b.client.SendMessage(address)
|
||||||
@@ -68,18 +69,18 @@ func (b *Bus) Fader(bus int) (float64, error) {
|
|||||||
return mustDbFrom(float64(val)), nil
|
return mustDbFrom(float64(val)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetFader sets the fader level for a specific bus (1-based indexing)
|
// SetFader sets the fader level for a specific bus (1-based indexing).
|
||||||
func (b *Bus) SetFader(bus int, level float64) error {
|
func (b *Bus) SetFader(bus int, level float64) error {
|
||||||
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/fader"
|
address := fmt.Sprintf(b.baseAddress, bus) + "/mix/fader"
|
||||||
return b.client.SendMessage(address, float32(mustDbInto(level)))
|
return b.client.SendMessage(address, float32(mustDbInto(level)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name requests the name for a specific bus
|
// Name requests the name for a specific bus.
|
||||||
func (b *Bus) Name(bus int) (string, error) {
|
func (b *Bus) Name(bus int) (string, error) {
|
||||||
address := fmt.Sprintf(b.baseAddress, bus) + "/config/name"
|
address := fmt.Sprintf(b.baseAddress, bus) + "/config/name"
|
||||||
err := b.client.SendMessage(address)
|
err := b.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to send bus name request: %v", err)
|
return "", fmt.Errorf("failed to send bus name request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := b.client.ReceiveMessage()
|
msg, err := b.client.ReceiveMessage()
|
||||||
@@ -93,7 +94,7 @@ func (b *Bus) Name(bus int) (string, error) {
|
|||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetName sets the name for a specific bus
|
// SetName sets the name for a specific bus.
|
||||||
func (b *Bus) SetName(bus int, name string) error {
|
func (b *Bus) SetName(bus int, name string) error {
|
||||||
address := fmt.Sprintf(b.baseAddress, bus) + "/config/name"
|
address := fmt.Sprintf(b.baseAddress, bus) + "/config/name"
|
||||||
return b.client.SendMessage(address, name)
|
return b.client.SendMessage(address, name)
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
// Package xair provides a client for controlling XAir and X32 mixers using OSC messages.
|
||||||
package xair
|
package xair
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@@ -5,17 +6,12 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/charmbracelet/log"
|
"github.com/charmbracelet/log"
|
||||||
|
|
||||||
"github.com/hypebeast/go-osc/osc"
|
"github.com/hypebeast/go-osc/osc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
// XAirClient is a client for controlling XAir mixers.
|
||||||
*engine
|
type XAirClient struct { // nolint: revive
|
||||||
}
|
client
|
||||||
|
|
||||||
// XAirClient is a client for controlling XAir mixers
|
|
||||||
type XAirClient struct {
|
|
||||||
Client
|
|
||||||
Main *Main
|
Main *Main
|
||||||
Strip *Strip
|
Strip *Strip
|
||||||
Bus *Bus
|
Bus *Bus
|
||||||
@@ -24,9 +20,29 @@ type XAirClient struct {
|
|||||||
DCA *DCA
|
DCA *DCA
|
||||||
}
|
}
|
||||||
|
|
||||||
// X32Client is a client for controlling X32 mixers
|
// NewXAirClient creates a new XAirClient instance with optional engine configuration.
|
||||||
type X32Client struct {
|
func NewXAirClient(mixerIP string, mixerPort int, opts ...EngineOption) (*XAirClient, error) {
|
||||||
Client
|
e, err := newEngine(mixerIP, mixerPort, kindXAir, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
c := &XAirClient{
|
||||||
|
client: client{e, InfoResponse{}},
|
||||||
|
}
|
||||||
|
c.Main = newMainStereo(&c.client)
|
||||||
|
c.Strip = newStrip(&c.client)
|
||||||
|
c.Bus = newBus(&c.client)
|
||||||
|
c.HeadAmp = newHeadAmp(&c.client)
|
||||||
|
c.Snapshot = newSnapshot(&c.client)
|
||||||
|
c.DCA = newDCA(&c.client)
|
||||||
|
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// X32Client is a client for controlling X32 mixers.
|
||||||
|
type X32Client struct { // nolint: revive
|
||||||
|
client
|
||||||
Main *Main
|
Main *Main
|
||||||
MainMono *Main
|
MainMono *Main
|
||||||
Matrix *Matrix
|
Matrix *Matrix
|
||||||
@@ -37,7 +53,7 @@ type X32Client struct {
|
|||||||
DCA *DCA
|
DCA *DCA
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewX32Client creates a new X32Client instance with optional engine configuration
|
// NewX32Client creates a new X32Client instance with optional engine configuration.
|
||||||
func NewX32Client(mixerIP string, mixerPort int, opts ...EngineOption) (*X32Client, error) {
|
func NewX32Client(mixerIP string, mixerPort int, opts ...EngineOption) (*X32Client, error) {
|
||||||
e, err := newEngine(mixerIP, mixerPort, kindX32, opts...)
|
e, err := newEngine(mixerIP, mixerPort, kindX32, opts...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -45,62 +61,50 @@ func NewX32Client(mixerIP string, mixerPort int, opts ...EngineOption) (*X32Clie
|
|||||||
}
|
}
|
||||||
|
|
||||||
c := &X32Client{
|
c := &X32Client{
|
||||||
Client: Client{e},
|
client: client{e, InfoResponse{}},
|
||||||
}
|
}
|
||||||
c.Main = newMainStereo(&c.Client)
|
c.Main = newMainStereo(&c.client)
|
||||||
c.MainMono = newMainMono(&c.Client)
|
c.MainMono = newMainMono(&c.client)
|
||||||
c.Matrix = newMatrix(&c.Client)
|
c.Matrix = newMatrix(&c.client)
|
||||||
c.Strip = newStrip(&c.Client)
|
c.Strip = newStrip(&c.client)
|
||||||
c.Bus = newBus(&c.Client)
|
c.Bus = newBus(&c.client)
|
||||||
c.HeadAmp = newHeadAmp(&c.Client)
|
c.HeadAmp = newHeadAmp(&c.client)
|
||||||
c.Snapshot = newSnapshot(&c.Client)
|
c.Snapshot = newSnapshot(&c.client)
|
||||||
c.DCA = newDCA(&c.Client)
|
c.DCA = newDCA(&c.client)
|
||||||
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewXAirClient creates a new XAirClient instance with optional engine configuration
|
type client struct {
|
||||||
func NewXAirClient(mixerIP string, mixerPort int, opts ...EngineOption) (*XAirClient, error) {
|
*engine
|
||||||
e, err := newEngine(mixerIP, mixerPort, kindXAir, opts...)
|
Info InfoResponse
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &XAirClient{
|
|
||||||
Client: Client{e},
|
|
||||||
}
|
|
||||||
c.Main = newMainStereo(&c.Client)
|
|
||||||
c.Strip = newStrip(&c.Client)
|
|
||||||
c.Bus = newBus(&c.Client)
|
|
||||||
c.HeadAmp = newHeadAmp(&c.Client)
|
|
||||||
c.Snapshot = newSnapshot(&c.Client)
|
|
||||||
c.DCA = newDCA(&c.Client)
|
|
||||||
|
|
||||||
return c, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start begins listening for messages in a goroutine
|
// StartListening begins listening for messages in a goroutine.
|
||||||
func (c *Client) StartListening() {
|
func (c *client) StartListening() {
|
||||||
go c.engine.receiveLoop()
|
go c.receiveLoop()
|
||||||
log.Debugf("Started listening on %s...", c.engine.conn.LocalAddr().String())
|
log.Debugf("Started listening on %s...", c.engine.conn.LocalAddr().String())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close stops the client and closes the connection
|
// Close stops the client and closes the connection.
|
||||||
func (c *Client) Close() {
|
func (c *client) Close() error {
|
||||||
close(c.engine.done)
|
close(c.done)
|
||||||
if c.engine.conn != nil {
|
if c.conn != nil {
|
||||||
c.engine.conn.Close()
|
if err := c.conn.Close(); err != nil {
|
||||||
|
return fmt.Errorf("failed to close connection: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendMessage sends an OSC message to the mixer using the unified connection
|
// SendMessage sends an OSC message to the mixer using the unified connection.
|
||||||
func (c *Client) SendMessage(address string, args ...any) error {
|
func (c *client) SendMessage(address string, args ...any) error {
|
||||||
return c.engine.sendToAddress(c.mixerAddr, address, args...)
|
return c.sendToAddress(c.mixerAddr, address, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReceiveMessage receives an OSC message from the mixer
|
// ReceiveMessage receives an OSC message from the mixer.
|
||||||
func (c *Client) ReceiveMessage() (*osc.Message, error) {
|
func (c *client) ReceiveMessage() (*osc.Message, error) {
|
||||||
t := time.Tick(c.engine.timeout)
|
t := time.Tick(c.timeout)
|
||||||
select {
|
select {
|
||||||
case <-t:
|
case <-t:
|
||||||
return nil, fmt.Errorf("timeout waiting for response")
|
return nil, fmt.Errorf("timeout waiting for response")
|
||||||
@@ -112,8 +116,8 @@ func (c *Client) ReceiveMessage() (*osc.Message, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestInfo requests mixer information
|
// RequestInfo requests mixer information.
|
||||||
func (c *Client) RequestInfo() (InfoResponse, error) {
|
func (c *client) RequestInfo() (InfoResponse, error) {
|
||||||
var info InfoResponse
|
var info InfoResponse
|
||||||
err := c.SendMessage("/xinfo")
|
err := c.SendMessage("/xinfo")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -124,20 +128,31 @@ func (c *Client) RequestInfo() (InfoResponse, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return info, err
|
return info, err
|
||||||
}
|
}
|
||||||
if len(msg.Arguments) >= 3 {
|
if len(msg.Arguments) == 4 {
|
||||||
info.Host = msg.Arguments[0].(string)
|
if host, ok := msg.Arguments[0].(string); ok {
|
||||||
info.Name = msg.Arguments[1].(string)
|
info.Host = host
|
||||||
info.Model = msg.Arguments[2].(string)
|
}
|
||||||
|
if name, ok := msg.Arguments[1].(string); ok {
|
||||||
|
info.Name = name
|
||||||
|
}
|
||||||
|
if model, ok := msg.Arguments[2].(string); ok {
|
||||||
|
info.Model = model
|
||||||
|
}
|
||||||
|
if firmware, ok := msg.Arguments[3].(string); ok {
|
||||||
|
info.Firmware = firmware
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
c.Info = info
|
||||||
|
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// KeepAlive sends keep-alive message (required for multi-client usage)
|
// KeepAlive sends keep-alive message (required for multi-client usage).
|
||||||
func (c *Client) KeepAlive() error {
|
func (c *client) KeepAlive() error {
|
||||||
return c.SendMessage("/xremote")
|
return c.SendMessage("/xremote")
|
||||||
}
|
}
|
||||||
|
|
||||||
// RequestStatus requests mixer status
|
// RequestStatus requests mixer status.
|
||||||
func (c *Client) RequestStatus() error {
|
func (c *client) RequestStatus() error {
|
||||||
return c.SendMessage("/status")
|
return c.SendMessage("/status")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import "fmt"
|
|||||||
|
|
||||||
// Comp represents the compressor parameters.
|
// Comp represents the compressor parameters.
|
||||||
type Comp struct {
|
type Comp struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
AddressFunc func(fmtString string, args ...any) string
|
AddressFunc func(fmtString string, args ...any) string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Factory function to create Comp instance with optional configuration
|
// Factory function to create Comp instance with optional configuration.
|
||||||
func newComp(c *Client, baseAddress string, opts ...CompOption) *Comp {
|
func newComp(c *client, baseAddress string, opts ...CompOption) *Comp {
|
||||||
comp := &Comp{
|
comp := &Comp{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: fmt.Sprintf("%s/dyn", baseAddress),
|
baseAddress: fmt.Sprintf("%s/dyn", baseAddress),
|
||||||
|
|||||||
@@ -2,20 +2,21 @@ package xair
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// DCA represents the DCA group parameters of the mixer.
|
||||||
type DCA struct {
|
type DCA struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newDCA creates a new DCA instance
|
// newDCA creates a new DCA instance.
|
||||||
func newDCA(c *Client) *DCA {
|
func newDCA(c *client) *DCA {
|
||||||
return &DCA{
|
return &DCA{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: c.addressMap["dca"],
|
baseAddress: c.addressMap["dca"],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mute requests the current mute status for a DCA group
|
// Mute requests the current mute status for a DCA group.
|
||||||
func (d *DCA) Mute(group int) (bool, error) {
|
func (d *DCA) Mute(group int) (bool, error) {
|
||||||
address := fmt.Sprintf(d.baseAddress, group) + "/on"
|
address := fmt.Sprintf(d.baseAddress, group) + "/on"
|
||||||
err := d.client.SendMessage(address)
|
err := d.client.SendMessage(address)
|
||||||
@@ -34,7 +35,7 @@ func (d *DCA) Mute(group int) (bool, error) {
|
|||||||
return val == 0, nil
|
return val == 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMute sets the mute status for a specific DCA group (1-based indexing)
|
// SetMute sets the mute status for a specific DCA group (1-based indexing).
|
||||||
func (d *DCA) SetMute(group int, muted bool) error {
|
func (d *DCA) SetMute(group int, muted bool) error {
|
||||||
address := fmt.Sprintf(d.baseAddress, group) + "/on"
|
address := fmt.Sprintf(d.baseAddress, group) + "/on"
|
||||||
var value int32
|
var value int32
|
||||||
@@ -44,7 +45,7 @@ func (d *DCA) SetMute(group int, muted bool) error {
|
|||||||
return d.client.SendMessage(address, value)
|
return d.client.SendMessage(address, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name requests the current name for a DCA group
|
// Name requests the current name for a DCA group.
|
||||||
func (d *DCA) Name(group int) (string, error) {
|
func (d *DCA) Name(group int) (string, error) {
|
||||||
address := fmt.Sprintf(d.baseAddress, group) + "/config/name"
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/name"
|
||||||
err := d.client.SendMessage(address)
|
err := d.client.SendMessage(address)
|
||||||
@@ -63,15 +64,15 @@ func (d *DCA) Name(group int) (string, error) {
|
|||||||
return name, nil
|
return name, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetName sets the name for a specific DCA group (1-based indexing)
|
// SetName sets the name for a specific DCA group (1-based indexing).
|
||||||
func (d *DCA) SetName(group int, name string) error {
|
func (d *DCA) SetName(group int, name string) error {
|
||||||
address := fmt.Sprintf(d.baseAddress, group) + "/config/name"
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/name"
|
||||||
return d.client.SendMessage(address, name)
|
return d.client.SendMessage(address, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color requests the current color for a DCA group
|
// Colour requests the current colour for a DCA group.
|
||||||
func (d *DCA) Color(group int) (int32, error) {
|
func (d *DCA) Colour(group int) (int32, error) {
|
||||||
address := fmt.Sprintf(d.baseAddress, group) + "/config/color"
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/colour"
|
||||||
err := d.client.SendMessage(address)
|
err := d.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
@@ -81,15 +82,15 @@ func (d *DCA) Color(group int) (int32, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
}
|
}
|
||||||
color, ok := msg.Arguments[0].(int32)
|
colour, ok := msg.Arguments[0].(int32)
|
||||||
if !ok {
|
if !ok {
|
||||||
return 0, fmt.Errorf("unexpected argument type for DCA color value")
|
return 0, fmt.Errorf("unexpected argument type for DCA colour value")
|
||||||
}
|
}
|
||||||
return color, nil
|
return colour, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetColor sets the color for a specific DCA group (1-based indexing)
|
// SetColor sets the colour for a specific DCA group (1-based indexing).
|
||||||
func (d *DCA) SetColor(group int, color int32) error {
|
func (d *DCA) SetColor(group int, colour int32) error {
|
||||||
address := fmt.Sprintf(d.baseAddress, group) + "/config/color"
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/colour"
|
||||||
return d.client.SendMessage(address, color)
|
return d.client.SendMessage(address, colour)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package xair
|
package xair
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"time"
|
"time"
|
||||||
@@ -26,21 +27,28 @@ type engine struct {
|
|||||||
respChan chan *osc.Message
|
respChan chan *osc.Message
|
||||||
}
|
}
|
||||||
|
|
||||||
func newEngine(mixerIP string, mixerPort int, kind mixerKind, opts ...EngineOption) (*engine, error) {
|
func newEngine(
|
||||||
|
mixerIP string,
|
||||||
|
mixerPort int,
|
||||||
|
kind mixerKind,
|
||||||
|
opts ...EngineOption,
|
||||||
|
) (*engine, error) {
|
||||||
localAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf(":%d", 0))
|
localAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf(":%d", 0))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to resolve local address: %v", err)
|
return nil, fmt.Errorf("failed to resolve local address: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
conn, err := net.ListenUDP("udp", localAddr)
|
conn, err := net.ListenUDP("udp", localAddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create UDP connection: %v", err)
|
return nil, fmt.Errorf("failed to create UDP connection: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mixerAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", mixerIP, mixerPort))
|
mixerAddr, err := net.ResolveUDPAddr("udp", fmt.Sprintf("%s:%d", mixerIP, mixerPort))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
conn.Close()
|
if err := conn.Close(); err != nil {
|
||||||
return nil, fmt.Errorf("failed to resolve mixer address: %v", err)
|
log.Errorf("failed to close UDP connection: %v", err)
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("failed to resolve mixer address: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debugf("Local UDP connection: %s ", conn.LocalAddr().String())
|
log.Debugf("Local UDP connection: %s ", conn.LocalAddr().String())
|
||||||
@@ -62,7 +70,7 @@ func newEngine(mixerIP string, mixerPort int, kind mixerKind, opts ...EngineOpti
|
|||||||
return e, nil
|
return e, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// receiveLoop handles incoming OSC messages
|
// receiveLoop handles incoming OSC messages.
|
||||||
func (e *engine) receiveLoop() {
|
func (e *engine) receiveLoop() {
|
||||||
buffer := make([]byte, 4096)
|
buffer := make([]byte, 4096)
|
||||||
|
|
||||||
@@ -72,10 +80,14 @@ func (e *engine) receiveLoop() {
|
|||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
// Set a short read deadline to prevent blocking indefinitely
|
// Set a short read deadline to prevent blocking indefinitely
|
||||||
e.conn.SetReadDeadline(time.Now().Add(100 * time.Millisecond))
|
if err := e.conn.SetReadDeadline(time.Now().Add(100 * time.Millisecond)); err != nil {
|
||||||
|
log.Errorf("Failed to set read deadline: %v", err)
|
||||||
|
continue
|
||||||
|
}
|
||||||
n, _, err := e.conn.ReadFromUDP(buffer)
|
n, _, err := e.conn.ReadFromUDP(buffer)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if netErr, ok := err.(net.Error); ok && netErr.Timeout() {
|
var netErr net.Error
|
||||||
|
if errors.As(err, &netErr) {
|
||||||
// Timeout is expected, continue loop
|
// Timeout is expected, continue loop
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -99,7 +111,7 @@ func (e *engine) receiveLoop() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseOSCMessage parses raw bytes into an OSC message with improved error handling
|
// parseOSCMessage parses raw bytes into an OSC message with improved error handling.
|
||||||
func (e *engine) parseOSCMessage(data []byte) (*osc.Message, error) {
|
func (e *engine) parseOSCMessage(data []byte) (*osc.Message, error) {
|
||||||
msg, err := e.parser.Parse(data)
|
msg, err := e.parser.Parse(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -109,7 +121,7 @@ func (e *engine) parseOSCMessage(data []byte) (*osc.Message, error) {
|
|||||||
return msg, nil
|
return msg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// sendToAddress sends an OSC message to a specific address (enables replying to different ports)
|
// sendToAddress sends an OSC message to a specific address (enables replying to different ports).
|
||||||
func (e *engine) sendToAddress(addr *net.UDPAddr, oscAddress string, args ...any) error {
|
func (e *engine) sendToAddress(addr *net.UDPAddr, oscAddress string, args ...any) error {
|
||||||
msg := osc.NewMessage(oscAddress)
|
msg := osc.NewMessage(oscAddress)
|
||||||
for _, arg := range args {
|
for _, arg := range args {
|
||||||
@@ -130,7 +142,7 @@ func (e *engine) sendToAddress(addr *net.UDPAddr, oscAddress string, args ...any
|
|||||||
|
|
||||||
data, err := msg.MarshalBinary()
|
data, err := msg.MarshalBinary()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to marshal message: %v", err)
|
return fmt.Errorf("failed to marshal message: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = e.conn.WriteToUDP(data, addr)
|
_, err = e.conn.WriteToUDP(data, addr)
|
||||||
|
|||||||
@@ -6,13 +6,13 @@ import (
|
|||||||
|
|
||||||
// Eq represents the EQ parameters.
|
// Eq represents the EQ parameters.
|
||||||
type Eq struct {
|
type Eq struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
AddressFunc func(fmtString string, args ...any) string
|
AddressFunc func(fmtString string, args ...any) string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Factory function to create Eq instance with optional configuration
|
// Factory function to create Eq instance with optional configuration.
|
||||||
func newEq(c *Client, baseAddress string, opts ...EqOption) *Eq {
|
func newEq(c *client, baseAddress string, opts ...EqOption) *Eq {
|
||||||
eq := &Eq{
|
eq := &Eq{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: fmt.Sprintf("%s/eq", baseAddress),
|
baseAddress: fmt.Sprintf("%s/eq", baseAddress),
|
||||||
@@ -55,6 +55,7 @@ func (e *Eq) SetOn(index int, on bool) error {
|
|||||||
return e.client.SendMessage(address, value)
|
return e.client.SendMessage(address, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Mode retrieves the EQ mode for a specific strip or bus (1-based indexing).
|
||||||
func (e *Eq) Mode(index int) (string, error) {
|
func (e *Eq) Mode(index int) (string, error) {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + "/mode"
|
address := e.AddressFunc(e.baseAddress, index) + "/mode"
|
||||||
err := e.client.SendMessage(address)
|
err := e.client.SendMessage(address)
|
||||||
@@ -75,6 +76,7 @@ func (e *Eq) Mode(index int) (string, error) {
|
|||||||
return possibleModes[val], nil
|
return possibleModes[val], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SetMode sets the EQ mode for a specific strip or bus (1-based indexing).
|
||||||
func (e *Eq) SetMode(index int, mode string) error {
|
func (e *Eq) SetMode(index int, mode string) error {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + "/mode"
|
address := e.AddressFunc(e.baseAddress, index) + "/mode"
|
||||||
possibleModes := []string{"peq", "geq", "teq"}
|
possibleModes := []string{"peq", "geq", "teq"}
|
||||||
@@ -82,7 +84,7 @@ func (e *Eq) SetMode(index int, mode string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Gain retrieves the gain for a specific EQ band on a strip or bus (1-based indexing).
|
// Gain retrieves the gain for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) Gain(index int, band int) (float64, error) {
|
func (e *Eq) Gain(index, band int) (float64, error) {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/g", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/g", band)
|
||||||
err := e.client.SendMessage(address)
|
err := e.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -101,13 +103,13 @@ func (e *Eq) Gain(index int, band int) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetGain sets the gain for a specific EQ band on a strip or bus (1-based indexing).
|
// SetGain sets the gain for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) SetGain(index int, band int, gain float64) error {
|
func (e *Eq) SetGain(index, band int, gain float64) error {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/g", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/g", band)
|
||||||
return e.client.SendMessage(address, float32(linSet(-15, 15, gain)))
|
return e.client.SendMessage(address, float32(linSet(-15, 15, gain)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Frequency retrieves the frequency for a specific EQ band on a strip or bus (1-based indexing).
|
// Frequency retrieves the frequency for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) Frequency(index int, band int) (float64, error) {
|
func (e *Eq) Frequency(index, band int) (float64, error) {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/f", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/f", band)
|
||||||
err := e.client.SendMessage(address)
|
err := e.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -126,13 +128,13 @@ func (e *Eq) Frequency(index int, band int) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetFrequency sets the frequency for a specific EQ band on a strip or bus (1-based indexing).
|
// SetFrequency sets the frequency for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) SetFrequency(index int, band int, frequency float64) error {
|
func (e *Eq) SetFrequency(index, band int, frequency float64) error {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/f", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/f", band)
|
||||||
return e.client.SendMessage(address, float32(logSet(20, 20000, frequency)))
|
return e.client.SendMessage(address, float32(logSet(20, 20000, frequency)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Q retrieves the Q factor for a specific EQ band on a strip or bus (1-based indexing).
|
// Q retrieves the Q factor for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) Q(index int, band int) (float64, error) {
|
func (e *Eq) Q(index, band int) (float64, error) {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/q", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/q", band)
|
||||||
err := e.client.SendMessage(address)
|
err := e.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -151,13 +153,13 @@ func (e *Eq) Q(index int, band int) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetQ sets the Q factor for a specific EQ band on a strip or bus (1-based indexing).
|
// SetQ sets the Q factor for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) SetQ(index int, band int, q float64) error {
|
func (e *Eq) SetQ(index, band int, q float64) error {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/q", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/q", band)
|
||||||
return e.client.SendMessage(address, float32(1.0-logSet(0.3, 10, q)))
|
return e.client.SendMessage(address, float32(1.0-logSet(0.3, 10, q)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Type retrieves the type for a specific EQ band on a strip or bus (1-based indexing).
|
// Type retrieves the type for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) Type(index int, band int) (string, error) {
|
func (e *Eq) Type(index, band int) (string, error) {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/type", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/type", band)
|
||||||
err := e.client.SendMessage(address)
|
err := e.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -178,7 +180,7 @@ func (e *Eq) Type(index int, band int) (string, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetType sets the type for a specific EQ band on a strip or bus (1-based indexing).
|
// SetType sets the type for a specific EQ band on a strip or bus (1-based indexing).
|
||||||
func (e *Eq) SetType(index int, band int, eqType string) error {
|
func (e *Eq) SetType(index, band int, eqType string) error {
|
||||||
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/type", band)
|
address := e.AddressFunc(e.baseAddress, index) + fmt.Sprintf("/%d/type", band)
|
||||||
possibleTypes := []string{"lcut", "lshv", "peq", "veq", "hshv", "hcut"}
|
possibleTypes := []string{"lcut", "lshv", "peq", "veq", "hshv", "hcut"}
|
||||||
return e.client.SendMessage(address, int32(indexOf(possibleTypes, eqType)))
|
return e.client.SendMessage(address, int32(indexOf(possibleTypes, eqType)))
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import "fmt"
|
|||||||
|
|
||||||
// Gate represents the gate parameters.
|
// Gate represents the gate parameters.
|
||||||
type Gate struct {
|
type Gate struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
AddressFunc func(fmtString string, args ...any) string
|
AddressFunc func(fmtString string, args ...any) string
|
||||||
}
|
}
|
||||||
|
|
||||||
// Factory function to create Gate instance with optional configuration
|
// Factory function to create Gate instance with optional configuration.
|
||||||
func newGate(c *Client, baseAddress string, opts ...GateOption) *Gate {
|
func newGate(c *client, baseAddress string, opts ...GateOption) *Gate {
|
||||||
gate := &Gate{
|
gate := &Gate{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: fmt.Sprintf("%s/gate", baseAddress),
|
baseAddress: fmt.Sprintf("%s/gate", baseAddress),
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ package xair
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// HeadAmp represents the headphone amplifier parameters of the mixer.
|
||||||
type HeadAmp struct {
|
type HeadAmp struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newHeadAmp creates a new HeadAmp instance with the provided client.
|
// newHeadAmp creates a new HeadAmp instance with the provided client.
|
||||||
func newHeadAmp(c *Client) *HeadAmp {
|
func newHeadAmp(c *client) *HeadAmp {
|
||||||
return &HeadAmp{
|
return &HeadAmp{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: c.addressMap["headamp"],
|
baseAddress: c.addressMap["headamp"],
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ package xair
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// Main represents the main output parameters of the mixer.
|
||||||
type Main struct {
|
type Main struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
Eq *Eq
|
Eq *Eq
|
||||||
Comp *Comp
|
Comp *Comp
|
||||||
}
|
}
|
||||||
|
|
||||||
// newMainStereo creates a new Main instance for stereo main output
|
// newMainStereo creates a new Main instance for stereo main output.
|
||||||
func newMainStereo(c *Client) *Main {
|
func newMainStereo(c *client) *Main {
|
||||||
addressFunc := func(fmtString string, args ...any) string {
|
addressFunc := func(fmtString string, _ ...any) string {
|
||||||
return fmtString
|
return fmtString
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -23,9 +24,9 @@ func newMainStereo(c *Client) *Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// newMainMono creates a new MainMono instance for mono main output (X32 only)
|
// newMainMono creates a new MainMono instance for mono main output (X32 only).
|
||||||
func newMainMono(c *Client) *Main {
|
func newMainMono(c *client) *Main {
|
||||||
addressFunc := func(fmtString string, args ...any) string {
|
addressFunc := func(fmtString string, _ ...any) string {
|
||||||
return fmtString
|
return fmtString
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,7 +38,7 @@ func newMainMono(c *Client) *Main {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fader requests the current main L/R fader level
|
// Fader requests the current main L/R fader level.
|
||||||
func (m *Main) Fader() (float64, error) {
|
func (m *Main) Fader() (float64, error) {
|
||||||
address := m.baseAddress + "/mix/fader"
|
address := m.baseAddress + "/mix/fader"
|
||||||
err := m.client.SendMessage(address)
|
err := m.client.SendMessage(address)
|
||||||
@@ -56,13 +57,13 @@ func (m *Main) Fader() (float64, error) {
|
|||||||
return mustDbFrom(float64(val)), nil
|
return mustDbFrom(float64(val)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetFader sets the main L/R fader level
|
// SetFader sets the main L/R fader level.
|
||||||
func (m *Main) SetFader(level float64) error {
|
func (m *Main) SetFader(level float64) error {
|
||||||
address := m.baseAddress + "/mix/fader"
|
address := m.baseAddress + "/mix/fader"
|
||||||
return m.client.SendMessage(address, float32(mustDbInto(level)))
|
return m.client.SendMessage(address, float32(mustDbInto(level)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mute requests the current main L/R mute status
|
// Mute requests the current main L/R mute status.
|
||||||
func (m *Main) Mute() (bool, error) {
|
func (m *Main) Mute() (bool, error) {
|
||||||
address := m.baseAddress + "/mix/on"
|
address := m.baseAddress + "/mix/on"
|
||||||
err := m.client.SendMessage(address)
|
err := m.client.SendMessage(address)
|
||||||
@@ -81,7 +82,7 @@ func (m *Main) Mute() (bool, error) {
|
|||||||
return val == 0, nil
|
return val == 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMute sets the main L/R mute status
|
// SetMute sets the main L/R mute status.
|
||||||
func (m *Main) SetMute(muted bool) error {
|
func (m *Main) SetMute(muted bool) error {
|
||||||
address := m.baseAddress + "/mix/on"
|
address := m.baseAddress + "/mix/on"
|
||||||
var value int32
|
var value int32
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ package xair
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// Matrix represents the matrix parameters of the mixer.
|
||||||
type Matrix struct {
|
type Matrix struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
Eq *Eq
|
Eq *Eq
|
||||||
Comp *Comp
|
Comp *Comp
|
||||||
}
|
}
|
||||||
|
|
||||||
// newMatrix creates a new Matrix instance
|
// newMatrix creates a new Matrix instance.
|
||||||
func newMatrix(c *Client) *Matrix {
|
func newMatrix(c *client) *Matrix {
|
||||||
return &Matrix{
|
return &Matrix{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: c.addressMap["matrix"],
|
baseAddress: c.addressMap["matrix"],
|
||||||
@@ -19,7 +20,7 @@ func newMatrix(c *Client) *Matrix {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fader requests the current main L/R fader level
|
// Fader requests the current main L/R fader level.
|
||||||
func (m *Matrix) Fader(index int) (float64, error) {
|
func (m *Matrix) Fader(index int) (float64, error) {
|
||||||
address := fmt.Sprintf(m.baseAddress, index) + "/mix/fader"
|
address := fmt.Sprintf(m.baseAddress, index) + "/mix/fader"
|
||||||
err := m.client.SendMessage(address)
|
err := m.client.SendMessage(address)
|
||||||
@@ -38,13 +39,13 @@ func (m *Matrix) Fader(index int) (float64, error) {
|
|||||||
return mustDbFrom(float64(val)), nil
|
return mustDbFrom(float64(val)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetFader sets the matrix fader level
|
// SetFader sets the matrix fader level.
|
||||||
func (m *Matrix) SetFader(index int, level float64) error {
|
func (m *Matrix) SetFader(index int, level float64) error {
|
||||||
address := fmt.Sprintf(m.baseAddress, index) + "/mix/fader"
|
address := fmt.Sprintf(m.baseAddress, index) + "/mix/fader"
|
||||||
return m.client.SendMessage(address, float32(mustDbInto(level)))
|
return m.client.SendMessage(address, float32(mustDbInto(level)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mute requests the current matrix mute status
|
// Mute requests the current matrix mute status.
|
||||||
func (m *Matrix) Mute(index int) (bool, error) {
|
func (m *Matrix) Mute(index int) (bool, error) {
|
||||||
address := fmt.Sprintf(m.baseAddress, index) + "/mix/on"
|
address := fmt.Sprintf(m.baseAddress, index) + "/mix/on"
|
||||||
err := m.client.SendMessage(address)
|
err := m.client.SendMessage(address)
|
||||||
@@ -63,7 +64,7 @@ func (m *Matrix) Mute(index int) (bool, error) {
|
|||||||
return val == 0, nil
|
return val == 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetMute sets the matrix mute status
|
// SetMute sets the matrix mute status.
|
||||||
func (m *Matrix) SetMute(index int, muted bool) error {
|
func (m *Matrix) SetMute(index int, muted bool) error {
|
||||||
address := fmt.Sprintf(m.baseAddress, index) + "/mix/on"
|
address := fmt.Sprintf(m.baseAddress, index) + "/mix/on"
|
||||||
var value int32
|
var value int32
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
package xair
|
package xair
|
||||||
|
|
||||||
|
// InfoResponse represents the response from the /info OSC address, containing details about the X-Air device.
|
||||||
type InfoResponse struct {
|
type InfoResponse struct {
|
||||||
Host string
|
Host string
|
||||||
Name string
|
Name string
|
||||||
Model string
|
Model string
|
||||||
|
Firmware string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,36 +2,40 @@ package xair
|
|||||||
|
|
||||||
import "time"
|
import "time"
|
||||||
|
|
||||||
|
// EngineOption defines a functional option for configuring the engine.
|
||||||
type EngineOption func(*engine)
|
type EngineOption func(*engine)
|
||||||
|
|
||||||
// WithTimeout sets the timeout duration for OSC message responses
|
// WithTimeout sets the timeout duration for OSC message responses.
|
||||||
func WithTimeout(timeout time.Duration) EngineOption {
|
func WithTimeout(timeout time.Duration) EngineOption {
|
||||||
return func(e *engine) {
|
return func(e *engine) {
|
||||||
e.timeout = timeout
|
e.timeout = timeout
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CompOption defines a functional option for configuring Comp parameters.
|
||||||
type CompOption func(*Comp)
|
type CompOption func(*Comp)
|
||||||
|
|
||||||
// WithCompAddressFunc allows customization of the OSC address formatting for Comp parameters
|
// WithCompAddressFunc allows customization of the OSC address formatting for Comp parameters.
|
||||||
func WithCompAddressFunc(f func(fmtString string, args ...any) string) CompOption {
|
func WithCompAddressFunc(f func(fmtString string, args ...any) string) CompOption {
|
||||||
return func(c *Comp) {
|
return func(c *Comp) {
|
||||||
c.AddressFunc = f
|
c.AddressFunc = f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EqOption defines a functional option for configuring Eq parameters.
|
||||||
type EqOption func(*Eq)
|
type EqOption func(*Eq)
|
||||||
|
|
||||||
// WithEqAddressFunc allows customization of the OSC address formatting for Eq parameters
|
// WithEqAddressFunc allows customization of the OSC address formatting for Eq parameters.
|
||||||
func WithEqAddressFunc(f func(fmtString string, args ...any) string) EqOption {
|
func WithEqAddressFunc(f func(fmtString string, args ...any) string) EqOption {
|
||||||
return func(e *Eq) {
|
return func(e *Eq) {
|
||||||
e.AddressFunc = f
|
e.AddressFunc = f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// GateOption defines a functional option for configuring Gate parameters.
|
||||||
type GateOption func(*Gate)
|
type GateOption func(*Gate)
|
||||||
|
|
||||||
// WithGateAddressFunc allows customization of the OSC address formatting for Gate parameters
|
// WithGateAddressFunc allows customization of the OSC address formatting for Gate parameters.
|
||||||
func WithGateAddressFunc(f func(fmtString string, args ...any) string) GateOption {
|
func WithGateAddressFunc(f func(fmtString string, args ...any) string) GateOption {
|
||||||
return func(g *Gate) {
|
return func(g *Gate) {
|
||||||
g.AddressFunc = f
|
g.AddressFunc = f
|
||||||
|
|||||||
@@ -10,14 +10,13 @@ import (
|
|||||||
"github.com/hypebeast/go-osc/osc"
|
"github.com/hypebeast/go-osc/osc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type xairParser struct {
|
type xairParser struct{}
|
||||||
}
|
|
||||||
|
|
||||||
func newParser() *xairParser {
|
func newParser() *xairParser {
|
||||||
return &xairParser{}
|
return &xairParser{}
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseOSCMessage parses raw bytes into an OSC message with improved error handling
|
// Parse parses raw bytes into an OSC message with improved error handling.
|
||||||
func (p *xairParser) Parse(data []byte) (*osc.Message, error) {
|
func (p *xairParser) Parse(data []byte) (*osc.Message, error) {
|
||||||
log.Debug("=== PARSING OSC MESSAGE BEGIN ===")
|
log.Debug("=== PARSING OSC MESSAGE BEGIN ===")
|
||||||
defer log.Debug("=== PARSING OSC MESSAGE END ===")
|
defer log.Debug("=== PARSING OSC MESSAGE END ===")
|
||||||
@@ -47,7 +46,7 @@ func (p *xairParser) Parse(data []byte) (*osc.Message, error) {
|
|||||||
return msg, nil
|
return msg, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// validateOSCData performs basic validation on OSC message data
|
// validateOSCData performs basic validation on OSC message data.
|
||||||
func (p *xairParser) validateOSCData(data []byte) error {
|
func (p *xairParser) validateOSCData(data []byte) error {
|
||||||
if len(data) < 4 {
|
if len(data) < 4 {
|
||||||
return fmt.Errorf("data too short for OSC message")
|
return fmt.Errorf("data too short for OSC message")
|
||||||
@@ -58,7 +57,7 @@ func (p *xairParser) validateOSCData(data []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractOSCAddress extracts the OSC address from the message data
|
// extractOSCAddress extracts the OSC address from the message data.
|
||||||
func (p *xairParser) extractOSCAddress(data []byte) (address string, nextPos int, err error) {
|
func (p *xairParser) extractOSCAddress(data []byte) (address string, nextPos int, err error) {
|
||||||
nullPos := bytes.IndexByte(data, 0)
|
nullPos := bytes.IndexByte(data, 0)
|
||||||
if nullPos <= 0 {
|
if nullPos <= 0 {
|
||||||
@@ -73,8 +72,11 @@ func (p *xairParser) extractOSCAddress(data []byte) (address string, nextPos int
|
|||||||
return address, nextPos, nil
|
return address, nextPos, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// extractOSCTypeTags extracts and validates OSC type tags
|
// extractOSCTypeTags extracts and validates OSC type tags.
|
||||||
func (p *xairParser) extractOSCTypeTags(data []byte, start int) (typeTags string, nextPos int, err error) {
|
func (p *xairParser) extractOSCTypeTags(
|
||||||
|
data []byte,
|
||||||
|
start int,
|
||||||
|
) (typeTags string, nextPos int, err error) { // nolint: unparam
|
||||||
if start >= len(data) {
|
if start >= len(data) {
|
||||||
return "", start, nil // No type tags available
|
return "", start, nil // No type tags available
|
||||||
}
|
}
|
||||||
@@ -97,8 +99,13 @@ func (p *xairParser) extractOSCTypeTags(data []byte, start int) (typeTags string
|
|||||||
return typeTags, nextPos, nil
|
return typeTags, nextPos, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseOSCArguments parses OSC arguments based on type tags
|
// parseOSCArguments parses OSC arguments based on type tags.
|
||||||
func (p *xairParser) parseOSCArguments(data []byte, argsStart int, typeTags string, msg *osc.Message) error {
|
func (p *xairParser) parseOSCArguments(
|
||||||
|
data []byte,
|
||||||
|
argsStart int,
|
||||||
|
typeTags string,
|
||||||
|
msg *osc.Message,
|
||||||
|
) error { // nolint: unparam
|
||||||
argData := data[argsStart:]
|
argData := data[argsStart:]
|
||||||
argNum := 0
|
argNum := 0
|
||||||
|
|
||||||
@@ -138,7 +145,7 @@ func (p *xairParser) parseOSCArguments(data []byte, argsStart int, typeTags stri
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseStringArgument parses a string argument from OSC data
|
// parseStringArgument parses a string argument from OSC data.
|
||||||
func (p *xairParser) parseStringArgument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
func (p *xairParser) parseStringArgument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
||||||
nullPos := bytes.IndexByte(data, 0)
|
nullPos := bytes.IndexByte(data, 0)
|
||||||
if nullPos < 0 {
|
if nullPos < 0 {
|
||||||
@@ -153,7 +160,7 @@ func (p *xairParser) parseStringArgument(data []byte, msg *osc.Message, argNum i
|
|||||||
return ((nullPos + 4) / 4) * 4, nil
|
return ((nullPos + 4) / 4) * 4, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseInt32Argument parses an int32 argument from OSC data
|
// parseInt32Argument parses an int32 argument from OSC data.
|
||||||
func (p *xairParser) parseInt32Argument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
func (p *xairParser) parseInt32Argument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
||||||
if len(data) < 4 {
|
if len(data) < 4 {
|
||||||
return 0, fmt.Errorf("insufficient data for int32")
|
return 0, fmt.Errorf("insufficient data for int32")
|
||||||
@@ -166,7 +173,7 @@ func (p *xairParser) parseInt32Argument(data []byte, msg *osc.Message, argNum in
|
|||||||
return 4, nil
|
return 4, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseFloat32Argument parses a float32 argument from OSC data
|
// parseFloat32Argument parses a float32 argument from OSC data.
|
||||||
func (p *xairParser) parseFloat32Argument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
func (p *xairParser) parseFloat32Argument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
||||||
if len(data) < 4 {
|
if len(data) < 4 {
|
||||||
return 0, fmt.Errorf("insufficient data for float32")
|
return 0, fmt.Errorf("insufficient data for float32")
|
||||||
@@ -179,7 +186,7 @@ func (p *xairParser) parseFloat32Argument(data []byte, msg *osc.Message, argNum
|
|||||||
return 4, nil
|
return 4, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseBlobArgument parses a blob argument from OSC data
|
// parseBlobArgument parses a blob argument from OSC data.
|
||||||
func (p *xairParser) parseBlobArgument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
func (p *xairParser) parseBlobArgument(data []byte, msg *osc.Message, argNum int) (int, error) {
|
||||||
if len(data) < 4 {
|
if len(data) < 4 {
|
||||||
return 0, fmt.Errorf("insufficient data for blob size")
|
return 0, fmt.Errorf("insufficient data for blob size")
|
||||||
@@ -203,7 +210,7 @@ func (p *xairParser) parseBlobArgument(data []byte, msg *osc.Message, argNum int
|
|||||||
return ((4 + int(size) + 3) / 4) * 4, nil
|
return ((4 + int(size) + 3) / 4) * 4, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// skipUnknownArgument skips an unknown argument type
|
// skipUnknownArgument skips an unknown argument type.
|
||||||
func (p *xairParser) skipUnknownArgument(data []byte) int {
|
func (p *xairParser) skipUnknownArgument(data []byte) int {
|
||||||
// Skip unknown types by moving 4 bytes if available
|
// Skip unknown types by moving 4 bytes if available
|
||||||
if len(data) >= 4 {
|
if len(data) >= 4 {
|
||||||
|
|||||||
@@ -2,13 +2,14 @@ package xair
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// Snapshot represents a snapshot of the mixer's state, allowing for saving and recalling settings.
|
||||||
type Snapshot struct {
|
type Snapshot struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
}
|
}
|
||||||
|
|
||||||
// newSnapshot creates a new Snapshot instance
|
// newSnapshot creates a new Snapshot instance.
|
||||||
func newSnapshot(c *Client) *Snapshot {
|
func newSnapshot(c *client) *Snapshot {
|
||||||
return &Snapshot{
|
return &Snapshot{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: c.addressMap["snapshot"],
|
baseAddress: c.addressMap["snapshot"],
|
||||||
|
|||||||
@@ -2,16 +2,17 @@ package xair
|
|||||||
|
|
||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
|
// Strip represents an input channel strip on the mixer.
|
||||||
type Strip struct {
|
type Strip struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
Gate *Gate
|
Gate *Gate
|
||||||
Eq *Eq
|
Eq *Eq
|
||||||
Comp *Comp
|
Comp *Comp
|
||||||
}
|
}
|
||||||
|
|
||||||
// newStrip creates a new Strip instance
|
// newStrip creates a new Strip instance.
|
||||||
func newStrip(c *Client) *Strip {
|
func newStrip(c *client) *Strip {
|
||||||
return &Strip{
|
return &Strip{
|
||||||
client: c,
|
client: c,
|
||||||
baseAddress: c.addressMap["strip"],
|
baseAddress: c.addressMap["strip"],
|
||||||
@@ -43,7 +44,7 @@ func (s *Strip) Mute(index int) (bool, error) {
|
|||||||
// SetMute sets the mute status of the specified strip (1-based indexing).
|
// SetMute sets the mute status of the specified strip (1-based indexing).
|
||||||
func (s *Strip) SetMute(strip int, muted bool) error {
|
func (s *Strip) SetMute(strip int, muted bool) error {
|
||||||
address := fmt.Sprintf(s.baseAddress, strip) + "/mix/on"
|
address := fmt.Sprintf(s.baseAddress, strip) + "/mix/on"
|
||||||
var value int32 = 0
|
var value int32
|
||||||
if !muted {
|
if !muted {
|
||||||
value = 1
|
value = 1
|
||||||
}
|
}
|
||||||
@@ -76,12 +77,12 @@ func (s *Strip) SetFader(strip int, level float64) error {
|
|||||||
return s.client.SendMessage(address, float32(mustDbInto(level)))
|
return s.client.SendMessage(address, float32(mustDbInto(level)))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name requests the name for a specific strip
|
// Name requests the name for a specific strip.
|
||||||
func (s *Strip) Name(strip int) (string, error) {
|
func (s *Strip) Name(strip int) (string, error) {
|
||||||
address := fmt.Sprintf(s.baseAddress, strip) + "/config/name"
|
address := fmt.Sprintf(s.baseAddress, strip) + "/config/name"
|
||||||
err := s.client.SendMessage(address)
|
err := s.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", fmt.Errorf("failed to send strip name request: %v", err)
|
return "", fmt.Errorf("failed to send strip name request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := s.client.ReceiveMessage()
|
msg, err := s.client.ReceiveMessage()
|
||||||
@@ -95,18 +96,18 @@ func (s *Strip) Name(strip int) (string, error) {
|
|||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetName sets the name for a specific strip
|
// SetName sets the name for a specific strip.
|
||||||
func (s *Strip) SetName(strip int, name string) error {
|
func (s *Strip) SetName(strip int, name string) error {
|
||||||
address := fmt.Sprintf(s.baseAddress, strip) + "/config/name"
|
address := fmt.Sprintf(s.baseAddress, strip) + "/config/name"
|
||||||
return s.client.SendMessage(address, name)
|
return s.client.SendMessage(address, name)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Color requests the color for a specific strip
|
// Colour requests the colour for a specific strip.
|
||||||
func (s *Strip) Color(strip int) (int32, error) {
|
func (s *Strip) Colour(strip int) (int32, error) {
|
||||||
address := fmt.Sprintf(s.baseAddress, strip) + "/config/color"
|
address := fmt.Sprintf(s.baseAddress, strip) + "/config/colour"
|
||||||
err := s.client.SendMessage(address)
|
err := s.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("failed to send strip color request: %v", err)
|
return 0, fmt.Errorf("failed to send strip colour request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := s.client.ReceiveMessage()
|
msg, err := s.client.ReceiveMessage()
|
||||||
@@ -115,23 +116,23 @@ func (s *Strip) Color(strip int) (int32, error) {
|
|||||||
}
|
}
|
||||||
val, ok := msg.Arguments[0].(int32)
|
val, ok := msg.Arguments[0].(int32)
|
||||||
if !ok {
|
if !ok {
|
||||||
return 0, fmt.Errorf("unexpected argument type for strip color value")
|
return 0, fmt.Errorf("unexpected argument type for strip colour value")
|
||||||
}
|
}
|
||||||
return val, nil
|
return val, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetColor sets the color for a specific strip (0-15)
|
// SetColor sets the colour for a specific strip (0-15).
|
||||||
func (s *Strip) SetColor(strip int, color int32) error {
|
func (s *Strip) SetColor(strip int, colour int32) error {
|
||||||
address := fmt.Sprintf(s.baseAddress, strip) + "/config/color"
|
address := fmt.Sprintf(s.baseAddress, strip) + "/config/colour"
|
||||||
return s.client.SendMessage(address, color)
|
return s.client.SendMessage(address, colour)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendLevel requests auxiliary send level for a send destination.
|
// SendLevel requests auxiliary send level for a send destination.
|
||||||
func (s *Strip) SendLevel(strip int, bus int) (float64, error) {
|
func (s *Strip) SendLevel(strip, bus int) (float64, error) {
|
||||||
address := fmt.Sprintf(s.baseAddress, strip) + fmt.Sprintf("/mix/%02d/level", bus)
|
address := fmt.Sprintf(s.baseAddress, strip) + fmt.Sprintf("/mix/%02d/level", bus)
|
||||||
err := s.client.SendMessage(address)
|
err := s.client.SendMessage(address)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, fmt.Errorf("failed to send strip send level request: %v", err)
|
return 0, fmt.Errorf("failed to send strip send level request: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msg, err := s.client.ReceiveMessage()
|
msg, err := s.client.ReceiveMessage()
|
||||||
@@ -146,7 +147,7 @@ func (s *Strip) SendLevel(strip int, bus int) (float64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SetSendLevel sets the auxiliary send level for a send destination.
|
// SetSendLevel sets the auxiliary send level for a send destination.
|
||||||
func (s *Strip) SetSendLevel(strip int, bus int, level float64) error {
|
func (s *Strip) SetSendLevel(strip, bus int, level float64) error {
|
||||||
address := fmt.Sprintf(s.baseAddress, strip) + fmt.Sprintf("/mix/%02d/level", bus)
|
address := fmt.Sprintf(s.baseAddress, strip) + fmt.Sprintf("/mix/%02d/level", bus)
|
||||||
return s.client.SendMessage(address, float32(mustDbInto(level)))
|
return s.client.SendMessage(address, float32(mustDbInto(level)))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,20 +2,20 @@ package xair
|
|||||||
|
|
||||||
import "math"
|
import "math"
|
||||||
|
|
||||||
func linGet(min float64, max float64, value float64) float64 {
|
func linGet(minVal, maxVal, value float64) float64 {
|
||||||
return min + (max-min)*value
|
return minVal + (maxVal-minVal)*value
|
||||||
}
|
}
|
||||||
|
|
||||||
func linSet(min float64, max float64, value float64) float64 {
|
func linSet(minVal, maxVal, value float64) float64 {
|
||||||
return (value - min) / (max - min)
|
return (value - minVal) / (maxVal - minVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func logGet(min float64, max float64, value float64) float64 {
|
func logGet(minVal, maxVal, value float64) float64 {
|
||||||
return min * math.Exp(math.Log(max/min)*value)
|
return minVal * math.Exp(math.Log(maxVal/minVal)*value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func logSet(min float64, max float64, value float64) float64 {
|
func logSet(minVal, maxVal, value float64) float64 {
|
||||||
return math.Log(value/min) / math.Log(max/min)
|
return math.Log(value/minVal) / math.Log(maxVal/minVal)
|
||||||
}
|
}
|
||||||
|
|
||||||
func mustDbInto(db float64) float64 {
|
func mustDbInto(db float64) float64 {
|
||||||
@@ -52,7 +52,7 @@ func mustDbFrom(level float64) float64 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func toFixed(num float64, precision int) float64 {
|
func toFixed(num float64, precision int) float64 { // nolint: unparam
|
||||||
output := math.Pow(10, float64(precision))
|
output := math.Pow(10, float64(precision))
|
||||||
return float64(math.Round(num*output)) / output
|
return float64(math.Round(num*output)) / output
|
||||||
}
|
}
|
||||||
|
|||||||
37
tools/generate_help.go
Normal file
37
tools/generate_help.go
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
//go:generate go run generate_help.go
|
||||||
|
|
||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
clis := []struct {
|
||||||
|
cmd string
|
||||||
|
out string
|
||||||
|
}{
|
||||||
|
{"./cmd/xair-cli/", "xair-help.md"},
|
||||||
|
{"./cmd/x32-cli/", "x32-help.md"},
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, cli := range clis {
|
||||||
|
cmdArgs := []string{"run", cli.cmd, "--help"}
|
||||||
|
helpCmd := exec.Command("go", cmdArgs...)
|
||||||
|
helpCmd.Dir = ".."
|
||||||
|
out, err := helpCmd.Output()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wrap output in markdown console code block
|
||||||
|
wrapped := append([]byte("```console\n"), out...)
|
||||||
|
wrapped = append(wrapped, []byte("\n```\n")...)
|
||||||
|
|
||||||
|
if err := os.WriteFile(cli.out, wrapped, 0o644); err != nil {
|
||||||
|
log.Fatal(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,13 +9,13 @@ Flags:
|
|||||||
-P, --port=10023 The port of the X32 device ($X32_CLI_PORT).
|
-P, --port=10023 The port of the X32 device ($X32_CLI_PORT).
|
||||||
-T, --timeout=100ms Timeout for OSC operations ($X32_CLI_TIMEOUT).
|
-T, --timeout=100ms Timeout for OSC operations ($X32_CLI_TIMEOUT).
|
||||||
-L, --loglevel="warn" Log level for the CLI ($X32_CLI_LOGLEVEL).
|
-L, --loglevel="warn" Log level for the CLI ($X32_CLI_LOGLEVEL).
|
||||||
|
--man Print man page.
|
||||||
-v, --version Print x32-cli version information and quit
|
-v, --version Print x32-cli version information and quit
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
completion (c) Generate shell completion scripts.
|
completion Generate shell completion scripts.
|
||||||
|
info Print mixer information.
|
||||||
Raw
|
raw Send raw OSC messages to the mixer.
|
||||||
raw Send raw OSC messages to the mixer.
|
|
||||||
|
|
||||||
Main
|
Main
|
||||||
main mute Get or set the mute state of the Main L/R output.
|
main mute Get or set the mute state of the Main L/R output.
|
||||||
@@ -27,90 +27,55 @@ Main
|
|||||||
main eq <band> freq Get or set the frequency of the specified EQ band.
|
main eq <band> freq Get or set the frequency of the specified EQ band.
|
||||||
main eq <band> q Get or set the Q factor of the specified EQ band.
|
main eq <band> q Get or set the Q factor of the specified EQ band.
|
||||||
main eq <band> type Get or set the type of the specified EQ band.
|
main eq <band> type Get or set the type of the specified EQ band.
|
||||||
main comp on Get or set the compressor on/off state of the Main L/R
|
main comp on Get or set the compressor on/off state of the Main L/R output.
|
||||||
output.
|
|
||||||
main comp mode Get or set the compressor mode of the Main L/R output.
|
main comp mode Get or set the compressor mode of the Main L/R output.
|
||||||
main comp threshold Get or set the compressor threshold of the Main L/R
|
main comp threshold Get or set the compressor threshold of the Main L/R output.
|
||||||
output.
|
|
||||||
main comp ratio Get or set the compressor ratio of the Main L/R output.
|
main comp ratio Get or set the compressor ratio of the Main L/R output.
|
||||||
main comp mix Get or set the compressor mix level of the Main L/R
|
main comp mix Get or set the compressor mix level of the Main L/R output.
|
||||||
output.
|
main comp makeup Get or set the compressor makeup gain of the Main L/R output.
|
||||||
main comp makeup Get or set the compressor makeup gain of the Main L/R
|
main comp attack Get or set the compressor attack time of the Main L/R output.
|
||||||
output.
|
main comp hold Get or set the compressor hold time of the Main L/R output.
|
||||||
main comp attack Get or set the compressor attack time of the Main L/R
|
main comp release Get or set the compressor release time of the Main L/R output.
|
||||||
output.
|
|
||||||
main comp hold Get or set the compressor hold time of the Main L/R
|
|
||||||
output.
|
|
||||||
main comp release Get or set the compressor release time of the Main L/R
|
|
||||||
output.
|
|
||||||
|
|
||||||
MainMono
|
MainMono
|
||||||
mainmono mute Get or set the mute state of the Main Mono output.
|
mainmono mute Get or set the mute state of the Main Mono output.
|
||||||
mainmono fader Get or set the fader level of the Main Mono output.
|
mainmono fader Get or set the fader level of the Main Mono output.
|
||||||
mainmono fadein Fade in the Main Mono output over a specified
|
mainmono fadein Fade in the Main Mono output over a specified duration.
|
||||||
duration.
|
mainmono fadeout Fade out the Main Mono output over a specified duration.
|
||||||
mainmono fadeout Fade out the Main Mono output over a specified
|
mainmono eq on Get or set the EQ on/off state of the Main Mono output.
|
||||||
duration.
|
|
||||||
mainmono eq on Get or set the EQ on/off state of the Main Mono
|
|
||||||
output.
|
|
||||||
mainmono eq <band> gain Get or set the gain of the specified EQ band.
|
mainmono eq <band> gain Get or set the gain of the specified EQ band.
|
||||||
mainmono eq <band> freq Get or set the frequency of the specified EQ band.
|
mainmono eq <band> freq Get or set the frequency of the specified EQ band.
|
||||||
mainmono eq <band> q Get or set the Q factor of the specified EQ band.
|
mainmono eq <band> q Get or set the Q factor of the specified EQ band.
|
||||||
mainmono eq <band> type Get or set the type of the specified EQ band.
|
mainmono eq <band> type Get or set the type of the specified EQ band.
|
||||||
mainmono comp on Get or set the compressor on/off state of the Main
|
mainmono comp on Get or set the compressor on/off state of the Main Mono output.
|
||||||
Mono output.
|
mainmono comp mode Get or set the compressor mode of the Main Mono output.
|
||||||
mainmono comp mode Get or set the compressor mode of the Main Mono
|
mainmono comp threshold Get or set the compressor threshold of the Main Mono output.
|
||||||
output.
|
mainmono comp ratio Get or set the compressor ratio of the Main Mono output.
|
||||||
mainmono comp threshold Get or set the compressor threshold of the Main
|
mainmono comp mix Get or set the compressor mix level of the Main Mono output.
|
||||||
Mono output.
|
mainmono comp makeup Get or set the compressor makeup gain of the Main Mono output.
|
||||||
mainmono comp ratio Get or set the compressor ratio of the Main Mono
|
mainmono comp attack Get or set the compressor attack time of the Main Mono output.
|
||||||
output.
|
mainmono comp hold Get or set the compressor hold time of the Main Mono output.
|
||||||
mainmono comp mix Get or set the compressor mix level of the Main
|
mainmono comp release Get or set the compressor release time of the Main Mono output.
|
||||||
Mono output.
|
|
||||||
mainmono comp makeup Get or set the compressor makeup gain of the Main
|
|
||||||
Mono output.
|
|
||||||
mainmono comp attack Get or set the compressor attack time of the Main
|
|
||||||
Mono output.
|
|
||||||
mainmono comp hold Get or set the compressor hold time of the Main
|
|
||||||
Mono output.
|
|
||||||
mainmono comp release Get or set the compressor release time of the Main
|
|
||||||
Mono output.
|
|
||||||
|
|
||||||
Matrix
|
Matrix
|
||||||
matrix <index> mute Get or set the mute state of the Matrix
|
matrix <index> mute Get or set the mute state of the Matrix output.
|
||||||
output.
|
matrix <index> fader Get or set the fader level of the Matrix output.
|
||||||
matrix <index> fader Get or set the fader level of the Matrix
|
matrix <index> fadein Fade in the Matrix output over a specified duration.
|
||||||
output.
|
matrix <index> fadeout Fade out the Matrix output over a specified duration.
|
||||||
matrix <index> fadein Fade in the Matrix output over a specified
|
matrix <index> eq on Get or set the EQ on/off state of the Matrix output.
|
||||||
duration.
|
|
||||||
matrix <index> fadeout Fade out the Matrix output over a specified
|
|
||||||
duration.
|
|
||||||
matrix <index> eq on Get or set the EQ on/off state of the Matrix
|
|
||||||
output.
|
|
||||||
matrix <index> eq <band> gain Get or set the gain of the specified EQ band.
|
matrix <index> eq <band> gain Get or set the gain of the specified EQ band.
|
||||||
matrix <index> eq <band> freq Get or set the frequency of the specified EQ
|
matrix <index> eq <band> freq Get or set the frequency of the specified EQ band.
|
||||||
band.
|
matrix <index> eq <band> q Get or set the Q factor of the specified EQ band.
|
||||||
matrix <index> eq <band> q Get or set the Q factor of the specified EQ
|
|
||||||
band.
|
|
||||||
matrix <index> eq <band> type Get or set the type of the specified EQ band.
|
matrix <index> eq <band> type Get or set the type of the specified EQ band.
|
||||||
matrix <index> comp on Get or set the compressor on/off state of the
|
matrix <index> comp on Get or set the compressor on/off state of the Matrix output.
|
||||||
Matrix output.
|
matrix <index> comp mode Get or set the compressor mode of the Matrix output.
|
||||||
matrix <index> comp mode Get or set the compressor mode of the Matrix
|
matrix <index> comp threshold Get or set the compressor threshold of the Matrix output.
|
||||||
output.
|
matrix <index> comp ratio Get or set the compressor ratio of the Matrix output.
|
||||||
matrix <index> comp threshold Get or set the compressor threshold of the
|
matrix <index> comp mix Get or set the compressor mix level of the Matrix output.
|
||||||
Matrix output.
|
matrix <index> comp makeup Get or set the compressor makeup gain of the Matrix output.
|
||||||
matrix <index> comp ratio Get or set the compressor ratio of the Matrix
|
matrix <index> comp attack Get or set the compressor attack time of the Matrix output.
|
||||||
output.
|
matrix <index> comp hold Get or set the compressor hold time of the Matrix output.
|
||||||
matrix <index> comp mix Get or set the compressor mix level of the
|
matrix <index> comp release Get or set the compressor release time of the Matrix output.
|
||||||
Matrix output.
|
|
||||||
matrix <index> comp makeup Get or set the compressor makeup gain of the
|
|
||||||
Matrix output.
|
|
||||||
matrix <index> comp attack Get or set the compressor attack time of the
|
|
||||||
Matrix output.
|
|
||||||
matrix <index> comp hold Get or set the compressor hold time of the
|
|
||||||
Matrix output.
|
|
||||||
matrix <index> comp release Get or set the compressor release time of the
|
|
||||||
Matrix output.
|
|
||||||
|
|
||||||
Strip
|
Strip
|
||||||
strip <index> mute Get or set the mute state of the strip.
|
strip <index> mute Get or set the mute state of the strip.
|
||||||
@@ -131,21 +96,15 @@ Strip
|
|||||||
strip <index> eq <band> freq Get or set the frequency of the EQ band.
|
strip <index> eq <band> freq Get or set the frequency of the EQ band.
|
||||||
strip <index> eq <band> q Get or set the Q factor of the EQ band.
|
strip <index> eq <band> q Get or set the Q factor of the EQ band.
|
||||||
strip <index> eq <band> type Get or set the type of the EQ band.
|
strip <index> eq <band> type Get or set the type of the EQ band.
|
||||||
strip <index> comp on Get or set the compressor on/off state of the
|
strip <index> comp on Get or set the compressor on/off state of the strip.
|
||||||
strip.
|
|
||||||
strip <index> comp mode Get or set the compressor mode of the strip.
|
strip <index> comp mode Get or set the compressor mode of the strip.
|
||||||
strip <index> comp threshold Get or set the compressor threshold of the
|
strip <index> comp threshold Get or set the compressor threshold of the strip.
|
||||||
strip.
|
|
||||||
strip <index> comp ratio Get or set the compressor ratio of the strip.
|
strip <index> comp ratio Get or set the compressor ratio of the strip.
|
||||||
strip <index> comp mix Get or set the compressor mix of the strip.
|
strip <index> comp mix Get or set the compressor mix of the strip.
|
||||||
strip <index> comp makeup Get or set the compressor makeup gain of the
|
strip <index> comp makeup Get or set the compressor makeup gain of the strip.
|
||||||
strip.
|
strip <index> comp attack Get or set the compressor attack time of the strip.
|
||||||
strip <index> comp attack Get or set the compressor attack time of the
|
strip <index> comp hold Get or set the compressor hold time of the strip.
|
||||||
strip.
|
strip <index> comp release Get or set the compressor release time of the strip.
|
||||||
strip <index> comp hold Get or set the compressor hold time of the
|
|
||||||
strip.
|
|
||||||
strip <index> comp release Get or set the compressor release time of the
|
|
||||||
strip.
|
|
||||||
|
|
||||||
Bus
|
Bus
|
||||||
bus <index> mute Get or set the mute state of the bus.
|
bus <index> mute Get or set the mute state of the bus.
|
||||||
@@ -154,30 +113,20 @@ Bus
|
|||||||
bus <index> fadeout Fade out the bus over a specified duration.
|
bus <index> fadeout Fade out the bus over a specified duration.
|
||||||
bus <index> name Get or set the name of the bus.
|
bus <index> name Get or set the name of the bus.
|
||||||
bus <index> eq on Get or set the EQ on/off state of the bus.
|
bus <index> eq on Get or set the EQ on/off state of the bus.
|
||||||
bus <index> eq mode Get or set the EQ mode of the bus (peq, geq or
|
bus <index> eq mode Get or set the EQ mode of the bus (peq, geq or teq).
|
||||||
teq).
|
|
||||||
bus <index> eq <band> gain Get or set the gain of the EQ band.
|
bus <index> eq <band> gain Get or set the gain of the EQ band.
|
||||||
bus <index> eq <band> freq Get or set the frequency of the EQ band.
|
bus <index> eq <band> freq Get or set the frequency of the EQ band.
|
||||||
bus <index> eq <band> q Get or set the Q factor of the EQ band.
|
bus <index> eq <band> q Get or set the Q factor of the EQ band.
|
||||||
bus <index> eq <band> type Get or set the type of the EQ band (lcut, lshv,
|
bus <index> eq <band> type Get or set the type of the EQ band (lcut, lshv, peq, veq, hshv, hcut).
|
||||||
peq, veq, hshv, hcut).
|
bus <index> comp on Get or set the compressor on/off state of the bus.
|
||||||
bus <index> comp on Get or set the compressor on/off state of the
|
bus <index> comp mode Get or set the compressor mode of the bus (comp, exp).
|
||||||
bus.
|
bus <index> comp threshold Get or set the compressor threshold of the bus (in dB).
|
||||||
bus <index> comp mode Get or set the compressor mode of the bus (comp,
|
|
||||||
exp).
|
|
||||||
bus <index> comp threshold Get or set the compressor threshold of the bus
|
|
||||||
(in dB).
|
|
||||||
bus <index> comp ratio Get or set the compressor ratio of the bus.
|
bus <index> comp ratio Get or set the compressor ratio of the bus.
|
||||||
bus <index> comp mix Get or set the compressor mix level of the bus
|
bus <index> comp mix Get or set the compressor mix level of the bus (in %).
|
||||||
(in %).
|
bus <index> comp makeup Get or set the compressor makeup gain of the bus (in dB).
|
||||||
bus <index> comp makeup Get or set the compressor makeup gain of the bus
|
bus <index> comp attack Get or set the compressor attack time of the bus (in ms).
|
||||||
(in dB).
|
bus <index> comp hold Get or set the compressor hold time of the bus (in ms).
|
||||||
bus <index> comp attack Get or set the compressor attack time of the bus
|
bus <index> comp release Get or set the compressor release time of the bus (in ms).
|
||||||
(in ms).
|
|
||||||
bus <index> comp hold Get or set the compressor hold time of the bus
|
|
||||||
(in ms).
|
|
||||||
bus <index> comp release Get or set the compressor release time of the
|
|
||||||
bus (in ms).
|
|
||||||
|
|
||||||
Headamp
|
Headamp
|
||||||
headamp <index> gain Get or set the gain of the headamp.
|
headamp <index> gain Get or set the gain of the headamp.
|
||||||
@@ -195,4 +144,5 @@ DCA
|
|||||||
dca <index> name Get or set the name of the DCA group.
|
dca <index> name Get or set the name of the DCA group.
|
||||||
|
|
||||||
Run "x32-cli <command> --help" for more information on a command.
|
Run "x32-cli <command> --help" for more information on a command.
|
||||||
|
|
||||||
```
|
```
|
||||||
@@ -9,13 +9,13 @@ Flags:
|
|||||||
-P, --port=10024 The port of the X-Air device ($XAIR_CLI_PORT).
|
-P, --port=10024 The port of the X-Air device ($XAIR_CLI_PORT).
|
||||||
-T, --timeout=100ms Timeout for OSC operations ($XAIR_CLI_TIMEOUT).
|
-T, --timeout=100ms Timeout for OSC operations ($XAIR_CLI_TIMEOUT).
|
||||||
-L, --loglevel="warn" Log level for the CLI ($XAIR_CLI_LOGLEVEL).
|
-L, --loglevel="warn" Log level for the CLI ($XAIR_CLI_LOGLEVEL).
|
||||||
|
--man Print man page.
|
||||||
-v, --version Print xair-cli version information and quit
|
-v, --version Print xair-cli version information and quit
|
||||||
|
|
||||||
Commands:
|
Commands:
|
||||||
completion (c) Generate shell completion scripts.
|
completion Generate shell completion scripts.
|
||||||
|
info Print mixer information.
|
||||||
Raw
|
raw Send raw OSC messages to the mixer.
|
||||||
raw Send raw OSC messages to the mixer.
|
|
||||||
|
|
||||||
Main
|
Main
|
||||||
main mute Get or set the mute state of the Main L/R output.
|
main mute Get or set the mute state of the Main L/R output.
|
||||||
@@ -27,22 +27,15 @@ Main
|
|||||||
main eq <band> freq Get or set the frequency of the specified EQ band.
|
main eq <band> freq Get or set the frequency of the specified EQ band.
|
||||||
main eq <band> q Get or set the Q factor of the specified EQ band.
|
main eq <band> q Get or set the Q factor of the specified EQ band.
|
||||||
main eq <band> type Get or set the type of the specified EQ band.
|
main eq <band> type Get or set the type of the specified EQ band.
|
||||||
main comp on Get or set the compressor on/off state of the Main L/R
|
main comp on Get or set the compressor on/off state of the Main L/R output.
|
||||||
output.
|
|
||||||
main comp mode Get or set the compressor mode of the Main L/R output.
|
main comp mode Get or set the compressor mode of the Main L/R output.
|
||||||
main comp threshold Get or set the compressor threshold of the Main L/R
|
main comp threshold Get or set the compressor threshold of the Main L/R output.
|
||||||
output.
|
|
||||||
main comp ratio Get or set the compressor ratio of the Main L/R output.
|
main comp ratio Get or set the compressor ratio of the Main L/R output.
|
||||||
main comp mix Get or set the compressor mix level of the Main L/R
|
main comp mix Get or set the compressor mix level of the Main L/R output.
|
||||||
output.
|
main comp makeup Get or set the compressor makeup gain of the Main L/R output.
|
||||||
main comp makeup Get or set the compressor makeup gain of the Main L/R
|
main comp attack Get or set the compressor attack time of the Main L/R output.
|
||||||
output.
|
main comp hold Get or set the compressor hold time of the Main L/R output.
|
||||||
main comp attack Get or set the compressor attack time of the Main L/R
|
main comp release Get or set the compressor release time of the Main L/R output.
|
||||||
output.
|
|
||||||
main comp hold Get or set the compressor hold time of the Main L/R
|
|
||||||
output.
|
|
||||||
main comp release Get or set the compressor release time of the Main L/R
|
|
||||||
output.
|
|
||||||
|
|
||||||
Strip
|
Strip
|
||||||
strip <index> mute Get or set the mute state of the strip.
|
strip <index> mute Get or set the mute state of the strip.
|
||||||
@@ -63,21 +56,15 @@ Strip
|
|||||||
strip <index> eq <band> freq Get or set the frequency of the EQ band.
|
strip <index> eq <band> freq Get or set the frequency of the EQ band.
|
||||||
strip <index> eq <band> q Get or set the Q factor of the EQ band.
|
strip <index> eq <band> q Get or set the Q factor of the EQ band.
|
||||||
strip <index> eq <band> type Get or set the type of the EQ band.
|
strip <index> eq <band> type Get or set the type of the EQ band.
|
||||||
strip <index> comp on Get or set the compressor on/off state of the
|
strip <index> comp on Get or set the compressor on/off state of the strip.
|
||||||
strip.
|
|
||||||
strip <index> comp mode Get or set the compressor mode of the strip.
|
strip <index> comp mode Get or set the compressor mode of the strip.
|
||||||
strip <index> comp threshold Get or set the compressor threshold of the
|
strip <index> comp threshold Get or set the compressor threshold of the strip.
|
||||||
strip.
|
|
||||||
strip <index> comp ratio Get or set the compressor ratio of the strip.
|
strip <index> comp ratio Get or set the compressor ratio of the strip.
|
||||||
strip <index> comp mix Get or set the compressor mix of the strip.
|
strip <index> comp mix Get or set the compressor mix of the strip.
|
||||||
strip <index> comp makeup Get or set the compressor makeup gain of the
|
strip <index> comp makeup Get or set the compressor makeup gain of the strip.
|
||||||
strip.
|
strip <index> comp attack Get or set the compressor attack time of the strip.
|
||||||
strip <index> comp attack Get or set the compressor attack time of the
|
strip <index> comp hold Get or set the compressor hold time of the strip.
|
||||||
strip.
|
strip <index> comp release Get or set the compressor release time of the strip.
|
||||||
strip <index> comp hold Get or set the compressor hold time of the
|
|
||||||
strip.
|
|
||||||
strip <index> comp release Get or set the compressor release time of the
|
|
||||||
strip.
|
|
||||||
|
|
||||||
Bus
|
Bus
|
||||||
bus <index> mute Get or set the mute state of the bus.
|
bus <index> mute Get or set the mute state of the bus.
|
||||||
@@ -86,30 +73,20 @@ Bus
|
|||||||
bus <index> fadeout Fade out the bus over a specified duration.
|
bus <index> fadeout Fade out the bus over a specified duration.
|
||||||
bus <index> name Get or set the name of the bus.
|
bus <index> name Get or set the name of the bus.
|
||||||
bus <index> eq on Get or set the EQ on/off state of the bus.
|
bus <index> eq on Get or set the EQ on/off state of the bus.
|
||||||
bus <index> eq mode Get or set the EQ mode of the bus (peq, geq or
|
bus <index> eq mode Get or set the EQ mode of the bus (peq, geq or teq).
|
||||||
teq).
|
|
||||||
bus <index> eq <band> gain Get or set the gain of the EQ band.
|
bus <index> eq <band> gain Get or set the gain of the EQ band.
|
||||||
bus <index> eq <band> freq Get or set the frequency of the EQ band.
|
bus <index> eq <band> freq Get or set the frequency of the EQ band.
|
||||||
bus <index> eq <band> q Get or set the Q factor of the EQ band.
|
bus <index> eq <band> q Get or set the Q factor of the EQ band.
|
||||||
bus <index> eq <band> type Get or set the type of the EQ band (lcut, lshv,
|
bus <index> eq <band> type Get or set the type of the EQ band (lcut, lshv, peq, veq, hshv, hcut).
|
||||||
peq, veq, hshv, hcut).
|
bus <index> comp on Get or set the compressor on/off state of the bus.
|
||||||
bus <index> comp on Get or set the compressor on/off state of the
|
bus <index> comp mode Get or set the compressor mode of the bus (comp, exp).
|
||||||
bus.
|
bus <index> comp threshold Get or set the compressor threshold of the bus (in dB).
|
||||||
bus <index> comp mode Get or set the compressor mode of the bus (comp,
|
|
||||||
exp).
|
|
||||||
bus <index> comp threshold Get or set the compressor threshold of the bus
|
|
||||||
(in dB).
|
|
||||||
bus <index> comp ratio Get or set the compressor ratio of the bus.
|
bus <index> comp ratio Get or set the compressor ratio of the bus.
|
||||||
bus <index> comp mix Get or set the compressor mix level of the bus
|
bus <index> comp mix Get or set the compressor mix level of the bus (in %).
|
||||||
(in %).
|
bus <index> comp makeup Get or set the compressor makeup gain of the bus (in dB).
|
||||||
bus <index> comp makeup Get or set the compressor makeup gain of the bus
|
bus <index> comp attack Get or set the compressor attack time of the bus (in ms).
|
||||||
(in dB).
|
bus <index> comp hold Get or set the compressor hold time of the bus (in ms).
|
||||||
bus <index> comp attack Get or set the compressor attack time of the bus
|
bus <index> comp release Get or set the compressor release time of the bus (in ms).
|
||||||
(in ms).
|
|
||||||
bus <index> comp hold Get or set the compressor hold time of the bus
|
|
||||||
(in ms).
|
|
||||||
bus <index> comp release Get or set the compressor release time of the
|
|
||||||
bus (in ms).
|
|
||||||
|
|
||||||
Headamp
|
Headamp
|
||||||
headamp <index> gain Get or set the gain of the headamp.
|
headamp <index> gain Get or set the gain of the headamp.
|
||||||
@@ -127,4 +104,5 @@ DCA
|
|||||||
dca <index> name Get or set the name of the DCA group.
|
dca <index> name Get or set the name of the DCA group.
|
||||||
|
|
||||||
Run "xair-cli <command> --help" for more information on a command.
|
Run "xair-cli <command> --help" for more information on a command.
|
||||||
|
|
||||||
```
|
```
|
||||||
Reference in New Issue
Block a user