Mercurial > hg > beaglert
annotate resources/osc/node_modules/osc-min/examples/printosc.coffee @ 298:634c1d1f37bc Doxy prerelease
Techno world example to _main.pd for libpd testing
author | Robert Jack <robert.h.jack@gmail.com> |
---|---|
date | Fri, 27 May 2016 12:30:44 +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 |