Mercurial > hg > beaglert
annotate resources/osc/node_modules/osc-min/examples/printosc.coffee @ 556:ce391098f321 prerelease tip
THIS PROJECT HAS MOVED TO https://github.com/BelaPlatform/bela
author | Giulio Moro <giuliomoro@yahoo.it> |
---|---|
date | Sat, 25 Jun 2016 20:21:00 +0100 |
parents | fb9c28a4676b |
children |
rev | line source |
---|---|
l@271 | 1 osc = require 'osc-min' |
l@271 | 2 udp = require "dgram" |
l@271 | 3 |
l@271 | 4 if process.argv[2]? |
l@271 | 5 inport = parseInt process.argv[2] |
l@271 | 6 else |
l@271 | 7 inport = 41234 |
l@271 | 8 |
l@271 | 9 console.log "OSC listener running at http://localhost:" + inport |
l@271 | 10 |
l@271 | 11 `//~verbatim:examples[0]~ |
l@271 | 12 //### A simple OSC printer` |
l@271 | 13 sock = udp.createSocket "udp4", (msg, rinfo) -> |
l@271 | 14 try |
l@271 | 15 console.log osc.fromBuffer msg |
l@271 | 16 catch error |
l@271 | 17 console.log "invalid OSC packet" |
l@271 | 18 sock.bind inport |