midi: handle errors from node, print and kill process
This commit is contained in:
parent
a8f19baad2
commit
22dbaafc61
2 changed files with 15 additions and 9 deletions
|
|
@ -18,6 +18,10 @@ oscToMidi = (data)=>{
|
|||
py.send(JSON.stringify([data.port, data.address, ...args]))
|
||||
}
|
||||
|
||||
stop = ()=>{
|
||||
py.childProcess.kill()
|
||||
}
|
||||
|
||||
init = (receiveOsc)=>{
|
||||
py.on('message', function (message) {
|
||||
// console.log(message)
|
||||
|
|
@ -31,13 +35,15 @@ init = (receiveOsc)=>{
|
|||
console.log(data)
|
||||
} else if (name == 'osc') {
|
||||
receiveOsc(data)
|
||||
} else if (name == 'error') {
|
||||
console.log('ERROR: Midi: ' + data)
|
||||
stop()
|
||||
process.exit()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
stop = ()=>{
|
||||
py.childProcess.kill()
|
||||
}
|
||||
|
||||
|
||||
module.exports = {
|
||||
send: oscToMidi,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue