enable revive linter

- add package comments
- fix redeclaration of built-in min/max
- add comments to exported types
- remove unused parameters
This commit is contained in:
onyx-and-iris 2026-02-15 12:22:22 +00:00
parent ac8f635263
commit 7a0d5c56e5
17 changed files with 71 additions and 59 deletions

View File

@ -6,8 +6,7 @@ run:
go: '1.24'
linters:
disable:
[dupl, errcheck, goconst, godot, revive, staticcheck, unparam, predeclared]
disable: [dupl, errcheck, goconst, godot, staticcheck, unparam, predeclared]
enable:
# Default enabled linters
- errcheck # Check for unchecked errors

View File

@ -1,3 +1,4 @@
// Package main implements the command-line interface for controlling an X32 digital mixer.
package main
import (
@ -161,7 +162,7 @@ type MainEqOnCmd struct {
}
// Run executes the MainEqOnCmd command, either retrieving the current EQ on/off state of the Main L/R output or setting it based on the provided argument.
func (cmd *MainEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainEqOnCmd) Run(ctx *context) error {
if cmd.Enable == nil {
resp, err := ctx.Client.Main.Eq.On(0)
if err != nil {
@ -184,7 +185,7 @@ type MainEqBandGainCmd struct {
}
// Run executes the MainEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main L/R output or setting it based on the provided argument.
func (cmd *MainEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandGainCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Level == nil {
resp, err := ctx.Client.Main.Eq.Gain(0, *mainEq.Band.Band)
if err != nil {
@ -212,7 +213,7 @@ 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.
func (cmd *MainEqBandFreqCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandFreqCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Frequency == nil {
resp, err := ctx.Client.Main.Eq.Frequency(0, *mainEq.Band.Band)
if err != nil {
@ -244,7 +245,7 @@ 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.
func (cmd *MainEqBandQCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandQCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Q == nil {
resp, err := ctx.Client.Main.Eq.Q(0, *mainEq.Band.Band)
if err != nil {
@ -271,7 +272,7 @@ type MainEqBandTypeCmd struct {
}
// Run executes the MainEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main L/R output or setting it based on the provided argument.
func (cmd *MainEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandTypeCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Type == nil {
resp, err := ctx.Client.Main.Eq.Type(0, *mainEq.Band.Band)
if err != nil {
@ -307,7 +308,7 @@ type MainCompOnCmd struct {
}
// Run executes the MainCompOnCmd command, either retrieving the current compressor on/off state of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompOnCmd) Run(ctx *context) error {
if cmd.Enable == nil {
resp, err := ctx.Client.Main.Comp.On(0)
if err != nil {
@ -330,7 +331,7 @@ type MainCompModeCmd struct {
}
// Run executes the MainCompModeCmd command, either retrieving the current compressor mode of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompModeCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompModeCmd) Run(ctx *context) error {
if cmd.Mode == nil {
resp, err := ctx.Client.Main.Comp.Mode(0)
if err != nil {
@ -353,7 +354,7 @@ type MainCompThresholdCmd struct {
}
// Run executes the MainCompThresholdCmd command, either retrieving the current compressor threshold of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompThresholdCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompThresholdCmd) Run(ctx *context) error {
if cmd.Threshold == nil {
resp, err := ctx.Client.Main.Comp.Threshold(0)
if err != nil {
@ -376,7 +377,7 @@ type MainCompRatioCmd struct {
}
// Run executes the MainCompRatioCmd command, either retrieving the current compressor ratio of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompRatioCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompRatioCmd) Run(ctx *context) error {
if cmd.Ratio == nil {
resp, err := ctx.Client.Main.Comp.Ratio(0)
if err != nil {
@ -399,7 +400,7 @@ type MainCompMixCmd struct {
}
// Run executes the MainCompMixCmd command, either retrieving the current compressor mix level of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompMixCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompMixCmd) Run(ctx *context) error {
if cmd.Mix == nil {
resp, err := ctx.Client.Main.Comp.Mix(0)
if err != nil {
@ -422,7 +423,7 @@ type MainCompMakeupCmd struct {
}
// Run executes the MainCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompMakeupCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompMakeupCmd) Run(ctx *context) error {
if cmd.Makeup == nil {
resp, err := ctx.Client.Main.Comp.Makeup(0)
if err != nil {
@ -445,7 +446,7 @@ type MainCompAttackCmd struct {
}
// Run executes the MainCompAttackCmd command, either retrieving the current compressor attack time of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompAttackCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompAttackCmd) Run(ctx *context) error {
if cmd.Attack == nil {
resp, err := ctx.Client.Main.Comp.Attack(0)
if err != nil {
@ -468,7 +469,7 @@ type MainCompHoldCmd struct {
}
// Run executes the MainCompHoldCmd command, either retrieving the current compressor hold time of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompHoldCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompHoldCmd) Run(ctx *context) error {
if cmd.Hold == nil {
resp, err := ctx.Client.Main.Comp.Hold(0)
if err != nil {
@ -491,7 +492,7 @@ type MainCompReleaseCmd struct {
}
// Run executes the MainCompReleaseCmd command, either retrieving the current compressor release time of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompReleaseCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompReleaseCmd) Run(ctx *context) error {
if cmd.Release == nil {
resp, err := ctx.Client.Main.Comp.Release(0)
if err != nil {

View File

@ -161,7 +161,7 @@ type MainMonoEqOnCmd struct {
}
// Run executes the MainMonoEqOnCmd command, either retrieving the current EQ on/off state of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoEqOnCmd) Run(ctx *context) error {
if cmd.Enable == nil {
resp, err := ctx.Client.MainMono.Eq.On(0)
if err != nil {
@ -186,7 +186,6 @@ 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.
func (cmd *MainMonoEqBandGainCmd) Run(
ctx *context,
main *MainCmdGroup,
mainEq *MainMonoEqCmdGroup,
) error {
if cmd.Level == nil {
@ -218,7 +217,6 @@ 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.
func (cmd *MainMonoEqBandFreqCmd) Run(
ctx *context,
main *MainCmdGroup,
mainEq *MainMonoEqCmdGroup,
) error {
if cmd.Frequency == nil {
@ -262,7 +260,6 @@ 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.
func (cmd *MainMonoEqBandQCmd) Run(
ctx *context,
main *MainCmdGroup,
mainEq *MainMonoEqCmdGroup,
) error {
if cmd.Q == nil {
@ -293,7 +290,6 @@ 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.
func (cmd *MainMonoEqBandTypeCmd) Run(
ctx *context,
main *MainCmdGroup,
mainEq *MainMonoEqCmdGroup,
) error {
if cmd.Type == nil {
@ -331,7 +327,7 @@ type MainMonoCompOnCmd struct {
}
// Run executes the MainMonoCompOnCmd command, either retrieving the current compressor on/off state of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompOnCmd) Run(ctx *context) error {
if cmd.Enable == nil {
resp, err := ctx.Client.MainMono.Comp.On(0)
if err != nil {
@ -354,7 +350,7 @@ type MainMonoCompModeCmd struct {
}
// Run executes the MainMonoCompModeCmd command, either retrieving the current compressor mode of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompModeCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompModeCmd) Run(ctx *context) error {
if cmd.Mode == nil {
resp, err := ctx.Client.MainMono.Comp.Mode(0)
if err != nil {
@ -377,7 +373,7 @@ type MainMonoCompThresholdCmd struct {
}
// Run executes the MainMonoCompThresholdCmd command, either retrieving the current compressor threshold of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompThresholdCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompThresholdCmd) Run(ctx *context) error {
if cmd.Threshold == nil {
resp, err := ctx.Client.MainMono.Comp.Threshold(0)
if err != nil {
@ -400,7 +396,7 @@ type MainMonoCompRatioCmd struct {
}
// Run executes the MainMonoCompRatioCmd command, either retrieving the current compressor ratio of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompRatioCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompRatioCmd) Run(ctx *context) error {
if cmd.Ratio == nil {
resp, err := ctx.Client.MainMono.Comp.Ratio(0)
if err != nil {
@ -423,7 +419,7 @@ type MainMonoCompMixCmd struct {
}
// Run executes the MainMonoCompMixCmd command, either retrieving the current compressor mix level of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompMixCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompMixCmd) Run(ctx *context) error {
if cmd.Mix == nil {
resp, err := ctx.Client.MainMono.Comp.Mix(0)
if err != nil {
@ -446,7 +442,7 @@ type MainMonoCompMakeupCmd struct {
}
// Run executes the MainMonoCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompMakeupCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompMakeupCmd) Run(ctx *context) error {
if cmd.Makeup == nil {
resp, err := ctx.Client.MainMono.Comp.Makeup(0)
if err != nil {
@ -469,7 +465,7 @@ type MainMonoCompAttackCmd struct {
}
// Run executes the MainMonoCompAttackCmd command, either retrieving the current compressor attack time of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompAttackCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompAttackCmd) Run(ctx *context) error {
if cmd.Attack == nil {
resp, err := ctx.Client.MainMono.Comp.Attack(0)
if err != nil {
@ -492,7 +488,7 @@ type MainMonoCompHoldCmd struct {
}
// Run executes the MainMonoCompHoldCmd command, either retrieving the current compressor hold time of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompHoldCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompHoldCmd) Run(ctx *context) error {
if cmd.Hold == nil {
resp, err := ctx.Client.MainMono.Comp.Hold(0)
if err != nil {
@ -515,7 +511,7 @@ type MainMonoCompReleaseCmd struct {
}
// Run executes the MainMonoCompReleaseCmd command, either retrieving the current compressor release time of the Main Mono output or setting it based on the provided argument.
func (cmd *MainMonoCompReleaseCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainMonoCompReleaseCmd) Run(ctx *context) error {
if cmd.Release == nil {
resp, err := ctx.Client.MainMono.Comp.Release(0)
if err != nil {

View File

@ -1,3 +1,4 @@
// Package main implements the command-line interface for controlling an XAir digital mixer.
package main
import (
@ -161,7 +162,7 @@ type MainEqOnCmd struct {
}
// Run executes the MainEqOnCmd command, either retrieving the current EQ on/off state of the Main L/R output or setting it based on the provided argument.
func (cmd *MainEqOnCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainEqOnCmd) Run(ctx *context) error {
if cmd.Enable == nil {
resp, err := ctx.Client.Main.Eq.On(0)
if err != nil {
@ -184,7 +185,7 @@ type MainEqBandGainCmd struct {
}
// Run executes the MainEqBandGainCmd command, either retrieving the current gain of a specific EQ band on the Main L/R output or setting it based on the provided argument.
func (cmd *MainEqBandGainCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandGainCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Level == nil {
resp, err := ctx.Client.Main.Eq.Gain(0, *mainEq.Band.Band)
if err != nil {
@ -212,7 +213,7 @@ 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.
func (cmd *MainEqBandFreqCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandFreqCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Frequency == nil {
resp, err := ctx.Client.Main.Eq.Frequency(0, *mainEq.Band.Band)
if err != nil {
@ -244,7 +245,7 @@ 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.
func (cmd *MainEqBandQCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandQCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Q == nil {
resp, err := ctx.Client.Main.Eq.Q(0, *mainEq.Band.Band)
if err != nil {
@ -271,7 +272,7 @@ type MainEqBandTypeCmd struct {
}
// Run executes the MainEqBandTypeCmd command, either retrieving the current type of a specific EQ band on the Main L/R output or setting it based on the provided argument.
func (cmd *MainEqBandTypeCmd) Run(ctx *context, main *MainCmdGroup, mainEq *MainEqCmdGroup) error {
func (cmd *MainEqBandTypeCmd) Run(ctx *context, mainEq *MainEqCmdGroup) error {
if cmd.Type == nil {
resp, err := ctx.Client.Main.Eq.Type(0, *mainEq.Band.Band)
if err != nil {
@ -307,7 +308,7 @@ type MainCompOnCmd struct {
}
// Run executes the MainCompOnCmd command, either retrieving the current compressor on/off state of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompOnCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompOnCmd) Run(ctx *context) error {
if cmd.Enable == nil {
resp, err := ctx.Client.Main.Comp.On(0)
if err != nil {
@ -330,7 +331,7 @@ type MainCompModeCmd struct {
}
// Run executes the MainCompModeCmd command, either retrieving the current compressor mode of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompModeCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompModeCmd) Run(ctx *context) error {
if cmd.Mode == nil {
resp, err := ctx.Client.Main.Comp.Mode(0)
if err != nil {
@ -353,7 +354,7 @@ type MainCompThresholdCmd struct {
}
// Run executes the MainCompThresholdCmd command, either retrieving the current compressor threshold of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompThresholdCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompThresholdCmd) Run(ctx *context) error {
if cmd.Threshold == nil {
resp, err := ctx.Client.Main.Comp.Threshold(0)
if err != nil {
@ -376,7 +377,7 @@ type MainCompRatioCmd struct {
}
// Run executes the MainCompRatioCmd command, either retrieving the current compressor ratio of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompRatioCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompRatioCmd) Run(ctx *context) error {
if cmd.Ratio == nil {
resp, err := ctx.Client.Main.Comp.Ratio(0)
if err != nil {
@ -399,7 +400,7 @@ type MainCompMixCmd struct {
}
// Run executes the MainCompMixCmd command, either retrieving the current compressor mix level of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompMixCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompMixCmd) Run(ctx *context) error {
if cmd.Mix == nil {
resp, err := ctx.Client.Main.Comp.Mix(0)
if err != nil {
@ -422,7 +423,7 @@ type MainCompMakeupCmd struct {
}
// Run executes the MainCompMakeupCmd command, either retrieving the current compressor makeup gain of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompMakeupCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompMakeupCmd) Run(ctx *context) error {
if cmd.Makeup == nil {
resp, err := ctx.Client.Main.Comp.Makeup(0)
if err != nil {
@ -445,7 +446,7 @@ type MainCompAttackCmd struct {
}
// Run executes the MainCompAttackCmd command, either retrieving the current compressor attack time of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompAttackCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompAttackCmd) Run(ctx *context) error {
if cmd.Attack == nil {
resp, err := ctx.Client.Main.Comp.Attack(0)
if err != nil {
@ -468,7 +469,7 @@ type MainCompHoldCmd struct {
}
// Run executes the MainCompHoldCmd command, either retrieving the current compressor hold time of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompHoldCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompHoldCmd) Run(ctx *context) error {
if cmd.Hold == nil {
resp, err := ctx.Client.Main.Comp.Hold(0)
if err != nil {
@ -491,7 +492,7 @@ type MainCompReleaseCmd struct {
}
// Run executes the MainCompReleaseCmd command, either retrieving the current compressor release time of the Main L/R output or setting it based on the provided argument.
func (cmd *MainCompReleaseCmd) Run(ctx *context, main *MainCmdGroup) error {
func (cmd *MainCompReleaseCmd) Run(ctx *context) error {
if cmd.Release == nil {
resp, err := ctx.Client.Main.Comp.Release(0)
if err != nil {

View File

@ -2,6 +2,7 @@ package xair
import "fmt"
// Bus represents the bus parameters of the mixer.
type Bus struct {
client *client
baseAddress string

View File

@ -1,3 +1,4 @@
// Package xair provides a client for controlling XAir and X32 mixers using OSC messages.
package xair
import (
@ -9,7 +10,7 @@ import (
)
// XAirClient is a client for controlling XAir mixers.
type XAirClient struct {
type XAirClient struct { // nolint: revive
client
Main *Main
Strip *Strip
@ -40,7 +41,7 @@ func NewXAirClient(mixerIP string, mixerPort int, opts ...EngineOption) (*XAirCl
}
// X32Client is a client for controlling X32 mixers.
type X32Client struct {
type X32Client struct { // nolint: revive
client
Main *Main
MainMono *Main
@ -79,7 +80,7 @@ type client struct {
Info InfoResponse
}
// Start begins listening for messages in a goroutine.
// StartListening begins listening for messages in a goroutine.
func (c *client) StartListening() {
go c.receiveLoop()
log.Debugf("Started listening on %s...", c.engine.conn.LocalAddr().String())

View File

@ -2,6 +2,7 @@ package xair
import "fmt"
// DCA represents the DCA group parameters of the mixer.
type DCA struct {
client *client
baseAddress string

View File

@ -55,6 +55,7 @@ func (e *Eq) SetOn(index int, on bool) error {
return e.client.SendMessage(address, value)
}
// Mode retrieves the EQ mode for a specific strip or bus (1-based indexing).
func (e *Eq) Mode(index int) (string, error) {
address := e.AddressFunc(e.baseAddress, index) + "/mode"
err := e.client.SendMessage(address)
@ -75,6 +76,7 @@ func (e *Eq) Mode(index int) (string, error) {
return possibleModes[val], nil
}
// SetMode sets the EQ mode for a specific strip or bus (1-based indexing).
func (e *Eq) SetMode(index int, mode string) error {
address := e.AddressFunc(e.baseAddress, index) + "/mode"
possibleModes := []string{"peq", "geq", "teq"}

View File

@ -2,6 +2,7 @@ package xair
import "fmt"
// HeadAmp represents the headphone amplifier parameters of the mixer.
type HeadAmp struct {
client *client
baseAddress string

View File

@ -2,6 +2,7 @@ package xair
import "fmt"
// Main represents the main output parameters of the mixer.
type Main struct {
client *client
baseAddress string
@ -11,7 +12,7 @@ type Main struct {
// newMainStereo creates a new Main instance for stereo main output.
func newMainStereo(c *client) *Main {
addressFunc := func(fmtString string, args ...any) string {
addressFunc := func(fmtString string, _ ...any) string {
return fmtString
}
@ -25,7 +26,7 @@ func newMainStereo(c *client) *Main {
// newMainMono creates a new MainMono instance for mono main output (X32 only).
func newMainMono(c *client) *Main {
addressFunc := func(fmtString string, args ...any) string {
addressFunc := func(fmtString string, _ ...any) string {
return fmtString
}

View File

@ -2,6 +2,7 @@ package xair
import "fmt"
// Matrix represents the matrix parameters of the mixer.
type Matrix struct {
client *client
baseAddress string

View File

@ -1,5 +1,6 @@
package xair
// InfoResponse represents the response from the /info OSC address, containing details about the X-Air device.
type InfoResponse struct {
Host string
Name string

View File

@ -2,6 +2,7 @@ package xair
import "time"
// EngineOption defines a functional option for configuring the engine.
type EngineOption func(*engine)
// WithTimeout sets the timeout duration for OSC message responses.
@ -11,6 +12,7 @@ func WithTimeout(timeout time.Duration) EngineOption {
}
}
// CompOption defines a functional option for configuring Comp parameters.
type CompOption func(*Comp)
// WithCompAddressFunc allows customization of the OSC address formatting for Comp parameters.
@ -20,6 +22,7 @@ func WithCompAddressFunc(f func(fmtString string, args ...any) string) CompOptio
}
}
// EqOption defines a functional option for configuring Eq parameters.
type EqOption func(*Eq)
// WithEqAddressFunc allows customization of the OSC address formatting for Eq parameters.
@ -29,6 +32,7 @@ func WithEqAddressFunc(f func(fmtString string, args ...any) string) EqOption {
}
}
// GateOption defines a functional option for configuring Gate parameters.
type GateOption func(*Gate)
// WithGateAddressFunc allows customization of the OSC address formatting for Gate parameters.

View File

@ -16,7 +16,7 @@ func newParser() *xairParser {
return &xairParser{}
}
// parseOSCMessage parses raw bytes into an OSC message with improved error handling.
// Parse parses raw bytes into an OSC message with improved error handling.
func (p *xairParser) Parse(data []byte) (*osc.Message, error) {
log.Debug("=== PARSING OSC MESSAGE BEGIN ===")
defer log.Debug("=== PARSING OSC MESSAGE END ===")

View File

@ -2,6 +2,7 @@ package xair
import "fmt"
// Snapshot represents a snapshot of the mixer's state, allowing for saving and recalling settings.
type Snapshot struct {
client *client
baseAddress string

View File

@ -2,6 +2,7 @@ package xair
import "fmt"
// Strip represents an input channel strip on the mixer.
type Strip struct {
client *client
baseAddress string
@ -43,7 +44,7 @@ func (s *Strip) Mute(index int) (bool, error) {
// SetMute sets the mute status of the specified strip (1-based indexing).
func (s *Strip) SetMute(strip int, muted bool) error {
address := fmt.Sprintf(s.baseAddress, strip) + "/mix/on"
var value int32 = 0
var value int32
if !muted {
value = 1
}

View File

@ -2,20 +2,20 @@ package xair
import "math"
func linGet(min, max, value float64) float64 {
return min + (max-min)*value
func linGet(minVal, maxVal, value float64) float64 {
return minVal + (maxVal-minVal)*value
}
func linSet(min, max, value float64) float64 {
return (value - min) / (max - min)
func linSet(minVal, maxVal, value float64) float64 {
return (value - minVal) / (maxVal - minVal)
}
func logGet(min, max, value float64) float64 {
return min * math.Exp(math.Log(max/min)*value)
func logGet(minVal, maxVal, value float64) float64 {
return minVal * math.Exp(math.Log(maxVal/minVal)*value)
}
func logSet(min, max, value float64) float64 {
return math.Log(value/min) / math.Log(max/min)
func logSet(minVal, maxVal, value float64) float64 {
return math.Log(value/minVal) / math.Log(maxVal/minVal)
}
func mustDbInto(db float64) float64 {