upd strip send docstrings/help messages

This commit is contained in:
onyx-and-iris 2026-02-11 09:26:23 +00:00
parent 6615eec466
commit e0f5392674
3 changed files with 34 additions and 18 deletions

View File

@ -140,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
} }

View File

@ -140,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
} }

View File

@ -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)))