Skip to content

Commit

Permalink
void rehearsal updates
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpalumbo committed Jan 26, 2021
1 parent 50a7a7a commit dc558c7
Show file tree
Hide file tree
Showing 5 changed files with 2,309 additions and 380 deletions.
38 changes: 36 additions & 2 deletions allhands_fact_max.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// const argv = yargs(hideBin(process.argv)).argv
const Max = require('max-api')

const sortArray = require('sort-array')
// UDP send/receive
let localsend = null;
let localreceive = null;
Expand Down Expand Up @@ -248,7 +249,7 @@ if (mode === "server"){
localSend.send('/iplocation', newTTS, (err) => {
if (err) console.error(err);
});
// Max.post(newTTS)
Max.outlet('/iplocation', newTTS)
}


Expand All @@ -268,7 +269,7 @@ if (mode === "server"){
localSend.send(msg.addressPattern, msg.typeTagString, (err) => {
if (err) console.error(err);
});
// Max.outlet(msg.addressPattern, msg.typeTagString)
Max.outlet(msg.addressPattern, msg.typeTagString)
}


Expand All @@ -287,8 +288,23 @@ if (mode === "server"){
case 'pingReport':
// console.log(msg.data)
let remotes = Object.keys(msg.data)
let pingDict = []
Max.outlet('pings', msg.data)
let delayTap = ''
let counter = 60
for(i=0;i<remotes.length;i++){
Max.outlet('pingTimes', msg.data)
// delayTap = delayTap + '-' + remotes[i] + '-' + msg.data[remotes[i]]
counter++
counter++
counter++
counter++
let thisPing = {
name: remotes[i],
latency: msg.data[remotes[i]],
MIDI: counter
}
pingDict.push(thisPing)
// console.log(remotes[i], msg.data[remotes[i]])
let ap = '/latency/' + remotes[i]
let tts = msg.data[remotes[i]]
Expand All @@ -298,11 +314,29 @@ if (mode === "server"){
if(name == remotes[i]){
Max.outlet('thisPing', tts)
}
sortArray(pingDict, {
by: 'latency',
order: 'desc'
})





}

sortArray(pingDict, {
by: 'latency',
order: 'desc'
})

for(i=0;i<pingDict.length;i++){
delayTap = delayTap + '-' + pingDict[i].name + '-' + pingDict[i].latency + '-' + pingDict[i].MIDI

}
//delayTap = delayTap.toString()
Max.outlet('delayTap', delayTap)

break
default:
// inform user that unknown message commang used
Expand Down
Loading

0 comments on commit dc558c7

Please sign in to comment.