Skip to content

Commit

Permalink
global-launch-control: use system Launch Control midi port instead of…
Browse files Browse the repository at this point in the history
… hard coding

thanks for reporting @TimPietrusky
  • Loading branch information
mmckegg committed Feb 21, 2016
1 parent 063f1bd commit 133658c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 1 addition & 2 deletions nodes/global-launch-control/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,9 @@ module.exports = LaunchControl

function LaunchControl (context) {
var midiPort = MidiPort(context)
midiPort.set('Launch Control')

var obs = ObservStruct({
//port: midiPort
port: midiPort
})

var releases = []
Expand Down
12 changes: 7 additions & 5 deletions nodes/project/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ function Project (parentContext) {
var controllers = context.nodeInfo.groupLookup['global-controllers']
if (controllers) {
controllers.forEach(function (info) {
if (!info.portMatch || matchAny(portNames, info.portMatch)) {
var port = findMatch(portNames, info.portMatch)
if (!info.portMatch || port) {
result.push({
name: info.name,
node: info.node
node: info.node,
port: port
})
}
})
Expand Down Expand Up @@ -382,8 +384,8 @@ function copyExternalFilesTo (fs, path, target) {
})
}

function matchAny (array, match) {
return Array.isArray(array) && match && array.some(function (value) {
function findMatch (array, match) {
return Array.isArray(array) && match && array.filter(function (value) {
return match.exec(value)
})
})[0]
}

0 comments on commit 133658c

Please sign in to comment.