mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-04-19 23:33:35 +00:00
Compare commits
7 Commits
873ff87429
...
v0.15.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 58866b794b | |||
| 32a09db1a4 | |||
| 106f896c45 | |||
| 6615eec466 | |||
| 942d1b18bd | |||
| 2e1c28c909 | |||
| cf470181a1 |
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BusCmdGroup defines the commands related to controlling the buses of the X-Air device.
|
// BusCmdGroup defines the commands related to controlling the buses of the X-Air device.
|
||||||
@@ -174,7 +172,7 @@ type BusEqCmdGroup struct {
|
|||||||
On BusEqOnCmd `help:"Get or set the EQ on/off state of the bus." cmd:"on"`
|
On BusEqOnCmd `help:"Get or set the EQ on/off state of the bus." cmd:"on"`
|
||||||
Mode BusEqModeCmd `help:"Get or set the EQ mode of the bus (peq, geq or teq)." cmd:"mode"`
|
Mode BusEqModeCmd `help:"Get or set the EQ mode of the bus (peq, geq or teq)." cmd:"mode"`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band int `arg:"" help:"The EQ band number."`
|
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 `help:"Get or set the gain of the EQ band." cmd:"gain"`
|
||||||
Freq BusEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:"freq"`
|
Freq BusEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:"freq"`
|
||||||
Q BusEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:"q"`
|
Q BusEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:"q"`
|
||||||
@@ -183,9 +181,13 @@ type BusEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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).
|
||||||
func (cmd *BusEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *BusEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 6 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("EQ band number must be between 1 and 6")
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 6 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 6, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -244,18 +246,18 @@ type BusEqBandGainCmd struct {
|
|||||||
// Run executes the BusEqBandGainCmd command, either retrieving the current gain of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandGainCmd command, either retrieving the current gain of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandGainCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandGainCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Gain == nil {
|
if cmd.Gain == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Gain(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Gain(bus.Index.Index, *busEq.Band.Band)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,18 +269,18 @@ type BusEqBandFreqCmd struct {
|
|||||||
// Run executes the BusEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandFreqCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandFreqCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Freq == nil {
|
if cmd.Freq == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Frequency(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Frequency(bus.Index.Index, *busEq.Band.Band)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,18 +292,18 @@ type BusEqBandQCmd struct {
|
|||||||
// Run executes the BusEqBandQCmd command, either retrieving the current Q factor of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandQCmd command, either retrieving the current Q factor of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandQCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandQCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Q(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Q(bus.Index.Index, *busEq.Band.Band)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,18 +315,18 @@ type BusEqBandTypeCmd struct {
|
|||||||
// Run executes the BusEqBandTypeCmd command, either retrieving the current type of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandTypeCmd command, either retrieving the current type of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandTypeCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandTypeCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Type(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Type(bus.Index.Index, *busEq.Band.Band)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,10 @@ type CLI struct {
|
|||||||
|
|
||||||
Version VersionFlag `help:"Print x32-cli version information and quit" name:"version" short:"v"`
|
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 `help:"Generate shell completion scripts." cmd:""`
|
||||||
|
Info InfoCmd `help:"Print mixer information." cmd:""`
|
||||||
|
Raw RawCmd `help:"Send raw OSC messages to the mixer." cmd:""`
|
||||||
|
|
||||||
Raw RawCmd `help:"Send raw OSC messages to the mixer." cmd:"" group:"Raw"`
|
|
||||||
Main MainCmdGroup `help:"Control the Main L/R output" cmd:"" group:"Main"`
|
Main MainCmdGroup `help:"Control the Main L/R output" cmd:"" group:"Main"`
|
||||||
Mainmono MainMonoCmdGroup `help:"Control the Main Mono output" cmd:"" group:"MainMono"`
|
Mainmono MainMonoCmdGroup `help:"Control the Main Mono output" cmd:"" group:"MainMono"`
|
||||||
Matrix MatrixCmdGroup `help:"Control the matrix outputs." cmd:"" group:"Matrix"`
|
Matrix MatrixCmdGroup `help:"Control the matrix outputs." cmd:"" group:"Matrix"`
|
||||||
@@ -56,6 +57,7 @@ type CLI struct {
|
|||||||
Bus BusCmdGroup `help:"Control the buses." cmd:"" group:"Bus"`
|
Bus BusCmdGroup `help:"Control the buses." cmd:"" group:"Bus"`
|
||||||
Headamp HeadampCmdGroup `help:"Control input gain and phantom power." cmd:"" group:"Headamp"`
|
Headamp HeadampCmdGroup `help:"Control input gain and phantom power." cmd:"" group:"Headamp"`
|
||||||
Snapshot SnapshotCmdGroup `help:"Save and load mixer states." cmd:"" group:"Snapshot"`
|
Snapshot SnapshotCmdGroup `help:"Save and load mixer states." cmd:"" group:"Snapshot"`
|
||||||
|
Dca DCACmdGroup `help:"Control DCA groups." cmd:"" group:"DCA"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
67
cmd/x32-cli/dca.go
Normal file
67
cmd/x32-cli/dca.go
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
type DCACmdGroup struct {
|
||||||
|
Index struct {
|
||||||
|
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:""`
|
||||||
|
Name DCANameCmd `help:"Get or set the name of the DCA group." cmd:""`
|
||||||
|
} `arg:"" help:"Control a specific DCA group by its index."`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate checks if the provided index is within the valid range.
|
||||||
|
func (cmd *DCACmdGroup) Validate() error {
|
||||||
|
if cmd.Index.Index < 1 || cmd.Index.Index > 8 {
|
||||||
|
return fmt.Errorf("DCA group index must be between 1 and 8, got %d", cmd.Index.Index)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DCAMuteCmd is the command to get or set the mute status of a DCA group.
|
||||||
|
type DCAMuteCmd struct {
|
||||||
|
State *string `arg:"" help:"Set the mute status of the DCA group." optional:"" enum:"true,false"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run executes the DCAMuteCmd command.
|
||||||
|
func (cmd *DCAMuteCmd) Run(ctx *context, dca *DCACmdGroup) error {
|
||||||
|
if cmd.State == nil {
|
||||||
|
resp, err := ctx.Client.DCA.Mute(dca.Index.Index)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get DCA mute status: %w", err)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(ctx.Out, "DCA Group %d mute state: %t\n", dca.Index.Index, resp)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ctx.Client.DCA.SetMute(dca.Index.Index, *cmd.State == "true"); err != nil {
|
||||||
|
return fmt.Errorf("failed to set DCA mute status: %w", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DCANameCmd is the command to get or set the name of a DCA group.
|
||||||
|
type DCANameCmd struct {
|
||||||
|
Name *string `arg:"" help:"Set the name of the DCA group." optional:""`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run executes the DCANameCmd command.
|
||||||
|
func (cmd *DCANameCmd) Run(ctx *context, dca *DCACmdGroup) error {
|
||||||
|
if cmd.Name == nil {
|
||||||
|
resp, err := ctx.Client.DCA.Name(dca.Index.Index)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get DCA name: %w", err)
|
||||||
|
}
|
||||||
|
if resp == "" {
|
||||||
|
resp = fmt.Sprintf("DCA %d", dca.Index.Index)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(ctx.Out, "DCA Group %d is named '%s'\n", dca.Index.Index, resp)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err := ctx.Client.DCA.SetName(dca.Index.Index, *cmd.Name); err != nil {
|
||||||
|
return fmt.Errorf("failed to set DCA name: %w", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
18
cmd/x32-cli/info.go
Normal file
18
cmd/x32-cli/info.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type InfoCmd struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *InfoCmd) Run(ctx *context) error {
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -137,7 +135,7 @@ func (cmd *MainFadeoutCmd) Run(ctx *context) error {
|
|||||||
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 `help:"Get or set the EQ on/off state of the Main L/R output." cmd:"on"`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band int `arg:"" help:"The EQ band number."`
|
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 `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
||||||
Freq MainEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MainEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
||||||
Q MainEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MainEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
||||||
@@ -146,9 +144,13 @@ type MainEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
func (cmd *MainEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *MainEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 6 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band)
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 6 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 6, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -184,18 +186,18 @@ 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, main *MainCmdGroup, 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 {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d gain: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to get Main L/R EQ band %d gain: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d gain: %.2f dB\n", mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d gain: %.2f dB\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
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,18 +209,18 @@ 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, main *MainCmdGroup, 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
|
||||||
}
|
}
|
||||||
|
|
||||||
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,18 +232,18 @@ 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, main *MainCmdGroup, 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
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Eq.SetQ(0, mainEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.Main.Eq.SetQ(0, *mainEq.Band.Band, *cmd.Q); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d Q factor: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set 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 set to: %.2f\n", mainEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d Q factor set to: %.2f\n", *mainEq.Band.Band, *cmd.Q)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,18 +255,18 @@ 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, main *MainCmdGroup, 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 {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d type: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to get Main L/R EQ band %d type: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type: %s\n", mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type: %s\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Eq.SetType(0, mainEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.Main.Eq.SetType(0, *mainEq.Band.Band, *cmd.Type); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d type: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main L/R EQ band %d type: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type set to: %s\n", mainEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type set to: %s\n", *mainEq.Band.Band, *cmd.Type)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -137,7 +135,7 @@ func (cmd *MainMonoFadeoutCmd) Run(ctx *context) error {
|
|||||||
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."`
|
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 `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
||||||
Freq MainMonoEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MainMonoEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
||||||
Q MainMonoEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MainMonoEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
||||||
@@ -146,9 +144,13 @@ type MainMonoEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Main Mono output.
|
// Validate checks if the provided EQ band number is within the valid range (1-6) for the Main Mono output.
|
||||||
func (cmd *MainMonoEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *MainMonoEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 6 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band)
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 6 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 6, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -184,18 +186,18 @@ 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, main *MainCmdGroup, 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 {
|
||||||
return fmt.Errorf("failed to get Main Mono EQ band %d gain: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to get Main Mono EQ band %d gain: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d gain: %.2f dB\n", mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d gain: %.2f dB\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
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,18 +209,18 @@ 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, main *MainCmdGroup, 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(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)
|
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,18 +232,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, main *MainCmdGroup, 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
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.MainMono.Eq.SetQ(0, mainEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.MainMono.Eq.SetQ(0, *mainEq.Band.Band, *cmd.Q); err != nil {
|
||||||
return fmt.Errorf("failed to set Main Mono EQ band %d Q factor: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main Mono EQ band %d Q factor: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d Q factor set to: %.2f\n", mainEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d Q factor set to: %.2f\n", *mainEq.Band.Band, *cmd.Q)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,18 +255,18 @@ 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, main *MainCmdGroup, 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 {
|
||||||
return fmt.Errorf("failed to get Main Mono EQ band %d type: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to get Main Mono EQ band %d type: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d type: %s\n", mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d type: %s\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.MainMono.Eq.SetType(0, mainEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.MainMono.Eq.SetType(0, *mainEq.Band.Band, *cmd.Type); err != nil {
|
||||||
return fmt.Errorf("failed to set Main Mono EQ band %d type: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main Mono EQ band %d type: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d type set to: %s\n", mainEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(ctx.Out, "Main Mono EQ band %d type set to: %s\n", *mainEq.Band.Band, *cmd.Type)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// MatrixCmdGroup defines the command group for controlling the Matrix outputs, including commands for mute state, fader level, and fade-in/fade-out times.
|
// MatrixCmdGroup defines the command group for controlling the Matrix outputs, including commands for mute state, fader level, and fade-in/fade-out times.
|
||||||
@@ -22,9 +20,9 @@ type MatrixCmdGroup struct {
|
|||||||
} `help:"Commands for controlling individual Matrix outputs." arg:""`
|
} `help:"Commands for controlling individual Matrix outputs." arg:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (cmd *MatrixCmdGroup) Validate(ctx kong.Context) 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("invalid Matrix output index: %d. Valid range is 1-6", cmd.Index.Index)
|
return fmt.Errorf("Matrix output index must be between 1 and 6, got %d", cmd.Index.Index)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -147,7 +145,7 @@ func (cmd *MatrixFadeoutCmd) Run(ctx *context, matrix *MatrixCmdGroup) error {
|
|||||||
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 `help:"Get or set the EQ on/off state of the Matrix output." cmd:"on"`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band int `arg:"" help:"The EQ band number."`
|
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 `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
||||||
Freq MatrixEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MatrixEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
||||||
Q MatrixEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MatrixEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
||||||
@@ -156,9 +154,13 @@ type MatrixEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
func (cmd *MatrixEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *MatrixEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 6 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band)
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 6 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 6, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -194,18 +196,18 @@ 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 {
|
||||||
return fmt.Errorf("failed to get Matrix EQ band %d gain: %w", matrixEq.Band.Band, err)
|
return fmt.Errorf("failed to get Matrix EQ band %d gain: %w", *matrixEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d gain: %.2f dB\n", matrixEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Matrix EQ band %d gain: %.2f dB\n", *matrixEq.Band.Band, resp)
|
||||||
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,18 +219,18 @@ 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,18 +242,18 @@ 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)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -263,18 +265,18 @@ 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 {
|
||||||
return fmt.Errorf("failed to get Matrix EQ band %d type: %w", matrixEq.Band.Band, err)
|
return fmt.Errorf("failed to get Matrix EQ band %d type: %w", *matrixEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Matrix EQ band %d type: %s\n", matrixEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Matrix EQ band %d type: %s\n", *matrixEq.Band.Band, resp)
|
||||||
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)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import "fmt"
|
|||||||
type SnapshotCmdGroup struct {
|
type SnapshotCmdGroup struct {
|
||||||
List ListCmd `help:"List all snapshots." cmd:"list"`
|
List ListCmd `help:"List all snapshots." cmd:"list"`
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the snapshot."`
|
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 `help:"Get or set the name of a snapshot." cmd:"name"`
|
||||||
Save SaveCmd `help:"Save the current mixer state to a snapshot." cmd:"save"`
|
Save SaveCmd `help:"Save the current mixer state to a snapshot." cmd:"save"`
|
||||||
Load LoadCmd `help:"Load a mixer state from a snapshot." cmd:"load"`
|
Load LoadCmd `help:"Load a mixer state from a snapshot." cmd:"load"`
|
||||||
@@ -13,6 +13,19 @@ type SnapshotCmdGroup struct {
|
|||||||
} `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.
|
||||||
|
func (c *SnapshotCmdGroup) Validate() error {
|
||||||
|
if c.Index.Index == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *c.Index.Index < 1 || *c.Index.Index > 64 {
|
||||||
|
return fmt.Errorf("snapshot index must be between 1 and 64")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type ListCmd struct {
|
type ListCmd struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +49,7 @@ type NameCmd struct {
|
|||||||
|
|
||||||
func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
if c.Name == nil {
|
if c.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
|
||||||
}
|
}
|
||||||
@@ -44,7 +57,7 @@ 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, *c.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SaveCmd struct {
|
type SaveCmd struct {
|
||||||
@@ -57,19 +70,19 @@ func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// StripCmdGroup defines the command group for controlling the strips of the mixer, including commands for getting and setting various parameters such as mute state, fader level, send levels, and EQ settings.
|
// StripCmdGroup defines the command group for controlling the strips of the mixer, including commands for getting and setting various parameters such as mute state, fader level, send levels, and EQ settings.
|
||||||
@@ -142,27 +140,41 @@ func (cmd *StripFadeoutCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripSendCmd defines the command for getting or setting the send level for a specific bus on a strip, allowing users to control the level of the signal being sent from the strip to a particular bus.
|
// StripSendCmd defines the command for getting or setting the auxiliary send level
|
||||||
|
// for a specific send destination (mix bus) on a strip.
|
||||||
type StripSendCmd struct {
|
type StripSendCmd struct {
|
||||||
BusNum int `arg:"" help:"The bus number to get or set the send level for."`
|
SendIndex int `arg:"" help:"The index of the send destination (mix bus). (1-based indexing)"`
|
||||||
Level *float64 `arg:"" help:"The send level to set (in dB)." optional:""`
|
Level *float64 `arg:"" help:"The send level to set (in dB)." optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripSendCmd command, either retrieving the current send level for the specified bus on the strip or setting it based on the provided argument.
|
// Run executes the StripSendCmd command, either retrieving the current send level for the specified send destination
|
||||||
|
// or setting it based on the provided argument.
|
||||||
func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
||||||
if cmd.Level == nil {
|
if cmd.Level == nil {
|
||||||
resp, err := ctx.Client.Strip.SendLevel(strip.Index.Index, cmd.BusNum)
|
resp, err := ctx.Client.Strip.SendLevel(strip.Index.Index, cmd.SendIndex)
|
||||||
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 level for bus %d: %.2f dB\n", strip.Index.Index, cmd.BusNum, 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.BusNum, *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 level for bus %d set to: %.2f dB\n", strip.Index.Index, cmd.BusNum, *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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +377,7 @@ func (cmd *StripGateReleaseCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
type StripEqCmdGroup struct {
|
type StripEqCmdGroup struct {
|
||||||
On StripEqOnCmd `help:"Get or set the EQ on/off state of the strip." cmd:""`
|
On StripEqOnCmd `help:"Get or set the EQ on/off state of the strip." cmd:""`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band int `arg:"" help:"The EQ band number."`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain StripEqBandGainCmd `help:"Get or set the gain of the EQ band." cmd:""`
|
Gain StripEqBandGainCmd `help:"Get or set the gain of the EQ band." cmd:""`
|
||||||
Freq StripEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:""`
|
Freq StripEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:""`
|
||||||
Q StripEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:""`
|
Q StripEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:""`
|
||||||
@@ -374,9 +386,13 @@ type StripEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
func (cmd *StripEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *StripEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 4 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("EQ band number must be between 1 and 4")
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 4 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 4, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -412,18 +428,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,22 +451,22 @@ type StripEqBandFreqCmd struct {
|
|||||||
// 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(
|
||||||
ctx.Out,
|
ctx.Out,
|
||||||
"Strip %d EQ band %d frequency set to: %.2f Hz\n",
|
"Strip %d EQ band %d frequency set to: %.2f Hz\n",
|
||||||
strip.Index.Index,
|
strip.Index.Index,
|
||||||
stripEq.Band.Band,
|
*stripEq.Band.Band,
|
||||||
*cmd.Freq,
|
*cmd.Freq,
|
||||||
)
|
)
|
||||||
return nil
|
return nil
|
||||||
@@ -464,18 +480,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,18 +503,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// BusCmdGroup defines the commands related to controlling the buses of the X-Air device.
|
// BusCmdGroup defines the commands related to controlling the buses of the X-Air device.
|
||||||
@@ -174,7 +172,7 @@ type BusEqCmdGroup struct {
|
|||||||
On BusEqOnCmd `help:"Get or set the EQ on/off state of the bus." cmd:"on"`
|
On BusEqOnCmd `help:"Get or set the EQ on/off state of the bus." cmd:"on"`
|
||||||
Mode BusEqModeCmd `help:"Get or set the EQ mode of the bus (peq, geq or teq)." cmd:"mode"`
|
Mode BusEqModeCmd `help:"Get or set the EQ mode of the bus (peq, geq or teq)." cmd:"mode"`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band int `arg:"" help:"The EQ band number."`
|
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 `help:"Get or set the gain of the EQ band." cmd:"gain"`
|
||||||
Freq BusEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:"freq"`
|
Freq BusEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:"freq"`
|
||||||
Q BusEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:"q"`
|
Q BusEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:"q"`
|
||||||
@@ -183,9 +181,13 @@ type BusEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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).
|
||||||
func (cmd *BusEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *BusEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 6 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("EQ band number must be between 1 and 6")
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 6 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 6, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -244,7 +246,7 @@ type BusEqBandGainCmd struct {
|
|||||||
// Run executes the BusEqBandGainCmd command, either retrieving the current gain of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandGainCmd command, either retrieving the current gain of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandGainCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandGainCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Gain == nil {
|
if cmd.Gain == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Gain(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Gain(bus.Index.Index, *busEq.Band.Band)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@@ -252,10 +254,10 @@ func (cmd *BusEqBandGainCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmd
|
|||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -267,18 +269,18 @@ type BusEqBandFreqCmd struct {
|
|||||||
// Run executes the BusEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandFreqCmd command, either retrieving the current frequency of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandFreqCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandFreqCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Freq == nil {
|
if cmd.Freq == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Frequency(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Frequency(bus.Index.Index, *busEq.Band.Band)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,18 +292,18 @@ type BusEqBandQCmd struct {
|
|||||||
// Run executes the BusEqBandQCmd command, either retrieving the current Q factor of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandQCmd command, either retrieving the current Q factor of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandQCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandQCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Q == nil {
|
if cmd.Q == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Q(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Q(bus.Index.Index, *busEq.Band.Band)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -313,18 +315,18 @@ type BusEqBandTypeCmd struct {
|
|||||||
// Run executes the BusEqBandTypeCmd command, either retrieving the current type of the specified EQ band of the bus or setting it based on the provided argument.
|
// Run executes the BusEqBandTypeCmd command, either retrieving the current type of the specified EQ band of the bus or setting it based on the provided argument.
|
||||||
func (cmd *BusEqBandTypeCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
func (cmd *BusEqBandTypeCmd) Run(ctx *context, bus *BusCmdGroup, busEq *BusEqCmdGroup) error {
|
||||||
if cmd.Type == nil {
|
if cmd.Type == nil {
|
||||||
resp, err := ctx.Client.Bus.Eq.Type(bus.Index.Index, busEq.Band.Band)
|
resp, err := ctx.Client.Bus.Eq.Type(bus.Index.Index, *busEq.Band.Band)
|
||||||
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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,14 +46,16 @@ type CLI struct {
|
|||||||
|
|
||||||
Version VersionFlag `help:"Print xair-cli version information and quit" name:"version" short:"v"`
|
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 `help:"Generate shell completion scripts." cmd:""`
|
||||||
|
Info InfoCmd `help:"Print mixer information." cmd:""`
|
||||||
|
Raw RawCmd `help:"Send raw OSC messages to the mixer." cmd:""`
|
||||||
|
|
||||||
Raw RawCmd `help:"Send raw OSC messages to the mixer." cmd:"" group:"Raw"`
|
|
||||||
Main MainCmdGroup `help:"Control the Main L/R output" cmd:"" group:"Main"`
|
Main MainCmdGroup `help:"Control the Main L/R output" cmd:"" group:"Main"`
|
||||||
Strip StripCmdGroup `help:"Control the strips." cmd:"" group:"Strip"`
|
Strip StripCmdGroup `help:"Control the strips." cmd:"" group:"Strip"`
|
||||||
Bus BusCmdGroup `help:"Control the buses." cmd:"" group:"Bus"`
|
Bus BusCmdGroup `help:"Control the buses." cmd:"" group:"Bus"`
|
||||||
Headamp HeadampCmdGroup `help:"Control input gain and phantom power." cmd:"" group:"Headamp"`
|
Headamp HeadampCmdGroup `help:"Control input gain and phantom power." cmd:"" group:"Headamp"`
|
||||||
Snapshot SnapshotCmdGroup `help:"Save and load mixer states." cmd:"" group:"Snapshot"`
|
Snapshot SnapshotCmdGroup `help:"Save and load mixer states." cmd:"" group:"Snapshot"`
|
||||||
|
Dca DCACmdGroup `help:"Control DCA groups." cmd:"" group:"DCA"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|||||||
68
cmd/xair-cli/dca.go
Normal file
68
cmd/xair-cli/dca.go
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
)
|
||||||
|
|
||||||
|
// DCACmdGroup is the command group for controlling DCA groups.
|
||||||
|
type DCACmdGroup struct {
|
||||||
|
Index struct {
|
||||||
|
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:""`
|
||||||
|
Name DCANameCmd `help:"Get or set the name of the DCA group." cmd:""`
|
||||||
|
} `arg:"" help:"Control a specific DCA group by its index."`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate checks if the provided index is within the valid range.
|
||||||
|
func (cmd *DCACmdGroup) Validate() error {
|
||||||
|
if cmd.Index.Index < 1 || cmd.Index.Index > 4 {
|
||||||
|
return fmt.Errorf("DCA group index must be between 1 and 4, got %d", cmd.Index.Index)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DCAMuteCmd is the command to get or set the mute status of a DCA group.
|
||||||
|
type DCAMuteCmd struct {
|
||||||
|
State *string `arg:"" help:"Set the mute status of the DCA group." optional:"" enum:"true,false"`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run executes the DCAMuteCmd command.
|
||||||
|
func (cmd *DCAMuteCmd) Run(ctx *context, dca *DCACmdGroup) error {
|
||||||
|
if cmd.State == nil {
|
||||||
|
resp, err := ctx.Client.DCA.Mute(dca.Index.Index)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get DCA mute status: %w", err)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(ctx.Out, "DCA Group %d mute state: %t\n", dca.Index.Index, resp)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ctx.Client.DCA.SetMute(dca.Index.Index, *cmd.State == "true"); err != nil {
|
||||||
|
return fmt.Errorf("failed to set DCA mute status: %w", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// DCANameCmd is the command to get or set the name of a DCA group.
|
||||||
|
type DCANameCmd struct {
|
||||||
|
Name *string `arg:"" help:"Set the name of the DCA group." optional:""`
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run executes the DCANameCmd command.
|
||||||
|
func (cmd *DCANameCmd) Run(ctx *context, dca *DCACmdGroup) error {
|
||||||
|
if cmd.Name == nil {
|
||||||
|
resp, err := ctx.Client.DCA.Name(dca.Index.Index)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to get DCA name: %w", err)
|
||||||
|
}
|
||||||
|
if resp == "" {
|
||||||
|
resp = fmt.Sprintf("DCA %d", dca.Index.Index)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(ctx.Out, "DCA Group %d is named '%s'\n", dca.Index.Index, resp)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if err := ctx.Client.DCA.SetName(dca.Index.Index, *cmd.Name); err != nil {
|
||||||
|
return fmt.Errorf("failed to set DCA name: %w", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
18
cmd/xair-cli/info.go
Normal file
18
cmd/xair-cli/info.go
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type InfoCmd struct {
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *InfoCmd) Run(ctx *context) error {
|
||||||
|
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
|
||||||
|
}
|
||||||
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 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.
|
||||||
@@ -137,7 +135,7 @@ func (cmd *MainFadeoutCmd) Run(ctx *context) error {
|
|||||||
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 `help:"Get or set the EQ on/off state of the Main L/R output." cmd:"on"`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band int `arg:"" help:"The EQ band number."`
|
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 `help:"Get or set the gain of the specified EQ band." cmd:"gain"`
|
||||||
Freq MainEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
Freq MainEqBandFreqCmd `help:"Get or set the frequency of the specified EQ band." cmd:"freq"`
|
||||||
Q MainEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
Q MainEqBandQCmd `help:"Get or set the Q factor of the specified EQ band." cmd:"q"`
|
||||||
@@ -146,9 +144,13 @@ type MainEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
func (cmd *MainEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *MainEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 6 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("invalid EQ band number: %d. Valid range is 1-6", cmd.Band.Band)
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 6 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 6, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -184,18 +186,18 @@ 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, main *MainCmdGroup, 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 {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d gain: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to get Main L/R EQ band %d gain: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d gain: %.2f dB\n", mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d gain: %.2f dB\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
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,18 +209,18 @@ 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, main *MainCmdGroup, 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
|
||||||
}
|
}
|
||||||
|
|
||||||
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,18 +232,18 @@ 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, main *MainCmdGroup, 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
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Eq.SetQ(0, mainEq.Band.Band, *cmd.Q); err != nil {
|
if err := ctx.Client.Main.Eq.SetQ(0, *mainEq.Band.Band, *cmd.Q); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d Q factor: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set 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 set to: %.2f\n", mainEq.Band.Band, *cmd.Q)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d Q factor set to: %.2f\n", *mainEq.Band.Band, *cmd.Q)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,18 +255,18 @@ 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, main *MainCmdGroup, 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 {
|
||||||
return fmt.Errorf("failed to get Main L/R EQ band %d type: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to get Main L/R EQ band %d type: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type: %s\n", mainEq.Band.Band, resp)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type: %s\n", *mainEq.Band.Band, resp)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ctx.Client.Main.Eq.SetType(0, mainEq.Band.Band, *cmd.Type); err != nil {
|
if err := ctx.Client.Main.Eq.SetType(0, *mainEq.Band.Band, *cmd.Type); err != nil {
|
||||||
return fmt.Errorf("failed to set Main L/R EQ band %d type: %w", mainEq.Band.Band, err)
|
return fmt.Errorf("failed to set Main L/R EQ band %d type: %w", *mainEq.Band.Band, err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type set to: %s\n", mainEq.Band.Band, *cmd.Type)
|
fmt.Fprintf(ctx.Out, "Main L/R EQ band %d type set to: %s\n", *mainEq.Band.Band, *cmd.Type)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import "fmt"
|
|||||||
type SnapshotCmdGroup struct {
|
type SnapshotCmdGroup struct {
|
||||||
List ListCmd `help:"List all snapshots." cmd:"list"`
|
List ListCmd `help:"List all snapshots." cmd:"list"`
|
||||||
Index struct {
|
Index struct {
|
||||||
Index int `arg:"" help:"The index of the snapshot."`
|
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 `help:"Get or set the name of a snapshot." cmd:"name"`
|
||||||
Save SaveCmd `help:"Save the current mixer state to a snapshot." cmd:"save"`
|
Save SaveCmd `help:"Save the current mixer state to a snapshot." cmd:"save"`
|
||||||
Load LoadCmd `help:"Load a mixer state from a snapshot." cmd:"load"`
|
Load LoadCmd `help:"Load a mixer state from a snapshot." cmd:"load"`
|
||||||
@@ -13,6 +13,19 @@ type SnapshotCmdGroup struct {
|
|||||||
} `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.
|
||||||
|
func (c *SnapshotCmdGroup) Validate() error {
|
||||||
|
if c.Index.Index == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *c.Index.Index < 1 || *c.Index.Index > 64 {
|
||||||
|
return fmt.Errorf("snapshot index must be between 1 and 64")
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
type ListCmd struct {
|
type ListCmd struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,7 +49,7 @@ type NameCmd struct {
|
|||||||
|
|
||||||
func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
func (c *NameCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
||||||
if c.Name == nil {
|
if c.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
|
||||||
}
|
}
|
||||||
@@ -44,7 +57,7 @@ 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, *c.Name)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SaveCmd struct {
|
type SaveCmd struct {
|
||||||
@@ -57,19 +70,19 @@ func (c *SaveCmd) Run(ctx *context, snapshot *SnapshotCmdGroup) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,8 +3,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alecthomas/kong"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// StripCmdGroup defines the command group for controlling the strips of the mixer, including commands for getting and setting various parameters such as mute state, fader level, send levels, and EQ settings.
|
// StripCmdGroup defines the command group for controlling the strips of the mixer, including commands for getting and setting various parameters such as mute state, fader level, send levels, and EQ settings.
|
||||||
@@ -142,27 +140,29 @@ func (cmd *StripFadeoutCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StripSendCmd defines the command for getting or setting the send level for a specific bus on a strip, allowing users to control the level of the signal being sent from the strip to a particular bus.
|
// StripSendCmd defines the command for getting or setting the auxiliary send level
|
||||||
|
// for a specific send destination (mix bus or effects channel) on a strip.
|
||||||
type StripSendCmd struct {
|
type StripSendCmd struct {
|
||||||
BusNum int `arg:"" help:"The bus number to get or set the send level for."`
|
SendIndex int `arg:"" help:"The index of the send destination (mix bus or effects channel). (1-based indexing)"`
|
||||||
Level *float64 `arg:"" help:"The send level to set (in dB)." optional:""`
|
Level *float64 `arg:"" help:"The send level to set (in dB)." optional:""`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run executes the StripSendCmd command, either retrieving the current send level for the specified bus on the strip or setting it based on the provided argument.
|
// Run executes the StripSendCmd command, either retrieving the current send level for the specified destination
|
||||||
|
// or setting it based on the provided argument.
|
||||||
func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
func (cmd *StripSendCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
||||||
if cmd.Level == nil {
|
if cmd.Level == nil {
|
||||||
resp, err := ctx.Client.Strip.SendLevel(strip.Index.Index, cmd.BusNum)
|
resp, err := ctx.Client.Strip.SendLevel(strip.Index.Index, cmd.SendIndex)
|
||||||
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 level for bus %d: %.2f dB\n", strip.Index.Index, cmd.BusNum, 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.BusNum, *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 level for bus %d set to: %.2f dB\n", strip.Index.Index, cmd.BusNum, *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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -365,7 +365,7 @@ func (cmd *StripGateReleaseCmd) Run(ctx *context, strip *StripCmdGroup) error {
|
|||||||
type StripEqCmdGroup struct {
|
type StripEqCmdGroup struct {
|
||||||
On StripEqOnCmd `help:"Get or set the EQ on/off state of the strip." cmd:""`
|
On StripEqOnCmd `help:"Get or set the EQ on/off state of the strip." cmd:""`
|
||||||
Band struct {
|
Band struct {
|
||||||
Band int `arg:"" help:"The EQ band number."`
|
Band *int `arg:"" help:"The EQ band number." optional:""`
|
||||||
Gain StripEqBandGainCmd `help:"Get or set the gain of the EQ band." cmd:""`
|
Gain StripEqBandGainCmd `help:"Get or set the gain of the EQ band." cmd:""`
|
||||||
Freq StripEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:""`
|
Freq StripEqBandFreqCmd `help:"Get or set the frequency of the EQ band." cmd:""`
|
||||||
Q StripEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:""`
|
Q StripEqBandQCmd `help:"Get or set the Q factor of the EQ band." cmd:""`
|
||||||
@@ -374,9 +374,13 @@ type StripEqCmdGroup struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.
|
||||||
func (cmd *StripEqCmdGroup) Validate(ctx kong.Context) error {
|
func (cmd *StripEqCmdGroup) Validate() error {
|
||||||
if cmd.Band.Band < 1 || cmd.Band.Band > 4 {
|
if cmd.Band.Band == nil {
|
||||||
return fmt.Errorf("EQ band number must be between 1 and 4")
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if *cmd.Band.Band < 1 || *cmd.Band.Band > 4 {
|
||||||
|
return fmt.Errorf("EQ band number must be between 1 and 4, got %d", *cmd.Band.Band)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -412,18 +416,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,22 +439,22 @@ type StripEqBandFreqCmd struct {
|
|||||||
// 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(
|
||||||
ctx.Out,
|
ctx.Out,
|
||||||
"Strip %d EQ band %d frequency set to: %.2f Hz\n",
|
"Strip %d EQ band %d frequency set to: %.2f Hz\n",
|
||||||
strip.Index.Index,
|
strip.Index.Index,
|
||||||
stripEq.Band.Band,
|
*stripEq.Band.Band,
|
||||||
*cmd.Freq,
|
*cmd.Freq,
|
||||||
)
|
)
|
||||||
return nil
|
return nil
|
||||||
@@ -464,18 +468,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -487,18 +491,18 @@ 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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,9 +3,10 @@ package xair
|
|||||||
var xairAddressMap = map[string]string{
|
var xairAddressMap = map[string]string{
|
||||||
"main": "/lr",
|
"main": "/lr",
|
||||||
"strip": "/ch/%02d",
|
"strip": "/ch/%02d",
|
||||||
"bus": "/bus/%01d",
|
"bus": "/bus/%d",
|
||||||
"headamp": "/headamp/%02d",
|
"headamp": "/headamp/%02d",
|
||||||
"snapshot": "/-snap",
|
"snapshot": "/-snap",
|
||||||
|
"dca": "/dca/%d",
|
||||||
}
|
}
|
||||||
|
|
||||||
var x32AddressMap = map[string]string{
|
var x32AddressMap = map[string]string{
|
||||||
@@ -16,6 +17,7 @@ var x32AddressMap = map[string]string{
|
|||||||
"bus": "/bus/%02d",
|
"bus": "/bus/%02d",
|
||||||
"headamp": "/headamp/%03d",
|
"headamp": "/headamp/%03d",
|
||||||
"snapshot": "/-snap",
|
"snapshot": "/-snap",
|
||||||
|
"dca": "/dca/%d",
|
||||||
}
|
}
|
||||||
|
|
||||||
func addressMapFromMixerKind(kind mixerKind) map[string]string {
|
func addressMapFromMixerKind(kind mixerKind) map[string]string {
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package xair
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
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"],
|
||||||
|
|||||||
@@ -9,51 +9,15 @@ import (
|
|||||||
"github.com/hypebeast/go-osc/osc"
|
"github.com/hypebeast/go-osc/osc"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Client struct {
|
|
||||||
*engine
|
|
||||||
}
|
|
||||||
|
|
||||||
// XAirClient is a client for controlling XAir mixers
|
// XAirClient is a client for controlling XAir mixers
|
||||||
type XAirClient struct {
|
type XAirClient struct {
|
||||||
Client
|
client
|
||||||
Main *Main
|
Main *Main
|
||||||
Strip *Strip
|
Strip *Strip
|
||||||
Bus *Bus
|
Bus *Bus
|
||||||
HeadAmp *HeadAmp
|
HeadAmp *HeadAmp
|
||||||
Snapshot *Snapshot
|
Snapshot *Snapshot
|
||||||
}
|
DCA *DCA
|
||||||
|
|
||||||
// X32Client is a client for controlling X32 mixers
|
|
||||||
type X32Client struct {
|
|
||||||
Client
|
|
||||||
Main *Main
|
|
||||||
MainMono *Main
|
|
||||||
Matrix *Matrix
|
|
||||||
Strip *Strip
|
|
||||||
Bus *Bus
|
|
||||||
HeadAmp *HeadAmp
|
|
||||||
Snapshot *Snapshot
|
|
||||||
}
|
|
||||||
|
|
||||||
// NewX32Client creates a new X32Client instance with optional engine configuration
|
|
||||||
func NewX32Client(mixerIP string, mixerPort int, opts ...EngineOption) (*X32Client, error) {
|
|
||||||
e, err := newEngine(mixerIP, mixerPort, kindX32, opts...)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
c := &X32Client{
|
|
||||||
Client: Client{e},
|
|
||||||
}
|
|
||||||
c.Main = newMainStereo(&c.Client)
|
|
||||||
c.MainMono = newMainMono(&c.Client)
|
|
||||||
c.Matrix = newMatrix(&c.Client)
|
|
||||||
c.Strip = newStrip(&c.Client)
|
|
||||||
c.Bus = newBus(&c.Client)
|
|
||||||
c.HeadAmp = newHeadAmp(&c.Client)
|
|
||||||
c.Snapshot = newSnapshot(&c.Client)
|
|
||||||
|
|
||||||
return c, nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewXAirClient creates a new XAirClient instance with optional engine configuration
|
// NewXAirClient creates a new XAirClient instance with optional engine configuration
|
||||||
@@ -64,25 +28,66 @@ func NewXAirClient(mixerIP string, mixerPort int, opts ...EngineOption) (*XAirCl
|
|||||||
}
|
}
|
||||||
|
|
||||||
c := &XAirClient{
|
c := &XAirClient{
|
||||||
Client: Client{e},
|
client: client{e, InfoResponse{}},
|
||||||
}
|
}
|
||||||
c.Main = newMainStereo(&c.Client)
|
c.Main = newMainStereo(&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)
|
||||||
|
|
||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// X32Client is a client for controlling X32 mixers
|
||||||
|
type X32Client struct {
|
||||||
|
client
|
||||||
|
Main *Main
|
||||||
|
MainMono *Main
|
||||||
|
Matrix *Matrix
|
||||||
|
Strip *Strip
|
||||||
|
Bus *Bus
|
||||||
|
HeadAmp *HeadAmp
|
||||||
|
Snapshot *Snapshot
|
||||||
|
DCA *DCA
|
||||||
|
}
|
||||||
|
|
||||||
|
// NewX32Client creates a new X32Client instance with optional engine configuration
|
||||||
|
func NewX32Client(mixerIP string, mixerPort int, opts ...EngineOption) (*X32Client, error) {
|
||||||
|
e, err := newEngine(mixerIP, mixerPort, kindX32, opts...)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
c := &X32Client{
|
||||||
|
client: client{e, InfoResponse{}},
|
||||||
|
}
|
||||||
|
c.Main = newMainStereo(&c.client)
|
||||||
|
c.MainMono = newMainMono(&c.client)
|
||||||
|
c.Matrix = newMatrix(&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
|
||||||
|
}
|
||||||
|
|
||||||
|
type client struct {
|
||||||
|
*engine
|
||||||
|
Info InfoResponse
|
||||||
|
}
|
||||||
|
|
||||||
// Start begins listening for messages in a goroutine
|
// Start begins listening for messages in a goroutine
|
||||||
func (c *Client) StartListening() {
|
func (c *client) StartListening() {
|
||||||
go c.engine.receiveLoop()
|
go c.engine.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() {
|
||||||
close(c.engine.done)
|
close(c.engine.done)
|
||||||
if c.engine.conn != nil {
|
if c.engine.conn != nil {
|
||||||
c.engine.conn.Close()
|
c.engine.conn.Close()
|
||||||
@@ -90,12 +95,12 @@ func (c *Client) Close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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.engine.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.engine.timeout)
|
||||||
select {
|
select {
|
||||||
case <-t:
|
case <-t:
|
||||||
@@ -109,7 +114,7 @@ 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 {
|
||||||
@@ -120,20 +125,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),
|
||||||
|
|||||||
95
internal/xair/dca.go
Normal file
95
internal/xair/dca.go
Normal file
@@ -0,0 +1,95 @@
|
|||||||
|
package xair
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
|
type DCA struct {
|
||||||
|
client *client
|
||||||
|
baseAddress string
|
||||||
|
}
|
||||||
|
|
||||||
|
// newDCA creates a new DCA instance
|
||||||
|
func newDCA(c *client) *DCA {
|
||||||
|
return &DCA{
|
||||||
|
client: c,
|
||||||
|
baseAddress: c.addressMap["dca"],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mute requests the current mute status for a DCA group
|
||||||
|
func (d *DCA) Mute(group int) (bool, error) {
|
||||||
|
address := fmt.Sprintf(d.baseAddress, group) + "/on"
|
||||||
|
err := d.client.SendMessage(address)
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := d.client.ReceiveMessage()
|
||||||
|
if err != nil {
|
||||||
|
return false, err
|
||||||
|
}
|
||||||
|
val, ok := msg.Arguments[0].(int32)
|
||||||
|
if !ok {
|
||||||
|
return false, fmt.Errorf("unexpected argument type for DCA mute value")
|
||||||
|
}
|
||||||
|
return val == 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetMute sets the mute status for a specific DCA group (1-based indexing)
|
||||||
|
func (d *DCA) SetMute(group int, muted bool) error {
|
||||||
|
address := fmt.Sprintf(d.baseAddress, group) + "/on"
|
||||||
|
var value int32
|
||||||
|
if !muted {
|
||||||
|
value = 1
|
||||||
|
}
|
||||||
|
return d.client.SendMessage(address, value)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Name requests the current name for a DCA group
|
||||||
|
func (d *DCA) Name(group int) (string, error) {
|
||||||
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/name"
|
||||||
|
err := d.client.SendMessage(address)
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := d.client.ReceiveMessage()
|
||||||
|
if err != nil {
|
||||||
|
return "", err
|
||||||
|
}
|
||||||
|
name, ok := msg.Arguments[0].(string)
|
||||||
|
if !ok {
|
||||||
|
return "", fmt.Errorf("unexpected argument type for DCA name value")
|
||||||
|
}
|
||||||
|
return name, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetName sets the name for a specific DCA group (1-based indexing)
|
||||||
|
func (d *DCA) SetName(group int, name string) error {
|
||||||
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/name"
|
||||||
|
return d.client.SendMessage(address, name)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Color requests the current color for a DCA group
|
||||||
|
func (d *DCA) Color(group int) (int32, error) {
|
||||||
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/color"
|
||||||
|
err := d.client.SendMessage(address)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
msg, err := d.client.ReceiveMessage()
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
color, ok := msg.Arguments[0].(int32)
|
||||||
|
if !ok {
|
||||||
|
return 0, fmt.Errorf("unexpected argument type for DCA color value")
|
||||||
|
}
|
||||||
|
return color, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// SetColor sets the color for a specific DCA group (1-based indexing)
|
||||||
|
func (d *DCA) SetColor(group int, color int32) error {
|
||||||
|
address := fmt.Sprintf(d.baseAddress, group) + "/config/color"
|
||||||
|
return d.client.SendMessage(address, color)
|
||||||
|
}
|
||||||
@@ -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),
|
||||||
|
|||||||
@@ -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),
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package xair
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
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"],
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package xair
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
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, args ...any) string {
|
||||||
return fmtString
|
return fmtString
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@ 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, args ...any) string {
|
||||||
return fmtString
|
return fmtString
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,14 @@ package xair
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
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"],
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ type InfoResponse struct {
|
|||||||
Host string
|
Host string
|
||||||
Name string
|
Name string
|
||||||
Model string
|
Model string
|
||||||
|
Firmware string
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,12 +3,12 @@ package xair
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
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"],
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ package xair
|
|||||||
import "fmt"
|
import "fmt"
|
||||||
|
|
||||||
type Strip struct {
|
type Strip struct {
|
||||||
client *Client
|
client *client
|
||||||
baseAddress string
|
baseAddress string
|
||||||
Gate *Gate
|
Gate *Gate
|
||||||
Eq *Eq
|
Eq *Eq
|
||||||
@@ -11,7 +11,7 @@ type Strip struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 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"],
|
||||||
@@ -126,7 +126,7 @@ func (s *Strip) SetColor(strip int, color int32) error {
|
|||||||
return s.client.SendMessage(address, color)
|
return s.client.SendMessage(address, color)
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendLevel requests the sends level for a mixbus.
|
// SendLevel requests auxiliary send level for a send destination.
|
||||||
func (s *Strip) SendLevel(strip int, bus int) (float64, error) {
|
func (s *Strip) SendLevel(strip int, 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)
|
||||||
@@ -145,7 +145,7 @@ func (s *Strip) SendLevel(strip int, bus int) (float64, error) {
|
|||||||
return mustDbFrom(float64(val)), nil
|
return mustDbFrom(float64(val)), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetSendLevel sets the sends level for a mixbus.
|
// 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 int, 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)))
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ Flags:
|
|||||||
-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
|
||||||
@@ -190,5 +189,9 @@ Snapshot
|
|||||||
snapshot <index> load Load a mixer state from a snapshot.
|
snapshot <index> load Load a mixer state from a snapshot.
|
||||||
snapshot <index> delete Delete a snapshot.
|
snapshot <index> delete Delete a snapshot.
|
||||||
|
|
||||||
|
DCA
|
||||||
|
dca <index> mute Get or set the mute status 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.
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -12,9 +12,8 @@ Flags:
|
|||||||
-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
|
||||||
@@ -122,5 +121,9 @@ Snapshot
|
|||||||
snapshot <index> load Load a mixer state from a snapshot.
|
snapshot <index> load Load a mixer state from a snapshot.
|
||||||
snapshot <index> delete Delete a snapshot.
|
snapshot <index> delete Delete a snapshot.
|
||||||
|
|
||||||
|
DCA
|
||||||
|
dca <index> mute Get or set the mute status 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