From ea9bf36496d8fcf3e96673200e88b90934db7e51 Mon Sep 17 00:00:00 2001 From: Mendel Greenberg Date: Thu, 30 Dec 2021 02:59:49 -0500 Subject: [PATCH] fix: resolume isn't osc spec compliant When resolume is asked for the name of an empty clip, it returns a null byte as the name, while I'm not sure what they should put instead, it is technically not compliant. --- go.mod | 2 ++ main.go | 27 +++++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index a65e669..ada4ffc 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,8 @@ require ( nhooyr.io/websocket v1.8.7 ) +//replace github.com/chabad360/go-osc => ../go-osc + require ( github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/main.go b/main.go index 41bc027..a7700b9 100644 --- a/main.go +++ b/main.go @@ -39,13 +39,13 @@ var ( p = pure.New() httpServer *http.Server conn net.PacketConn - buf = bytes.NewBuffer(make([]byte, 0, 65535)) - wg sync.WaitGroup - running bool - message = &osc.Message{Arguments: []interface{}{"?"}} - client *net.UDPConn - b = new(bytes.Buffer) - t = time.Tick(time.Minute) + //buf = bytes.NewBuffer(make([]byte, 0, 65535)) + wg sync.WaitGroup + running bool + message = &osc.Message{Arguments: []interface{}{"?"}} + client *net.UDPConn + b = new(bytes.Buffer) + t = time.Tick(time.Minute) ) func main() { @@ -178,20 +178,23 @@ func listenOSC(conn net.PacketConn, wg *sync.WaitGroup) { if errors.Is(err, net.ErrClosed) { return } + continue } if packet != nil { - switch p := packet.(type) { + fmt.Println(packet) + switch data := packet.(type) { default: continue case *osc.Message: - procMsg(p) + fmt.Println(data) + procMsg(data) case *osc.Bundle: - for _, p := range p.Elements { - switch p := p.(type) { + for _, elem := range data.Elements { + switch data := elem.(type) { case *osc.Message: - procMsg(p) + procMsg(data) case *osc.Bundle: panic("stop nesting bundles") }