first osc msg tests
This commit is contained in:
@@ -374,4 +374,11 @@ function Library (ronin) {
|
||||
console.log(`time taken: ${Date.now() - start}ms`)
|
||||
return result
|
||||
}
|
||||
|
||||
// osc
|
||||
|
||||
this.osc = () => { // Returns a rect of the frame.
|
||||
return ronin.getOsc()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
const osc = require('osc')
|
||||
|
||||
function Ronin () {
|
||||
const defaultTheme = {
|
||||
background: '#111',
|
||||
@@ -20,6 +22,7 @@ function Ronin () {
|
||||
this.surface = new Surface(this)
|
||||
this.library = new Library(this)
|
||||
|
||||
this.oscMsg = {}
|
||||
// Parameters
|
||||
|
||||
this.always = false
|
||||
@@ -43,9 +46,31 @@ function Ronin () {
|
||||
this.source.start()
|
||||
this.commander.start()
|
||||
this.surface.start()
|
||||
|
||||
var udpPort = new osc.UDPPort({
|
||||
localAddress: "0.0.0.0",
|
||||
localPort: 57121,
|
||||
metadata: true
|
||||
});
|
||||
|
||||
udpPort.on("message", this.onOscMsg)
|
||||
|
||||
udpPort.open();
|
||||
this.log("started")
|
||||
|
||||
console.log('Ronin', 'Started')
|
||||
}
|
||||
|
||||
this.onOscMsg = (oscMsg, timeTag, info) => {
|
||||
this.oscMsg = oscMsg;
|
||||
console.log("An OSC message just arrived!", oscMsg)
|
||||
this.log("Remote info is: ", info);
|
||||
}
|
||||
|
||||
this.getOsc = function() {
|
||||
return this.oscMsg;
|
||||
}
|
||||
|
||||
this.reset = function () {
|
||||
this.theme.reset()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user