aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-04-15 09:18:28 +0900
committerDevine Lu Linvega <[email protected]>2019-04-15 09:18:28 +0900
commit661044ff19c6656d2cd3d1dfc7ca0519d8386ef3 (patch)
tree185fd378bad49cf866bf5fefe17cd5f3c5e9c8e8
parentc76707358b0819bcd213bb0da2bd680edf35f3e1 (diff)
downloadOrca-661044ff19c6656d2cd3d1dfc7ca0519d8386ef3.tar.gz
Orca-661044ff19c6656d2cd3d1dfc7ca0519d8386ef3.zip
Removed old midi device()
-rw-r--r--desktop/core/io/cc.js12
-rw-r--r--desktop/core/io/midi.js12
2 files changed, 9 insertions, 15 deletions
diff --git a/desktop/core/io/cc.js b/desktop/core/io/cc.js
index 5355d65..6dac10a 100644
--- a/desktop/core/io/cc.js
+++ b/desktop/core/io/cc.js
@@ -4,7 +4,7 @@ function MidiCC (terminal) {
this.stack = []
this.start = function () {
- console.info('MidiCC Starting..')
+ console.info('MidiCC', 'Starting..')
}
this.clear = function () {
@@ -22,12 +22,10 @@ function MidiCC (terminal) {
}
this.play = function (data) {
- const device = terminal.io.midi.device()
- if (device) {
- device.send([0xb0 + data[0], 64 + data[1], data[2]])
- } else {
- console.warn(`No Midi device.`)
- }
+ const device = terminal.io.midi.outputDevice()
+ if (!device) { console.warn('MidiCC', `No Midi device.`); return }
+
+ device.send([0xb0 + data[0], 64 + data[1], data[2]])
}
}
diff --git a/desktop/core/io/midi.js b/desktop/core/io/midi.js
index 9e568df..4ff3833 100644
--- a/desktop/core/io/midi.js
+++ b/desktop/core/io/midi.js
@@ -62,13 +62,13 @@ function Midi (terminal) {
}
this.trigger = function (item, down) {
- if (!this.device()) { console.warn('No midi device!'); return }
+ if (!this.outputDevice()) { console.warn('Midi', 'No midi output!'); return }
const channel = down === true ? 0x90 + item[0] : 0x80 + item[0]
const note = 24 + (item[1] * 12) + item[2]
const velocity = item[3]
- this.device().send([channel, note, velocity])
+ this.outputDevice().send([channel, note, velocity])
item[5] = true
}
@@ -97,7 +97,7 @@ function Midi (terminal) {
this.ticks = []
// TODO
this.sendClock = function () {
- if (!this.device()) { return }
+ if (!this.outputDevice()) { return }
if (this.sendClock !== true) { return }
const bpm = terminal.clock.speed.value
@@ -106,7 +106,7 @@ function Midi (terminal) {
for (let id = 0; id < 6; id++) {
if (this.ticks[id]) { clearTimeout(this.ticks[id]) }
- this.ticks[id] = setTimeout(() => { this.device().send([0xF8], 0) }, parseInt(id) * frameFrag)
+ this.ticks[id] = setTimeout(() => { this.outputDevice().send([0xF8], 0) }, parseInt(id) * frameFrag)
}
}
@@ -154,10 +154,6 @@ function Midi (terminal) {
console.log('Midi', `Input Device: ${this.inputDevice().name}`)
}
- this.device = function () {
- return this.outputs[this.outputIndex]
- }
-
this.outputDevice = function () {
return this.outputs[this.outputIndex]
}