main
Jurij Podgoršek 2022-04-23 16:13:34 +02:00
parent c63c329521
commit 36d86e323d
1 changed files with 16 additions and 0 deletions

View File

@ -52,6 +52,13 @@ const server = http.Server(app);
// Odprti serijski OSC link // Odprti serijski OSC link
let scon = null let scon = null
// Midi port
const mo = new midi.Output()
//mo.getPortCount()
//mo.getPortName(0)
//mo.openPort(0)
mo.openVirtualPort("kegel")
function openSerial() { function openSerial() {
console.log('opening ', tty, baudrate) console.log('opening ', tty, baudrate)
@ -231,6 +238,13 @@ const sendAll = (msg, info, oscWS, osclients) => {
}, 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 => { osclients.forEach( client => {
if (client && oscWS != client) { if (client && oscWS != client) {
// console.log("sending", msg, info) // console.log("sending", msg, info)
@ -275,3 +289,5 @@ wss.on('connection', function (ws) {
*/ */
}) })
// Zapri midi
mo.closePort()