mirror of
https://github.com/onyx-and-iris/xair-cli.git
synced 2026-04-09 02:13:35 +00:00
implement Snapshot on Client struct
This commit is contained in:
@@ -3,6 +3,7 @@ package xair
|
||||
import (
|
||||
"fmt"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
"github.com/charmbracelet/log"
|
||||
|
||||
@@ -15,10 +16,11 @@ type parser interface {
|
||||
|
||||
type Client struct {
|
||||
engine
|
||||
Main *Main
|
||||
Strip *Strip
|
||||
Bus *Bus
|
||||
HeadAmp *HeadAmp
|
||||
Main *Main
|
||||
Strip *Strip
|
||||
Bus *Bus
|
||||
HeadAmp *HeadAmp
|
||||
Snapshot *Snapshot
|
||||
}
|
||||
|
||||
// NewClient creates a new XAirClient instance
|
||||
@@ -85,6 +87,20 @@ func (c *Client) SendMessage(address string, args ...any) error {
|
||||
return c.engine.sendToAddress(c.mixerAddr, address, args...)
|
||||
}
|
||||
|
||||
// ReceiveMessage receives an OSC message from the mixer
|
||||
func (c *Client) ReceiveMessage(timeout time.Duration) (*osc.Message, error) {
|
||||
t := time.Tick(timeout)
|
||||
select {
|
||||
case <-t:
|
||||
return nil, nil
|
||||
case val := <-c.respChan:
|
||||
if val == nil {
|
||||
return nil, fmt.Errorf("no message received")
|
||||
}
|
||||
return val, nil
|
||||
}
|
||||
}
|
||||
|
||||
// RequestInfo requests mixer information
|
||||
func (c *Client) RequestInfo() (error, InfoResponse) {
|
||||
err := c.SendMessage("/xinfo")
|
||||
|
||||
Reference in New Issue
Block a user