Created
September 25, 2015 17:41
-
-
Save nolili/e88113f922b7a0ca0394 to your computer and use it in GitHub Desktop.
VVOSC + Swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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