Skip to content

Instantly share code, notes, and snippets.

@nolili
Created September 25, 2015 17:41
Show Gist options
  • Save nolili/e88113f922b7a0ca0394 to your computer and use it in GitHub Desktop.
Save nolili/e88113f922b7a0ca0394 to your computer and use it in GitHub Desktop.
VVOSC + Swift
import UIKit
class ViewController: UIViewController {
var oscIn:OSCInPort!
var oscOut:OSCOutPort!
var oscManager:OSCManager!
func setupOSC () -> Void {
oscManager = OSCManager()
oscIn = oscManager.createNewInputForPort(12000)
oscOut = oscManager.createNewOutputToAddress("255.255.255.255", atPort: 7400)
oscManager.setDelegate(self)
}
override func viewDidLoad() {
super.viewDidLoad()
setupOSC()
}
func receivedOSCMessage(message:OSCMessage) -> Void {
dispatch_async(dispatch_get_main_queue()) {
print("received")
self.sendOSC()
}
}
func sendOSC() -> Void {
let message = OSCMessage(address: "/test")
oscOut.sendThisMessage(message)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment