aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-04-17 13:03:23 +0900
committerDevine Lu Linvega <[email protected]>2019-04-17 13:03:23 +0900
commit5570ab3ea4ac002a7d46011d040a606baa08f0fd (patch)
tree1b0b0497c7b739c9f45600b8c85b31df9978c26e
parenta247a8d43090a5f9484e20eea6b37adce3601aa3 (diff)
downloadOrca-5570ab3ea4ac002a7d46011d040a606baa08f0fd.tar.gz
Orca-5570ab3ea4ac002a7d46011d040a606baa08f0fd.zip
Hand over clock to daw
-rw-r--r--desktop/core/io/midi.js4
-rw-r--r--desktop/sources/scripts/clock.js8
2 files changed, 7 insertions, 5 deletions
diff --git a/desktop/core/io/midi.js b/desktop/core/io/midi.js
index 5e815c9..86b2e2d 100644
--- a/desktop/core/io/midi.js
+++ b/desktop/core/io/midi.js
@@ -117,8 +117,10 @@ function Midi (terminal) {
switch (msg.data[0]) {
case 0xF8:
this.count = (this.count + 1) % 6
- if (this.count % 4 === 0) {
+ if (this.count % 8 === 0) {
+ terminal.clock.stop()
terminal.clock.tap()
+ terminal.run()
}
break
case 0xFA:
diff --git a/desktop/sources/scripts/clock.js b/desktop/sources/scripts/clock.js
index 8516bf4..41d44de 100644
--- a/desktop/sources/scripts/clock.js
+++ b/desktop/sources/scripts/clock.js
@@ -44,14 +44,14 @@ function Clock (terminal) {
}
this.play = function () {
- if (!this.isPaused) { console.warn('Already playing'); return }
+ if (!this.isPaused) { return }
console.log('Clock', 'Play')
this.isPaused = false
this.set(this.speed.target, this.speed.target, true)
}
this.stop = function () {
- if (this.isPaused) { console.warn('Already stopped'); return }
+ if (this.isPaused) { return }
console.log('Clock', 'Stop')
terminal.io.midi.silence()
this.isPaused = true
@@ -69,8 +69,8 @@ function Clock (terminal) {
}
if (this.intervals.length === 8) {
const sum = this.intervals.reduce((sum, interval) => { return sum + interval })
- const bpm = Math.floor((1000 / sum) * 60)
- this.set(null, bpm)
+ const bpm = Math.floor((1000 / sum) * 60) * 2
+ this.set(bpm, bpm)
}
const now = performance.now()