Giter Site home page Giter Site logo

osckit's Introduction

OSCKit

A Swift framework for sending, receiving, and parsing OSC messages & bundles.

Largely inspired and adapted from Figure 53's F53OSC Library.

Added features include:

  • takeBundle() - OSCPacketDestinations are notified when an OSC bundle is received so that embedded messages and bundles can be acted upon asynchronously using the bundles timetag.
  • Multicasting - Servers can join & leave multicast groups.
  • OSC 1.0 & 1.1 Stream Framing.

For convenience, I've included a few public domain source files, Thanks and curiosity should rightfully be directed towards them:

CocoaAsyncSocket.
Swift-Netutils.

Demo

Inluded is a small demo app "Demo"

Quick Start

OSC Client

Step 1

Import OSCKit framework into your project

import OSCKit

Step 2

Create client

let client = OSCClient()
client.interface = "en0"
client.host = "10.101.100.101"
client.port = 3001
client.useTCP = true
client.delegate = self

Step 3

Conform to the Client Delegate Protocol's

OSCClientDelegate:

    func clientDidConnect(client: OSCClient) {
        print("Client did connect")
    }
    
    func clientDidDisconnect(client: OSCClient) {
        print("Client did disconnect")
    }

OSCPacketDestination:

    func take(message: OSCMessage) {
        print("Received message - \(message.addressPattern)")
    }
    
    func take(bundle: OSCBundle) {
        print("Received bundle - time tag: \(bundle.timeTag.hex() elements: \(bundle.elements.count)")
    }

Step 4

Create a message

let message = OSCMessage(messageWithAddressPattern: "/stamp/ping", arguments: [1, 3.142, "aStringArgument"])

Step 5

Send a message

client.send(packet: message)

osckit's People

Contributors

sammysmallman avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.