WIP midi
parent
c63c329521
commit
36d86e323d
16
server.js
16
server.js
|
@ -52,6 +52,13 @@ const server = http.Server(app);
|
|||
// Odprti serijski OSC link
|
||||
let scon = null
|
||||
|
||||
// Midi port
|
||||
const mo = new midi.Output()
|
||||
//mo.getPortCount()
|
||||
//mo.getPortName(0)
|
||||
//mo.openPort(0)
|
||||
mo.openVirtualPort("kegel")
|
||||
|
||||
function openSerial() {
|
||||
console.log('opening ', tty, baudrate)
|
||||
|
||||
|
@ -231,6 +238,13 @@ const sendAll = (msg, info, oscWS, osclients) => {
|
|||
}, info, oscWS, osclients)
|
||||
}
|
||||
|
||||
if (msg.address == '/accel') {
|
||||
if (msg.args[1] > 5000) {
|
||||
console.log("SEND MIDI!")
|
||||
mo.sendMessage([176, 22, 1])
|
||||
}
|
||||
}
|
||||
|
||||
osclients.forEach( client => {
|
||||
if (client && oscWS != client) {
|
||||
// console.log("sending", msg, info)
|
||||
|
@ -275,3 +289,5 @@ wss.on('connection', function (ws) {
|
|||
*/
|
||||
})
|
||||
|
||||
// Zapri midi
|
||||
mo.closePort()
|
||||
|
|
Loading…
Reference in New Issue