osc: bundle received osc every 5 ms to avoid adding more randomness to the messages order
This commit is contained in:
parent
d81f0007de
commit
e42f14577d
2 changed files with 19 additions and 1 deletions
|
|
@ -70,6 +70,8 @@ var sendOsc = function(data){
|
|||
|
||||
}
|
||||
|
||||
var receiveOscQueue = []
|
||||
|
||||
var receiveOsc = function(data, info){
|
||||
|
||||
if (!data) return
|
||||
|
|
@ -80,12 +82,22 @@ var receiveOsc = function(data, info){
|
|||
|
||||
if (data.args.length==1) data.args = data.args[0]
|
||||
|
||||
ipc.send('receiveOsc',data)
|
||||
receiveOscQueue.push(data)
|
||||
|
||||
if (debug) console.log('OSC received: ', {address:data.address, args: data.args}, 'From : ' + data.host + ':' + data.port)
|
||||
|
||||
}
|
||||
|
||||
setInterval(()=>{
|
||||
|
||||
if (receiveOscQueue.length > 0) {
|
||||
ipc.send('bundle',receiveOscQueue)
|
||||
receiveOscQueue = []
|
||||
}
|
||||
|
||||
}, 5)
|
||||
|
||||
|
||||
var customModule = (function(){
|
||||
|
||||
if (!settings.read('customModule')) return false
|
||||
|
|
|
|||
|
|
@ -7,6 +7,12 @@ var init = require('./init'),
|
|||
|
||||
var callbacks = module.exports = {
|
||||
|
||||
bundle: function(data) {
|
||||
for (let i in data) {
|
||||
osc.receive(data[i])
|
||||
}
|
||||
},
|
||||
|
||||
receiveOsc: function(data){
|
||||
osc.receive(data)
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue