diff options
author | Devine Lu Linvega <[email protected]> | 2019-03-30 00:58:55 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-03-30 00:58:55 +0900 |
commit | d9465c7cb8050afcee9afb19317cf68564b55c35 (patch) | |
tree | 52780fb3d61312892c5df490d513c750e4b9f31a | |
parent | 7af79a9e4ab52a007e4abc6402206324615c358e (diff) | |
download | Orca-d9465c7cb8050afcee9afb19317cf68564b55c35.tar.gz Orca-d9465c7cb8050afcee9afb19317cf68564b55c35.zip |
Improved MidiCC Trigger mode
-rw-r--r-- | desktop/core/library/_cc.js | 8 | ||||
-rw-r--r-- | desktop/sources/scripts/cursor.js | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/io.cc.js | 7 |
3 files changed, 9 insertions, 8 deletions
diff --git a/desktop/core/library/_cc.js b/desktop/core/library/_cc.js index ad1ad04..d2f86b1 100644 --- a/desktop/core/library/_cc.js +++ b/desktop/core/library/_cc.js @@ -11,14 +11,18 @@ function OperatorCC (orca, x, y) { this.ports.haste.channel = { x: 1, y: 0 } this.ports.haste.value = { x: 2, y: 0 } - this.run = function () { - if (!this.bang()) { return } + this.run = function (force = false) { + if (!this.bang() && force === false) { return } const channel = this.listen(this.ports.haste.channel, true) const rawValue = this.listen(this.ports.haste.value, true) const val = Math.ceil((127 * rawValue) / 36) terminal.io.cc.send(channel, val) + + if (force === true) { + terminal.io.cc.run() + } } } diff --git a/desktop/sources/scripts/cursor.js b/desktop/sources/scripts/cursor.js index a43106a..889df05 100644 --- a/desktop/sources/scripts/cursor.js +++ b/desktop/sources/scripts/cursor.js @@ -100,7 +100,7 @@ function Cursor (terminal) { this.trigger = function () { const operator = terminal.orca.operatorAt(this.x, this.y) if (operator) { - operator.run() + operator.run(true) } } diff --git a/desktop/sources/scripts/io.cc.js b/desktop/sources/scripts/io.cc.js index 5c52866..6e13b8a 100644 --- a/desktop/sources/scripts/io.cc.js +++ b/desktop/sources/scripts/io.cc.js @@ -24,11 +24,8 @@ function MidiCC (terminal) { this.play = function (data) { const device = terminal.io.midi.device() if (device) { - let channel = data[1] - let value = data[2] - device.send([0xb0, 64 + channel, value]) - } - else{ + device.send([0xb0, 64 + data[0], data[1]]) + } else { console.warn(`No Midi device.`) } } |