aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDevine Lu Linvega <[email protected]>2019-07-18 14:14:12 +0900
committerDevine Lu Linvega <[email protected]>2019-07-18 14:14:12 +0900
commit8142a0fb0891b114b0d6609de0a250fc468c7ebf (patch)
treefce5c0704f191cc5eb73b6ab7c8e7ddda097caf3
parente4bc83cd2a094c12a0e1201eda01016fc336dbe4 (diff)
downloadOrca-8142a0fb0891b114b0d6609de0a250fc468c7ebf.tar.gz
Orca-8142a0fb0891b114b0d6609de0a250fc468c7ebf.zip
Fixed issue with function duplicate
-rw-r--r--desktop/sources/index.html8
-rw-r--r--desktop/sources/scripts/clock.js21
-rw-r--r--desktop/sources/scripts/commander.js4
3 files changed, 17 insertions, 16 deletions
diff --git a/desktop/sources/index.html b/desktop/sources/index.html
index 06ec0d4..6404b58 100644
--- a/desktop/sources/index.html
+++ b/desktop/sources/index.html
@@ -47,10 +47,10 @@
terminal.controller.add("default","Clock","Play/Pause",() => { terminal.clock.togglePlay() },"Space")
terminal.controller.add("default","Clock","Frame By Frame",() => { terminal.clock.touch() },"CmdOrCtrl+F")
terminal.controller.add("default","Clock","Reset Frame",() => { terminal.clock.resetFrame() },"CmdOrCtrl+R")
- terminal.controller.add("default","Clock","Incr. Speed",() => { terminal.clock.modTimer(1) },">")
- terminal.controller.add("default","Clock","Decr. Speed",() => { terminal.clock.modTimer(-1) },"<")
- terminal.controller.add("default","Clock","Incr. Speed(10x)",() => { terminal.clock.modTimer(10,true) },"CmdOrCtrl+>")
- terminal.controller.add("default","Clock","Decr. Speed(10x)",() => { terminal.clock.modTimer(-10,true) },"CmdOrCtrl+<")
+ terminal.controller.add("default","Clock","Incr. Speed",() => { terminal.clock.modSpeed(1) },">")
+ terminal.controller.add("default","Clock","Decr. Speed",() => { terminal.clock.modSpeed(-1) },"<")
+ terminal.controller.add("default","Clock","Incr. Speed(10x)",() => { terminal.clock.modSpeed(10,true) },"CmdOrCtrl+>")
+ terminal.controller.add("default","Clock","Decr. Speed(10x)",() => { terminal.clock.modSpeed(-10,true) },"CmdOrCtrl+<")
terminal.controller.add("default","View","Zoom In",() => { terminal.modZoom(0.0625) },"CmdOrCtrl+=")
terminal.controller.add("default","View","Zoom Out",() => { terminal.modZoom(-0.0625) },"CmdOrCtrl+-")
diff --git a/desktop/sources/scripts/clock.js b/desktop/sources/scripts/clock.js
index 23a6b94..24b7cdf 100644
--- a/desktop/sources/scripts/clock.js
+++ b/desktop/sources/scripts/clock.js
@@ -10,7 +10,7 @@ export default function Clock (terminal) {
this.speed = { value: 120, target: 120 }
this.start = function () {
- this.setTimer(120)
+ this.setSpeed(120)
this.play()
}
@@ -21,20 +21,21 @@ export default function Clock (terminal) {
this.run = function () {
if (this.speed.target === this.speed.value) { return }
- this.setTimer(this.speed.value + (this.speed.value < this.speed.target ? 1 : -1), null, true)
+ this.setSpeed(this.speed.value + (this.speed.value < this.speed.target ? 1 : -1), null, true)
}
- this.setTimer = function (value, target = null, setTimer = false) {
+ this.setSpeed = function (value, target = null, setTimer = false) {
+ console.info('set')
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) }
}
- this.modTimer = function (mod = 0, animate = false) {
+ this.modSpeed = function (mod = 0, animate = false) {
if (animate === true) {
- this.setTimer(null, this.speed.target + mod)
+ this.setSpeed(null, this.speed.target + mod)
} else {
- this.setTimer(this.speed.value + mod, this.speed.value + mod, true)
+ this.setSpeed(this.speed.value + mod, this.speed.value + mod, true)
terminal.update()
}
}
@@ -51,8 +52,8 @@ export default function Clock (terminal) {
this.play = function () {
console.log('Clock', 'Play')
- if (!this.isPaused) { console.warn('Clock', 'Already playing'); return }
- if (this.isPuppet) { console.warn('Clock', 'External Midi control'); return }
+ 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()
this.setTimer(this.speed.target, this.speed.target, true)
@@ -60,8 +61,8 @@ export default function Clock (terminal) {
this.stop = function () {
console.log('Clock', 'Stop')
- if (this.isPaused) { console.warn('Clock', 'Already stopped'); return }
- if (this.isPuppet) { console.warn('Clock', 'External Midi control'); return }
+ 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()
terminal.io.midi.allNotesOff()
diff --git a/desktop/sources/scripts/commander.js b/desktop/sources/scripts/commander.js
index 6c43136..e1f4509 100644
--- a/desktop/sources/scripts/commander.js
+++ b/desktop/sources/scripts/commander.js
@@ -165,8 +165,8 @@ export default function Commander (terminal) {
if (event.key === '[') { terminal.modGrid(-1, 0); event.preventDefault(); return }
if (event.key === '}') { terminal.modGrid(0, 1); event.preventDefault(); return }
if (event.key === '{') { terminal.modGrid(0, -1); event.preventDefault(); return }
- if (event.key === '>') { terminal.clock.modTimer(1); event.preventDefault(); return }
- if (event.key === '<') { terminal.clock.modTimer(-1); event.preventDefault(); return }
+ if (event.key === '>') { terminal.clock.modSpeed(1); event.preventDefault(); return }
+ if (event.key === '<') { terminal.clock.modSpeed(-1); event.preventDefault(); return }
// Route key to Operator or Cursor
terminal[this.isActive === true ? 'commander' : 'cursor'].write(event.key)