midi: make sure the process terminates when closing the app main window
This commit is contained in:
parent
8fbcdce320
commit
eaa0ef0651
3 changed files with 9 additions and 11 deletions
|
|
@ -29,6 +29,7 @@ var start = function(readyApp) {
|
|||
var win = require('./electron-window')({address:address, shortcuts:true})
|
||||
app.on('before-quit',()=>{
|
||||
win.destroy()
|
||||
if (osc.midi) osc.midi.stop()
|
||||
})
|
||||
return win
|
||||
} else {
|
||||
|
|
@ -36,6 +37,7 @@ var start = function(readyApp) {
|
|||
var win = require('./electron-window')({address:address, shortcuts:true})
|
||||
app.on('before-quit',()=>{
|
||||
win.destroy()
|
||||
if (osc.midi) osc.midi.stop()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,15 +6,6 @@ var PythonShell = require('python-shell'),
|
|||
var py = new PythonShell(path.resolve('/main/midi.py'),{mode:'text', args: settings.read('midi')})
|
||||
|
||||
|
||||
|
||||
// py.send('zefezf')
|
||||
//
|
||||
//
|
||||
// py.on('error', function (message) {
|
||||
// // received a message sent from the Python script (a simple "print" statement)
|
||||
// console.log('error:' +message);
|
||||
// });
|
||||
|
||||
oscToMidi = (data)=>{
|
||||
var args = []
|
||||
for (i in data.args) {
|
||||
|
|
@ -41,8 +32,12 @@ init = (receiveOsc)=>{
|
|||
})
|
||||
}
|
||||
|
||||
stop = ()=>{
|
||||
py.childProcess.kill()
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
send: oscToMidi,
|
||||
init: init
|
||||
init: init,
|
||||
stop: stop
|
||||
}
|
||||
|
|
|
|||
|
|
@ -179,5 +179,6 @@ module.exports = {
|
|||
|
||||
sendOsc(data)
|
||||
|
||||
}
|
||||
},
|
||||
midi:midi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue