diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-13 08:39:02 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-13 08:39:02 +0900 |
commit | c722670c2b2a8cf566a07b67bada76aaeaf7d808 (patch) | |
tree | 658ec7d6d9eee6c177dbd486beafb4351323fb19 | |
parent | 5b9a7a6a702903673da80d3a928114fbcf8eccd5 (diff) | |
download | Orca-c722670c2b2a8cf566a07b67bada76aaeaf7d808.tar.gz Orca-c722670c2b2a8cf566a07b67bada76aaeaf7d808.zip |
Added option to toggle midi clock, fixes #75
-rw-r--r-- | desktop/core/io/midi.js | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/desktop/core/io/midi.js b/desktop/core/io/midi.js index 070123a..91296cc 100644 --- a/desktop/core/io/midi.js +++ b/desktop/core/io/midi.js @@ -5,6 +5,8 @@ function Midi (terminal) { this.devices = [] this.stack = [] + this.sendClock = false + this.start = function () { console.info('Midi Starting..') this.setup() @@ -64,7 +66,7 @@ function Midi (terminal) { this.update = function () { terminal.controller.clearCat('default', 'Midi') - terminal.controller.add('default', 'Midi', `Refresh Device List`, () => { terminal.io.midi.setup(); terminal.io.midi.update() }, 'CmdOrCtrl+Shift+Alt+M') + terminal.controller.add('default', 'Midi', `Refresh Device List`, () => { terminal.io.midi.setup(); terminal.io.midi.update() }) const devices = terminal.io.midi.list() if (devices.length < 1) { terminal.controller.add('default', 'Midi', `No Device Available`) @@ -75,6 +77,7 @@ function Midi (terminal) { for (const id in devices) { terminal.controller.add('default', 'Midi', `${devices[id].name} ${terminal.io.midi.index === parseInt(id) ? ' — Active' : ''}`, () => { terminal.io.midi.select(id) }, '') } + terminal.controller.add('default', 'Midi', this.sendClock === true ? 'Mute Clock' : 'Send Clock', () => { terminal.io.midi.toggleClock() }, '') terminal.controller.commit() } @@ -84,6 +87,7 @@ function Midi (terminal) { this.clock = function (device) { if (!device) { return } + if (this.sendClock !== true) { return } const bpm = terminal.clock.speed.value const frameTime = (60000 / bpm) / 4 @@ -95,6 +99,11 @@ function Midi (terminal) { } } + this.toggleClock = function () { + this.sendClock = !this.sendClock + this.update() + } + // Tools this.select = function (id) { |