gosc: bitbucket.org/liamstask/gosc Index | Files

package osc

import "bitbucket.org/liamstask/gosc"

gosc provides a pure Go package for sending and receiving OpenSoundControl messages.

Sending messages is a matter of writing a Message to the appropriate io.Writer (net/UDPConn is a common transport), and a simple UDPServer is provided for receiving Messages.

Address pattern matching is also supported.

See the OSC spec at http://opensoundcontrol.org/spec-1_0 for more detail.


Package Files

osc.go pattern.go udpserver.go

func Equal Uses

func Equal(a, b *Message) bool

Equal returns a boolean reporting whether a == b, by comparing the Address and the contents of all Args

func Handle Uses

func Handle(pattern string, h Handler)

func HandleFunc Uses

func HandleFunc(pattern string, handler func(*Message))

func ListenAndServeUDP Uses

func ListenAndServeUDP(addr string, dispatcher Dispatcher) error

func PatternMatch Uses

func PatternMatch(pattern, test string) bool

Determines whether pattern (typically the Address of an incoming Message) matches test (typically the Address of a registered handler).

Pattern matching semantics are described in the OSC spec (http://opensoundcontrol.org/spec-1_0) in the section entitled "OSC Message Dispatching and Pattern Matching".

type Bundle Uses

type Bundle struct {
    Timetag  time.Time
    Messages []*Message

A collection of OSC Messages. It's often more efficient to send multiple messages as a Bundle as they can all be included in the same transmission to the receiver.

func ReadFrom Uses

func ReadFrom(r io.Reader) (bndl *Bundle, err error)

ReadFrom retrieves a Bundle from the given io.Reader. In the event that the incoming packet is a single message, the returned Bundle will contain a single Message with its Timetag set to 'immediate'

func (*Bundle) WriteTo Uses

func (b *Bundle) WriteTo(w io.Writer) (n int, err error)

WriteTo writes b to w.

type Dispatcher Uses

type Dispatcher interface {

type Handler Uses

type Handler interface {

type HandlerFunc Uses

type HandlerFunc func(*Message)

func (HandlerFunc) HandleOSC Uses

func (f HandlerFunc) HandleOSC(m *Message)

type Message Uses

type Message struct {
    Address string
    Args    []interface{}

A single OSC message. Args is a slice of arguments, each of which may be one of the following types: int32, float32, string, bool, nil, or []byte (ie, an OSC 'blob')

func (*Message) WriteTo Uses

func (m *Message) WriteTo(w io.Writer) (n int, err error)

WriteTo writes m to w.

type ServeMux Uses

type ServeMux struct {
    // contains filtered or unexported fields

func NewServeMux Uses

func NewServeMux() *ServeMux

func (*ServeMux) Dispatch Uses

func (mux *ServeMux) Dispatch(b *Bundle)

func (*ServeMux) Handle Uses

func (mux *ServeMux) Handle(pattern string, handler Handler)

type UDPServer Uses

type UDPServer struct {
    Address     string        // UDP address to listen on
    Dispatcher  Dispatcher    // Dispatcher to invoke, osc.defaultServeMux if nil
    ReadTimeout time.Duration // maximum duration before timing out read of the request

func (*UDPServer) ListenAndServe Uses

func (s *UDPServer) ListenAndServe() error

Package osc imports 9 packages (graph) and is imported by 1 packages. Updated 2016-07-21. Refresh now. Tools for package owners.