Compare commits

..

No commits in common. "main" and "v0.5.0" have entirely different histories.
main ... v0.5.0

8 changed files with 42 additions and 827 deletions

View File

@ -46,9 +46,9 @@ xair-cli main fadeout
*enable phantom power and set the gain to 28.0dB over a 10s duration for strip 09* *enable phantom power and set the gain to 28.0dB over a 10s duration for strip 09*
```console ```console
xair-cli headamp phantom 9 on xair-cli headamp 9 phantom on
xair-cli headamp gain 9 28.0 --duration 10s xair-cli headamp 9 gain 28.0 --duration 10s
``` ```
*set strip 09 send level for bus 5 to -18.0dB* *set strip 09 send level for bus 5 to -18.0dB*
@ -56,22 +56,15 @@ xair-cli headamp gain 9 28.0 --duration 10s
xair-cli strip send 9 5 -- -18.0 xair-cli strip send 9 5 -- -18.0
``` ```
*enable eq for strip 01*
```console
xair-cli strip eq on 1 true
```
*rename bus 01 to 'vocal mix'* *rename bus 01 to 'vocal mix'*
```console ```console
xair-cli bus name 1 'vocal mix' xair-cli bus 1 name 'vocal mix'
``` ```
For every command/subcommand there exists a `--help` flag which you can use to get usage information.
### Notes ### Notes
This CLI is useful if just want to run some commands on the terminal using a single binary, no further downloads. However, there exists an alternative you should check out that has wider support of the XAir OSC protocol including support for operations like batch commands and network discovery (which I have no plans to implement on this CLI). Check out [dc-xair-cli](https://pypi.org/project/dc-xair-cli/) on pypi. I've only implemented the parts I personally need, I don't know how much more I intend to add.
### License ### License

View File

@ -568,300 +568,6 @@ var busCompOnCmd = &cobra.Command{
}, },
} }
// busCompThresholdCmd represents the bus Compressor threshold command.
var busCompThresholdCmd = &cobra.Command{
Short: "Get or set the bus Compressor threshold",
Long: `Get or set the Compressor threshold (in dB) for a specific bus.`,
Use: "threshold [bus number] [threshold in dB]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide bus number")
}
busIndex := mustConvToInt(args[0])
if len(args) == 1 {
threshold, err := client.Bus.Comp.Threshold(busIndex)
if err != nil {
return fmt.Errorf("Error getting bus Compressor threshold: %w", err)
}
cmd.Printf("Bus %d Compressor threshold: %.1f dB\n", busIndex, threshold)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide bus number and threshold (in dB)")
}
threshold := mustConvToFloat64(args[1])
err := client.Bus.Comp.SetThreshold(busIndex, threshold)
if err != nil {
return fmt.Errorf("Error setting bus Compressor threshold: %w", err)
}
cmd.Printf("Bus %d Compressor threshold set to %.1f dB\n", busIndex, threshold)
return nil
},
}
// busCompRatioCmd represents the bus Compressor ratio command.
var busCompRatioCmd = &cobra.Command{
Short: "Get or set the bus Compressor ratio",
Long: `Get or set the Compressor ratio for a specific bus.`,
Use: "ratio [bus number] [ratio]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide bus number")
}
busIndex := mustConvToInt(args[0])
if len(args) == 1 {
ratio, err := client.Bus.Comp.Ratio(busIndex)
if err != nil {
return fmt.Errorf("Error getting bus Compressor ratio: %w", err)
}
cmd.Printf("Bus %d Compressor ratio: %.2f\n", busIndex, ratio)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide bus number and ratio")
}
ratio := mustConvToFloat64(args[1])
err := client.Bus.Comp.SetRatio(busIndex, ratio)
if err != nil {
return fmt.Errorf("Error setting bus Compressor ratio: %w", err)
}
cmd.Printf("Bus %d Compressor ratio set to %.2f\n", busIndex, ratio)
return nil
},
}
// busMixCmd represents the bus Compressor mix command.
var busCompMixCmd = &cobra.Command{
Short: "Get or set the bus Compressor mix",
Long: `Get or set the Compressor mix (0-100%) for a specific bus.`,
Use: "mix [bus number] [mix percentage]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide bus number")
}
busIndex := mustConvToInt(args[0])
if len(args) == 1 {
mix, err := client.Bus.Comp.Mix(busIndex)
if err != nil {
return fmt.Errorf("Error getting bus Compressor mix: %w", err)
}
cmd.Printf("Bus %d Compressor mix: %.1f%%\n", busIndex, mix)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide bus number and mix percentage")
}
mix := mustConvToFloat64(args[1])
err := client.Bus.Comp.SetMix(busIndex, mix)
if err != nil {
return fmt.Errorf("Error setting bus Compressor mix: %w", err)
}
cmd.Printf("Bus %d Compressor mix set to %.1f%%\n", busIndex, mix)
return nil
},
}
// busMakeUpCmd represents the bus Compressor make-up gain command.
var busCompMakeUpCmd = &cobra.Command{
Short: "Get or set the bus Compressor make-up gain",
Long: `Get or set the Compressor make-up gain (in dB) for a specific bus.`,
Use: "makeup [bus number] [make-up gain in dB]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide bus number")
}
busIndex := mustConvToInt(args[0])
if len(args) == 1 {
makeUp, err := client.Bus.Comp.MakeUp(busIndex)
if err != nil {
return fmt.Errorf("Error getting bus Compressor make-up gain: %w", err)
}
cmd.Printf("Bus %d Compressor make-up gain: %.1f dB\n", busIndex, makeUp)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide bus number and make-up gain (in dB)")
}
makeUp := mustConvToFloat64(args[1])
err := client.Bus.Comp.SetMakeUp(busIndex, makeUp)
if err != nil {
return fmt.Errorf("Error setting bus Compressor make-up gain: %w", err)
}
cmd.Printf("Bus %d Compressor make-up gain set to %.1f dB\n", busIndex, makeUp)
return nil
},
}
// busAttackCmd represents the bus Compressor attack time command.
var busCompAttackCmd = &cobra.Command{
Short: "Get or set the bus Compressor attack time",
Long: `Get or set the Compressor attack time (in milliseconds) for a specific bus.`,
Use: "attack [bus number] [attack time in ms]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide bus number")
}
busIndex := mustConvToInt(args[0])
if len(args) == 1 {
attack, err := client.Bus.Comp.Attack(busIndex)
if err != nil {
return fmt.Errorf("Error getting bus Compressor attack time: %w", err)
}
cmd.Printf("Bus %d Compressor attack time: %.1f ms\n", busIndex, attack)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide bus number and attack time (in ms)")
}
attack := mustConvToFloat64(args[1])
err := client.Bus.Comp.SetAttack(busIndex, attack)
if err != nil {
return fmt.Errorf("Error setting bus Compressor attack time: %w", err)
}
cmd.Printf("Bus %d Compressor attack time set to %.1f ms\n", busIndex, attack)
return nil
},
}
// busHoldCmd represents the bus Compressor hold time command.
var busCompHoldCmd = &cobra.Command{
Short: "Get or set the bus Compressor hold time",
Long: `Get or set the Compressor hold time (in milliseconds) for a specific bus.`,
Use: "hold [bus number] [hold time in ms]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide bus number")
}
busIndex := mustConvToInt(args[0])
if len(args) == 1 {
hold, err := client.Bus.Comp.Hold(busIndex)
if err != nil {
return fmt.Errorf("Error getting bus Compressor hold time: %w", err)
}
cmd.Printf("Bus %d Compressor hold time: %.2f ms\n", busIndex, hold)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide bus number and hold time (in ms)")
}
hold := mustConvToFloat64(args[1])
err := client.Bus.Comp.SetHold(busIndex, hold)
if err != nil {
return fmt.Errorf("Error setting bus Compressor hold time: %w", err)
}
cmd.Printf("Bus %d Compressor hold time set to %.2f ms\n", busIndex, hold)
return nil
},
}
// busReleaseCmd represents the bus Compressor release time command.
var busCompReleaseCmd = &cobra.Command{
Short: "Get or set the bus Compressor release time",
Long: `Get or set the Compressor release time (in milliseconds) for a specific bus.`,
Use: "release [bus number] [release time in ms]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide bus number")
}
busIndex := mustConvToInt(args[0])
if len(args) == 1 {
release, err := client.Bus.Comp.Release(busIndex)
if err != nil {
return fmt.Errorf("Error getting bus Compressor release time: %w", err)
}
cmd.Printf("Bus %d Compressor release time: %.1f ms\n", busIndex, release)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide bus number and release time (in ms)")
}
release := mustConvToFloat64(args[1])
err := client.Bus.Comp.SetRelease(busIndex, release)
if err != nil {
return fmt.Errorf("Error setting bus Compressor release time: %w", err)
}
cmd.Printf("Bus %d Compressor release time set to %.1f ms\n", busIndex, release)
return nil
},
}
func init() { func init() {
rootCmd.AddCommand(busCmd) rootCmd.AddCommand(busCmd)
@ -883,11 +589,4 @@ func init() {
busCmd.AddCommand(busCompCmd) busCmd.AddCommand(busCompCmd)
busCompCmd.AddCommand(busCompOnCmd) busCompCmd.AddCommand(busCompOnCmd)
busCompCmd.AddCommand(busCompThresholdCmd)
busCompCmd.AddCommand(busCompRatioCmd)
busCompCmd.AddCommand(busCompMixCmd)
busCompCmd.AddCommand(busCompMakeUpCmd)
busCompCmd.AddCommand(busCompAttackCmd)
busCompCmd.AddCommand(busCompHoldCmd)
busCompCmd.AddCommand(busCompReleaseCmd)
} }

View File

@ -727,304 +727,6 @@ If "false" or "0" is provided, the Compressor is turned off.`,
}, },
} }
// stripCompThresholdCmd represents the strip Compressor Threshold command.
var stripCompThresholdCmd = &cobra.Command{
Short: "Get or set the Compressor threshold for a strip",
Long: "Get or set the Compressor threshold for a specific strip.",
Use: "threshold [strip number] [threshold in dB]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide a strip number")
}
stripIndex := mustConvToInt(args[0])
if len(args) == 1 {
currentThreshold, err := client.Strip.Comp.Threshold(stripIndex)
if err != nil {
return fmt.Errorf("Error getting strip Compressor threshold: %w", err)
}
cmd.Printf("Strip %d Compressor threshold: %.2f dB\n", stripIndex, currentThreshold)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide a threshold in dB")
}
threshold := mustConvToFloat64(args[1])
err := client.Strip.Comp.SetThreshold(stripIndex, threshold)
if err != nil {
return fmt.Errorf("Error setting strip Compressor threshold: %w", err)
}
cmd.Printf("Strip %d Compressor threshold set to %.2f dB\n", stripIndex, threshold)
return nil
},
}
// stripCompRatioCmd represents the strip Compressor Ratio command.
var stripCompRatioCmd = &cobra.Command{
Short: "Get or set the Compressor ratio for a strip",
Long: "Get or set the Compressor ratio for a specific strip.",
Use: "ratio [strip number] [ratio]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide a strip number")
}
stripIndex := mustConvToInt(args[0])
if len(args) == 1 {
currentRatio, err := client.Strip.Comp.Ratio(stripIndex)
if err != nil {
return fmt.Errorf("Error getting strip Compressor ratio: %w", err)
}
cmd.Printf("Strip %d Compressor ratio: %.2f\n", stripIndex, currentRatio)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide a ratio")
}
ratio := mustConvToFloat64(args[1])
possibleValues := []float64{1.1, 1.3, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 7.0, 10, 20, 100}
if !contains(possibleValues, ratio) {
return fmt.Errorf("Invalid ratio value. Valid values are: %v", possibleValues)
}
err := client.Strip.Comp.SetRatio(stripIndex, ratio)
if err != nil {
return fmt.Errorf("Error setting strip Compressor ratio: %w", err)
}
cmd.Printf("Strip %d Compressor ratio set to %.2f\n", stripIndex, ratio)
return nil
},
}
// stripCompMixCmd represents the strip Compressor Mix command.
var stripCompMixCmd = &cobra.Command{
Short: "Get or set the Compressor mix for a strip",
Long: "Get or set the Compressor mix for a specific strip.",
Use: "mix [strip number] [mix percentage]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide a strip number")
}
stripIndex := mustConvToInt(args[0])
if len(args) == 1 {
currentMix, err := client.Strip.Comp.Mix(stripIndex)
if err != nil {
return fmt.Errorf("Error getting strip Compressor mix: %w", err)
}
cmd.Printf("Strip %d Compressor mix: %.2f%%\n", stripIndex, currentMix)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide a mix percentage")
}
mix := mustConvToFloat64(args[1])
err := client.Strip.Comp.SetMix(stripIndex, mix)
if err != nil {
return fmt.Errorf("Error setting strip Compressor mix: %w", err)
}
cmd.Printf("Strip %d Compressor mix set to %.2f%%\n", stripIndex, mix)
return nil
},
}
// stripCompMakeUpCmd represents the strip Compressor Make-Up Gain command.
var stripCompMakeUpCmd = &cobra.Command{
Short: "Get or set the Compressor make-up gain for a strip",
Long: "Get or set the Compressor make-up gain for a specific strip.",
Use: "makeup [strip number] [make-up gain in dB]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide a strip number")
}
stripIndex := mustConvToInt(args[0])
if len(args) == 1 {
currentMakeUp, err := client.Strip.Comp.MakeUp(stripIndex)
if err != nil {
return fmt.Errorf("Error getting strip Compressor make-up gain: %w", err)
}
cmd.Printf("Strip %d Compressor make-up gain: %.2f dB\n", stripIndex, currentMakeUp)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide a make-up gain in dB")
}
makeUp := mustConvToFloat64(args[1])
err := client.Strip.Comp.SetMakeUp(stripIndex, makeUp)
if err != nil {
return fmt.Errorf("Error setting strip Compressor make-up gain: %w", err)
}
cmd.Printf("Strip %d Compressor make-up gain set to %.2f dB\n", stripIndex, makeUp)
return nil
},
}
// stripCompAttackCmd represents the strip Compressor Attack command.
var stripCompAttackCmd = &cobra.Command{
Short: "Get or set the Compressor attack time for a strip",
Long: "Get or set the Compressor attack time for a specific strip.",
Use: "attack [strip number] [attack time in ms]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide a strip number")
}
stripIndex := mustConvToInt(args[0])
if len(args) == 1 {
currentAttack, err := client.Strip.Comp.Attack(stripIndex)
if err != nil {
return fmt.Errorf("Error getting strip Compressor attack time: %w", err)
}
cmd.Printf("Strip %d Compressor attack time: %.2f ms\n", stripIndex, currentAttack)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide an attack time in ms")
}
attack := mustConvToFloat64(args[1])
err := client.Strip.Comp.SetAttack(stripIndex, attack)
if err != nil {
return fmt.Errorf("Error setting strip Compressor attack time: %w", err)
}
cmd.Printf("Strip %d Compressor attack time set to %.2f ms\n", stripIndex, attack)
return nil
},
}
// stripCompHoldCmd represents the strip Compressor Hold command.
var stripCompHoldCmd = &cobra.Command{
Short: "Get or set the Compressor hold time for a strip",
Long: "Get or set the Compressor hold time for a specific strip.",
Use: "hold [strip number] [hold time in ms]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide a strip number")
}
stripIndex := mustConvToInt(args[0])
if len(args) == 1 {
currentHold, err := client.Strip.Comp.Hold(stripIndex)
if err != nil {
return fmt.Errorf("Error getting strip Compressor hold time: %w", err)
}
cmd.Printf("Strip %d Compressor hold time: %.2f ms\n", stripIndex, currentHold)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide a hold time in ms")
}
hold := mustConvToFloat64(args[1])
err := client.Strip.Comp.SetHold(stripIndex, hold)
if err != nil {
return fmt.Errorf("Error setting strip Compressor hold time: %w", err)
}
cmd.Printf("Strip %d Compressor hold time set to %.2f ms\n", stripIndex, hold)
return nil
},
}
// stripCompReleaseCmd represents the strip Compressor Release command.
var stripCompReleaseCmd = &cobra.Command{
Short: "Get or set the Compressor release time for a strip",
Long: "Get or set the Compressor release time for a specific strip.",
Use: "release [strip number] [release time in ms]",
RunE: func(cmd *cobra.Command, args []string) error {
client := ClientFromContext(cmd.Context())
if client == nil {
return fmt.Errorf("OSC client not found in context")
}
if len(args) < 1 {
return fmt.Errorf("Please provide a strip number")
}
stripIndex := mustConvToInt(args[0])
if len(args) == 1 {
currentRelease, err := client.Strip.Comp.Release(stripIndex)
if err != nil {
return fmt.Errorf("Error getting strip Compressor release time: %w", err)
}
cmd.Printf("Strip %d Compressor release time: %.2f ms\n", stripIndex, currentRelease)
return nil
}
if len(args) < 2 {
return fmt.Errorf("Please provide a release time in ms")
}
release := mustConvToFloat64(args[1])
err := client.Strip.Comp.SetRelease(stripIndex, release)
if err != nil {
return fmt.Errorf("Error setting strip Compressor release time: %w", err)
}
cmd.Printf("Strip %d Compressor release time set to %.2f ms\n", stripIndex, release)
return nil
},
}
func init() { func init() {
rootCmd.AddCommand(stripCmd) rootCmd.AddCommand(stripCmd)
@ -1049,11 +751,4 @@ func init() {
stripCmd.AddCommand(stripCompCmd) stripCmd.AddCommand(stripCompCmd)
stripCompCmd.AddCommand(stripCompOnCmd) stripCompCmd.AddCommand(stripCompOnCmd)
stripCompCmd.AddCommand(stripCompThresholdCmd)
stripCompCmd.AddCommand(stripCompRatioCmd)
stripCompCmd.AddCommand(stripCompMixCmd)
stripCompCmd.AddCommand(stripCompMakeUpCmd)
stripCompCmd.AddCommand(stripCompAttackCmd)
stripCompCmd.AddCommand(stripCompHoldCmd)
stripCompCmd.AddCommand(stripCompReleaseCmd)
} }

View File

@ -31,8 +31,3 @@ func indexOf[T comparable](slice []T, elem T) int {
} }
return -1 return -1
} }
// generic contains checks if elem is in slice.
func contains[T comparable](slice []T, elem T) bool {
return indexOf(slice, elem) != -1
}

24
go.mod
View File

@ -11,17 +11,17 @@ require (
require ( require (
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
github.com/charmbracelet/colorprofile v0.4.1 // indirect github.com/charmbracelet/colorprofile v0.3.3 // indirect
github.com/charmbracelet/lipgloss v1.1.0 // indirect github.com/charmbracelet/lipgloss v1.1.0 // indirect
github.com/charmbracelet/x/ansi v0.11.4 // indirect github.com/charmbracelet/x/ansi v0.10.3 // indirect
github.com/charmbracelet/x/cellbuf v0.0.14 // indirect github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
github.com/charmbracelet/x/term v0.2.2 // indirect github.com/charmbracelet/x/term v0.2.2 // indirect
github.com/clipperhouse/displaywidth v0.9.0 // indirect github.com/clipperhouse/displaywidth v0.4.1 // indirect
github.com/clipperhouse/stringish v0.1.1 // indirect github.com/clipperhouse/stringish v0.1.1 // indirect
github.com/clipperhouse/uax29/v2 v2.5.0 // indirect github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-logfmt/logfmt v0.6.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/lucasb-eyer/go-colorful v1.3.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
@ -29,15 +29,15 @@ require (
github.com/muesli/termenv v0.16.0 // indirect github.com/muesli/termenv v0.16.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/rivo/uniseg v0.4.7 // indirect github.com/rivo/uniseg v0.4.7 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect
github.com/spf13/afero v1.15.0 // indirect github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 // indirect golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
golang.org/x/sys v0.40.0 // indirect golang.org/x/sys v0.37.0 // indirect
golang.org/x/text v0.33.0 // indirect golang.org/x/text v0.28.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
) )

50
go.sum
View File

@ -1,23 +1,23 @@
github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk= github.com/charmbracelet/colorprofile v0.3.3 h1:DjJzJtLP6/NZ8p7Cgjno0CKGr7wwRJGxWUwh2IyhfAI=
github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk= github.com/charmbracelet/colorprofile v0.3.3/go.mod h1:nB1FugsAbzq284eJcjfah2nhdSLppN2NqvfotkfRYP4=
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
github.com/charmbracelet/log v0.4.2 h1:hYt8Qj6a8yLnvR+h7MwsJv/XvmBJXiueUcI3cIxsyig= github.com/charmbracelet/log v0.4.2 h1:hYt8Qj6a8yLnvR+h7MwsJv/XvmBJXiueUcI3cIxsyig=
github.com/charmbracelet/log v0.4.2/go.mod h1:qifHGX/tc7eluv2R6pWIpyHDDrrb/AG71Pf2ysQu5nw= github.com/charmbracelet/log v0.4.2/go.mod h1:qifHGX/tc7eluv2R6pWIpyHDDrrb/AG71Pf2ysQu5nw=
github.com/charmbracelet/x/ansi v0.11.4 h1:6G65PLu6HjmE858CnTUQY1LXT3ZUWwfvqEROLF8vqHI= github.com/charmbracelet/x/ansi v0.10.3 h1:3WoV9XN8uMEnFRZZ+vBPRy59TaIWa+gJodS4Vg5Fut0=
github.com/charmbracelet/x/ansi v0.11.4/go.mod h1:/5AZ+UfWExW3int5H5ugnsG/PWjNcSQcwYsHBlPFQN4= github.com/charmbracelet/x/ansi v0.10.3/go.mod h1:uQt8bOrq/xgXjlGcFMc8U2WYbnxyjrKhnvTQluvfCaE=
github.com/charmbracelet/x/cellbuf v0.0.14 h1:iUEMryGyFTelKW3THW4+FfPgi4fkmKnnaLOXuc+/Kj4= github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
github.com/charmbracelet/x/cellbuf v0.0.14/go.mod h1:P447lJl49ywBbil/KjCk2HexGh4tEY9LH0/1QrZZ9rA= github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk= github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI= github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
github.com/clipperhouse/displaywidth v0.9.0 h1:Qb4KOhYwRiN3viMv1v/3cTBlz3AcAZX3+y9OLhMtAtA= github.com/clipperhouse/displaywidth v0.4.1 h1:uVw9V8UDfnggg3K2U84VWY1YLQ/x2aKSCtkRyYozfoU=
github.com/clipperhouse/displaywidth v0.9.0/go.mod h1:aCAAqTlh4GIVkhQnJpbL0T/WfcrJXHcj8C0yjYcjOZA= github.com/clipperhouse/displaywidth v0.4.1/go.mod h1:R+kHuzaYWFkTm7xoMmK1lFydbci4X2CicfbGstSGg0o=
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs= github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA= github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
github.com/clipperhouse/uax29/v2 v2.5.0 h1:x7T0T4eTHDONxFJsL94uKNKPHrclyFI0lm7+w94cO8U= github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
github.com/clipperhouse/uax29/v2 v2.5.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g= github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@ -25,12 +25,12 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
github.com/go-logfmt/logfmt v0.6.1 h1:4hvbpePJKnIzH1B+8OR/JPbTx37NktoI9LE2QZBBkvE= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.1/go.mod h1:EV2pOAQoZaT1ZXZbqDl5hrymndi4SY9ED9/z6CO0XAk= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5 h1:fqwINudmUrvGCuw+e3tedZ2UJ0hklSw6t8UPomctKyQ= github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5 h1:fqwINudmUrvGCuw+e3tedZ2UJ0hklSw6t8UPomctKyQ=
github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5/go.mod h1:lqMjoCs0y0GoRRujSPZRBaGb4c5ER6TfkFKSClxkMbY= github.com/hypebeast/go-osc v0.0.0-20220308234300-cec5a8a1e5f5/go.mod h1:lqMjoCs0y0GoRRujSPZRBaGb4c5ER6TfkFKSClxkMbY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
@ -56,8 +56,10 @@ github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUc
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sagikazarmark/locafero v0.12.0 h1:/NQhBAkUb4+fH1jivKHWusDYFjMOOKU88eegjfxfHb4= github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc=
github.com/sagikazarmark/locafero v0.12.0/go.mod h1:sZh36u/YSZ918v0Io+U9ogLYQJ9tLLBmM4eneO6WwsI= github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw=
github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U=
github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
@ -77,13 +79,13 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavM
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
golang.org/x/exp v0.0.0-20260112195511-716be5621a96 h1:Z/6YuSHTLOHfNFdb8zVZomZr7cqNgTJvA8+Qz75D8gU= golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20260112195511-716be5621a96/go.mod h1:nzimsREAkjBCIEFtHiYkrJyT+2uy9YZJB7H1k68CXZU= golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.40.0 h1:DBZZqJ2Rkml6QMQsZywtnjnnGvHza6BTfYFWY9kjEWQ= golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ=
golang.org/x/sys v0.40.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
golang.org/x/text v0.33.0 h1:B3njUFyqtHDUI5jMn1YIr5B0IE2U0qck04r6d4KPAxE= golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
golang.org/x/text v0.33.0/go.mod h1:LuMebE6+rBincTi9+xWTY8TztLzKHc/9C1uBCG27+q8= golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=

View File

@ -48,162 +48,3 @@ func (c *Comp) SetOn(index int, on bool) error {
} }
return c.client.SendMessage(address, value) return c.client.SendMessage(address, value)
} }
// Threshold retrieves the threshold value of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) Threshold(index int) (float64, error) {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/thr"
err := c.client.SendMessage(address)
if err != nil {
return 0, err
}
resp := <-c.client.respChan
val, ok := resp.Arguments[0].(float32)
if !ok {
return 0, fmt.Errorf("unexpected argument type for Compressor threshold value")
}
return linGet(-60, 0, float64(val)), nil
}
// SetThreshold sets the threshold value of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) SetThreshold(index int, threshold float64) error {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/thr"
return c.client.SendMessage(address, float32(linSet(-60, 0, threshold)))
}
// Ratio retrieves the ratio value of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) Ratio(index int) (float32, error) {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/ratio"
err := c.client.SendMessage(address)
if err != nil {
return 0, err
}
possibleValues := []float32{1.1, 1.3, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 7.0, 10, 20, 100}
resp := <-c.client.respChan
val, ok := resp.Arguments[0].(int32)
if !ok {
return 0, fmt.Errorf("unexpected argument type for Compressor ratio value")
}
return possibleValues[val], nil
}
// SetRatio sets the ratio value of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) SetRatio(index int, ratio float64) error {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/ratio"
possibleValues := []float32{1.1, 1.3, 1.5, 2.0, 2.5, 3.0, 4.0, 5.0, 7.0, 10, 20, 100}
return c.client.SendMessage(address, int32(indexOf(possibleValues, float32(ratio))))
}
// Attack retrieves the attack time of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) Attack(index int) (float64, error) {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/attack"
err := c.client.SendMessage(address)
if err != nil {
return 0, err
}
resp := <-c.client.respChan
val, ok := resp.Arguments[0].(float32)
if !ok {
return 0, fmt.Errorf("unexpected argument type for Compressor attack value")
}
return linGet(0, 120, float64(val)), nil
}
// SetAttack sets the attack time of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) SetAttack(index int, attack float64) error {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/attack"
return c.client.SendMessage(address, float32(linSet(0, 120, attack)))
}
// Hold retrieves the hold time of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) Hold(index int) (float64, error) {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/hold"
err := c.client.SendMessage(address)
if err != nil {
return 0, err
}
resp := <-c.client.respChan
val, ok := resp.Arguments[0].(float32)
if !ok {
return 0, fmt.Errorf("unexpected argument type for Compressor hold value")
}
return logGet(0.02, 2000, float64(val)), nil
}
// SetHold sets the hold time of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) SetHold(index int, hold float64) error {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/hold"
return c.client.SendMessage(address, float32(logSet(0.02, 2000, hold)))
}
// Release retrieves the release time of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) Release(index int) (float64, error) {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/release"
err := c.client.SendMessage(address)
if err != nil {
return 0, err
}
resp := <-c.client.respChan
val, ok := resp.Arguments[0].(float32)
if !ok {
return 0, fmt.Errorf("unexpected argument type for Compressor release value")
}
return logGet(4, 4000, float64(val)), nil
}
// SetRelease sets the release time of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) SetRelease(index int, release float64) error {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/release"
return c.client.SendMessage(address, float32(logSet(4, 4000, release)))
}
// MakeUp retrieves the make-up gain of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) MakeUp(index int) (float64, error) {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/mgain"
err := c.client.SendMessage(address)
if err != nil {
return 0, err
}
resp := <-c.client.respChan
val, ok := resp.Arguments[0].(float32)
if !ok {
return 0, fmt.Errorf("unexpected argument type for Compressor make-up gain value")
}
return linGet(0, 24, float64(val)), nil
}
// SetMakeUp sets the make-up gain of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) SetMakeUp(index int, makeUp float64) error {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/mgain"
return c.client.SendMessage(address, float32(linSet(0, 24, makeUp)))
}
// Mix retrieves the mix value of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) Mix(index int) (float64, error) {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/mix"
err := c.client.SendMessage(address)
if err != nil {
return 0, err
}
resp := <-c.client.respChan
val, ok := resp.Arguments[0].(float32)
if !ok {
return 0, fmt.Errorf("unexpected argument type for Compressor mix value")
}
return linGet(0, 100, float64(val)), nil
}
// SetMix sets the mix value of the Compressor for a specific strip or bus (1-based indexing).
func (c *Comp) SetMix(index int, mix float64) error {
address := fmt.Sprintf(c.baseAddress, index) + "/dyn/mix"
return c.client.SendMessage(address, float32(linSet(0, 100, mix)))
}

View File

@ -56,13 +56,3 @@ func toFixed(num float64, precision int) float64 {
output := math.Pow(10, float64(precision)) output := math.Pow(10, float64(precision))
return float64(math.Round(num*output)) / output return float64(math.Round(num*output)) / output
} }
// generic indexOf returns the index of elem in slice, or -1 if not found.
func indexOf[T comparable](slice []T, elem T) int {
for i, v := range slice {
if v == elem {
return i
}
}
return -1
}