diff options
author | neauoire <[email protected]> | 2019-10-24 21:18:42 -0400 |
---|---|---|
committer | neauoire <[email protected]> | 2019-10-24 21:18:42 -0400 |
commit | 22e6fc0a43b1903ca64cfa9bb014f2b0a99593e5 (patch) | |
tree | 64593443185f862d0369b20fff5bb12d2c3c08c1 /desktop/sources/scripts/clock.js | |
parent | 75a95e3ddfe3f3ff7d45e3f2cad5a332a108eb0d (diff) | |
download | Orca-22e6fc0a43b1903ca64cfa9bb014f2b0a99593e5.tar.gz Orca-22e6fc0a43b1903ca64cfa9bb014f2b0a99593e5.zip |
Improved Midi controls
Diffstat (limited to 'desktop/sources/scripts/clock.js')
-rw-r--r-- | desktop/sources/scripts/clock.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/desktop/sources/scripts/clock.js b/desktop/sources/scripts/clock.js index 37f4a45..9baecd8 100644 --- a/desktop/sources/scripts/clock.js +++ b/desktop/sources/scripts/clock.js @@ -1,8 +1,6 @@ 'use strict' export default function Clock (terminal) { - const path = require('path') - this.isPaused = true this.timer = null this.isPuppet = false @@ -25,7 +23,7 @@ export default function Clock (terminal) { } this.setSpeed = function (value, target = null, setTimer = false) { - console.info('set') + console.info('Clock', 'set', value) if (value) { this.speed.value = clamp(value, 60, 300) } if (target) { this.speed.target = clamp(target, 60, 300) } if (setTimer === true) { this.setTimer(this.speed.value) } @@ -42,29 +40,29 @@ export default function Clock (terminal) { // Controls - this.togglePlay = function () { + this.togglePlay = function (msg = false) { if (this.isPaused === true) { - this.play() + this.play(msg) } else { - this.stop() + this.stop(msg) } } - this.play = function () { + this.play = function (msg = false) { console.log('Clock', 'Play') if (this.isPaused === false) { console.warn('Clock', 'Already playing'); return } if (this.isPuppet === true) { console.warn('Clock', 'External Midi control'); return } this.isPaused = false - terminal.io.midi.sendClockStart() + if (msg === true) { terminal.io.midi.sendClockStart() } this.setSpeed(this.speed.target, this.speed.target, true) } - this.stop = function () { + this.stop = function (msg = false) { console.log('Clock', 'Stop') if (this.isPaused === true) { console.warn('Clock', 'Already stopped'); return } if (this.isPuppet === true) { console.warn('Clock', 'External Midi control'); return } this.isPaused = true - terminal.io.midi.sendClockStop() + if (msg === true) { terminal.io.midi.sendClockStop() } terminal.io.midi.allNotesOff() this.clearTimer() terminal.io.midi.silence() |