aboutsummaryrefslogtreecommitdiffhomepage
path: root/desktop
diff options
context:
space:
mode:
authorneauoire <[email protected]>2019-11-19 08:22:17 -0500
committerneauoire <[email protected]>2019-11-19 08:22:17 -0500
commit9c7e9a5b759e2b283febc1ab01562756476c7268 (patch)
tree0606c0543f70ebc5cb1e889f8d2c024afa148439 /desktop
parentca8bcf507b1baa2f70b4dee0d7f953087035d895 (diff)
downloadOrca-9c7e9a5b759e2b283febc1ab01562756476c7268.tar.gz
Orca-9c7e9a5b759e2b283febc1ab01562756476c7268.zip
*
Diffstat (limited to 'desktop')
-rw-r--r--desktop/sources/scripts/client.js2
-rw-r--r--desktop/sources/scripts/core/library.js107
2 files changed, 55 insertions, 54 deletions
diff --git a/desktop/sources/scripts/client.js b/desktop/sources/scripts/client.js
index 0e45fcf..ea58ac6 100644
--- a/desktop/sources/scripts/client.js
+++ b/desktop/sources/scripts/client.js
@@ -12,7 +12,7 @@
/* global Theme */
function Client () {
- this.version = 151
+ this.version = 152
this.library = library
this.theme = new Theme(this)
diff --git a/desktop/sources/scripts/core/library.js b/desktop/sources/scripts/core/library.js
index 7b82794..e4906bb 100644
--- a/desktop/sources/scripts/core/library.js
+++ b/desktop/sources/scripts/core/library.js
@@ -518,7 +518,7 @@ library.$ = function OperatorSelf (orca, x, y, passive) {
Operator.call(this, orca, x, y, '*', true)
this.name = 'self'
- this.info = 'Send command to itself'
+ this.info = 'Sends ORCA command'
this.run = function (force = false) {
let msg = ''
@@ -537,12 +537,47 @@ library.$ = function OperatorSelf (orca, x, y, passive) {
}
}
+library[':'] = function OperatorMidi (orca, x, y, passive) {
+ Operator.call(this, orca, x, y, ':', true)
+
+ this.name = 'midi'
+ this.info = 'Sends MIDI note'
+ this.ports.channel = { x: 1, y: 0 }
+ this.ports.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
+ this.ports.note = { x: 3, y: 0 }
+ this.ports.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
+ this.ports.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 16 } }
+
+ this.operation = function (force = false) {
+ if (!this.hasNeighbor('*') && force === false) { return }
+ if (this.listen(this.ports.channel) === '.') { return }
+ if (this.listen(this.ports.octave) === '.') { return }
+ if (this.listen(this.ports.note) === '.') { return }
+ if (!isNaN(this.listen(this.ports.note))) { return }
+
+ const channel = this.listen(this.ports.channel, true)
+ if (channel > 15) { return }
+ const octave = this.listen(this.ports.octave, true)
+ const note = this.listen(this.ports.note)
+ const velocity = this.listen(this.ports.velocity, true)
+ const length = this.listen(this.ports.length, true)
+
+ client.io.midi.push(channel, octave, note, velocity, length)
+
+ if (force === true) {
+ client.io.midi.run()
+ }
+
+ this.draw = false
+ }
+}
+
library['!'] = function OperatorCC (orca, x, y) {
Operator.call(this, orca, x, y, '!', true)
this.name = 'cc'
this.info = 'Sends MIDI control change'
- this.ports.channel = { x: 1, y: 0, clamp: { min: 0, max: 15 } }
+ this.ports.channel = { x: 1, y: 0 }
this.ports.knob = { x: 2, y: 0, clamp: { min: 0 } }
this.ports.value = { x: 3, y: 0, clamp: { min: 0 } }
@@ -552,6 +587,7 @@ library['!'] = function OperatorCC (orca, x, y) {
if (this.listen(this.ports.knob) === '.') { return }
const channel = this.listen(this.ports.channel, true)
+ if (channel > 15) { return }
const knob = this.listen(this.ports.knob, true)
const rawValue = this.listen(this.ports.value, true)
const value = Math.ceil((127 * rawValue) / 35)
@@ -566,38 +602,33 @@ library['!'] = function OperatorCC (orca, x, y) {
}
}
-library[':'] = function OperatorMidi (orca, x, y, passive) {
- Operator.call(this, orca, x, y, ':', true)
+library['?'] = function OperatorPB (orca, x, y) {
+ Operator.call(this, orca, x, y, '?', true)
- this.name = 'midi'
- this.info = 'Sends MIDI note'
- this.ports.channel = { x: 1, y: 0 }
- this.ports.octave = { x: 2, y: 0, clamp: { min: 0, max: 8 } }
- this.ports.note = { x: 3, y: 0 }
- this.ports.velocity = { x: 4, y: 0, default: 'f', clamp: { min: 0, max: 16 } }
- this.ports.length = { x: 5, y: 0, default: '1', clamp: { min: 0, max: 16 } }
+ this.name = 'pb'
+ this.info = 'Sends MIDI pitch bend'
+ this.ports.channel = { x: 1, y: 0, clamp: { min: 0, max: 15 } }
+ this.ports.lsb = { x: 2, y: 0, clamp: { min: 0 } }
+ this.ports.msb = { x: 3, y: 0, clamp: { min: 0 } }
this.operation = function (force = false) {
if (!this.hasNeighbor('*') && force === false) { return }
if (this.listen(this.ports.channel) === '.') { return }
- if (this.listen(this.ports.octave) === '.') { return }
- if (this.listen(this.ports.note) === '.') { return }
- if (!isNaN(this.listen(this.ports.note))) { return }
+ if (this.listen(this.ports.lsb) === '.') { return }
const channel = this.listen(this.ports.channel, true)
- if (channel > 15) { return }
- const octave = this.listen(this.ports.octave, true)
- const note = this.listen(this.ports.note)
- const velocity = this.listen(this.ports.velocity, true)
- const length = this.listen(this.ports.length, true)
+ const rawlsb = this.listen(this.ports.lsb, true)
+ const lsb = Math.ceil((127 * rawlsb) / 35)
+ const rawmsb = this.listen(this.ports.msb, true)
+ const msb = Math.ceil((127 * rawmsb) / 35)
- client.io.midi.push(channel, octave, note, velocity, length)
+ client.io.cc.stack.push({ channel, lsb, msb, type: 'pb' })
+
+ this.draw = false
if (force === true) {
- client.io.midi.run()
+ client.io.cc.run()
}
-
- this.draw = false
}
}
@@ -669,36 +700,6 @@ library['='] = function OperatorOsc (orca, x, y, passive) {
}
}
-library['?'] = function OperatorPB (orca, x, y) {
- Operator.call(this, orca, x, y, '?', true)
-
- this.name = 'cc'
- this.info = 'Sends MIDI pitch bend'
- this.ports.channel = { x: 1, y: 0, clamp: { min: 0, max: 15 } }
- this.ports.lsb = { x: 2, y: 0, clamp: { min: 0 } }
- this.ports.msb = { x: 3, y: 0, clamp: { min: 0 } }
-
- this.operation = function (force = false) {
- if (!this.hasNeighbor('*') && force === false) { return }
- if (this.listen(this.ports.channel) === '.') { return }
- if (this.listen(this.ports.lsb) === '.') { return }
-
- const channel = this.listen(this.ports.channel, true)
- const rawlsb = this.listen(this.ports.lsb, true)
- const lsb = Math.ceil((127 * rawlsb) / 35)
- const rawmsb = this.listen(this.ports.msb, true)
- const msb = Math.ceil((127 * rawmsb) / 35)
-
- client.io.cc.stack.push({ channel, lsb, msb, type: 'pb' })
-
- this.draw = false
-
- if (force === true) {
- client.io.cc.run()
- }
- }
-}
-
library[';'] = function OperatorUdp (orca, x, y, passive) {
Operator.call(this, orca, x, y, ';', true)