aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-06-02 08:16:27 +0900
committerDevine Lu Linvega <[email protected]>2019-06-02 08:16:27 +0900
commit6006198032fa2b831852b327fb0eb6a2766e8f23 (patch)
tree7c05ba51e616c4f50b0959eb86007ae35b8d8000
parent3c7aa4636c38045aab522f1d077609bb78010e36 (diff)
downloadOrca-6006198032fa2b831852b327fb0eb6a2766e8f23.tar.gz
Orca-6006198032fa2b831852b327fb0eb6a2766e8f23.zip
Fixes issue #126
-rw-r--r--desktop/core/io/midi.js9
-rw-r--r--desktop/sources/scripts/terminal.js2
2 files changed, 6 insertions, 5 deletions
diff --git a/desktop/core/io/midi.js b/desktop/core/io/midi.js
index b9ddf7c..3e9f429 100644
--- a/desktop/core/io/midi.js
+++ b/desktop/core/io/midi.js
@@ -42,6 +42,8 @@ export default function Midi (terminal) {
const transposed = this.transpose(item.note, item.octave)
const channel = terminal.orca.valueOf(item.channel)
+ if(!transposed){ return }
+
const c = down === true ? 0x90 + channel : 0x80 + channel
const n = transposed.id
const v = parseInt((item.velocity / 16) * 127)
@@ -218,13 +220,12 @@ export default function Midi (terminal) {
// UI
this.transpose = function (n, o = 3) {
- if (!transpose[n]) { return { note: n, octave: o } }
+ if (!transpose[n]) { return null }
+ const octave = clamp(parseInt(o) + parseInt(transpose[n].charAt(1)), 0, 8)
const note = transpose[n].charAt(0)
- const octave = clamp(parseInt(transpose[n].charAt(1)) + o, 0, 8)
const value = ['C', 'c', 'D', 'd', 'E', 'F', 'f', 'G', 'g', 'A', 'a', 'B'].indexOf(note)
const id = clamp((octave * 12) + value + 24, 0, 127)
- const real = id < 89 ? Object.keys(transpose)[id - 45] : null
- return { id, value, note, octave, real }
+ return { id, value, note, octave }
}
this.toString = function () {
diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js
index 6881f9c..d4563c0 100644
--- a/desktop/sources/scripts/terminal.js
+++ b/desktop/sources/scripts/terminal.js
@@ -12,7 +12,7 @@ import Controller from './lib/controller.js'
import library from '../../core/library.js'
export default function Terminal () {
- this.version = 133
+ this.version = 134
this.library = library
this.orca = new Orca(this)