diff options
author | Devine Lu Linvega <[email protected]> | 2019-04-15 10:20:59 +0900 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2019-04-15 10:20:59 +0900 |
commit | 71e82de906cdb5567390c88cf420e12098e1e082 (patch) | |
tree | e2c1cb3e9c4ba938f722a5cf8e68edfdbb4fd370 | |
parent | 2b87806f73f25ee77c9854ed849e34913e47f159 (diff) | |
download | Orca-71e82de906cdb5567390c88cf420e12098e1e082.tar.gz Orca-71e82de906cdb5567390c88cf420e12098e1e082.zip |
R now has default values
-rw-r--r-- | desktop/core/library/r.js | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/clock.js | 14 |
2 files changed, 8 insertions, 8 deletions
diff --git a/desktop/core/library/r.js b/desktop/core/library/r.js index 6f5b325..a590cdd 100644 --- a/desktop/core/library/r.js +++ b/desktop/core/library/r.js @@ -15,7 +15,7 @@ function OperatorR (orca, x, y, passive) { this.run = function () { const min = this.listen(this.ports.input.min, true) const max = this.listen(this.ports.input.max, true) - const val = parseInt((Math.random() * (max - min)) + min) + const val = parseInt((Math.random() * ((max || 10) - min)) + min) const res = orca.keyOf(val) this.output(`${res}`) } diff --git a/desktop/sources/scripts/clock.js b/desktop/sources/scripts/clock.js index f5d5beb..3c500c1 100644 --- a/desktop/sources/scripts/clock.js +++ b/desktop/sources/scripts/clock.js @@ -12,7 +12,10 @@ function Clock (terminal) { } this.update = function () { - this.animate() + // Animate + if (this.speed.target !== this.speed.value) { + this.set(this.speed.value + (this.speed.value < this.speed.target ? 1 : -1), null, true) + } } this.set = function (value, target = null, setTimer = false) { @@ -30,11 +33,6 @@ function Clock (terminal) { } } - this.animate = function () { - if (this.speed.target === this.speed.value) { return } - this.set(this.speed.value + (this.speed.value < this.speed.target ? 1 : -1), null, true) - } - // Controls this.togglePlay = function () { @@ -60,6 +58,8 @@ function Clock (terminal) { this.clearTimer() } + // Midi Tap + this.intervals = [] this.lastTap = 0 @@ -71,7 +71,7 @@ function Clock (terminal) { const sum = this.intervals.reduce((sum, interval) => { return sum + interval }) const bpm = parseInt((1000 / sum) * 60) if (Math.abs(bpm - this.speed.target) > 3) { - this.speed.target = clamp(bpm,60,300) + this.set(null, bpm) } } |