diff options
author | neauoire <[email protected]> | 2019-11-19 08:22:17 -0500 |
---|---|---|
committer | neauoire <[email protected]> | 2019-11-19 08:22:17 -0500 |
commit | 9c7e9a5b759e2b283febc1ab01562756476c7268 (patch) | |
tree | 0606c0543f70ebc5cb1e889f8d2c024afa148439 | |
parent | ca8bcf507b1baa2f70b4dee0d7f953087035d895 (diff) | |
download | Orca-9c7e9a5b759e2b283febc1ab01562756476c7268.tar.gz Orca-9c7e9a5b759e2b283febc1ab01562756476c7268.zip |
*
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/client.js | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/core/library.js | 107 | ||||
-rw-r--r-- | favicon.ico | bin | 0 -> 15086 bytes | |||
-rw-r--r-- | index.html | 2 | ||||
-rw-r--r-- | sw.js | 4 |
6 files changed, 59 insertions, 58 deletions
@@ -60,7 +60,7 @@ npm start - `?` **pb**(channel value): Sends MIDI pitch bench. - `;` **udp**: Sends UDP message. - `=` **osc**(*path*): Sends OSC message. -- `$` **self**: Sends a [command](#Commands) to itself. +- `$` **self**: Sends [ORCA command](#Commands). ## MIDI 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) diff --git a/favicon.ico b/favicon.ico Binary files differnew file mode 100644 index 0000000..21c0383 --- /dev/null +++ b/favicon.ico @@ -2,8 +2,8 @@ <head> <meta charset='utf-8'> <link rel="stylesheet" type="text/css" href="desktop/sources/links/style.css"/> - <link rel="icon" href="data:"> <link rel="manifest" href="manifest.json"> + <link rel="icon" href="favicon.ico"> <script type="text/javascript">function require(name){ console.warn('Failed to require '+name) }</script> @@ -33,7 +33,7 @@ self.addEventListener('install', async function () { const cache = await caches.open('Orca') assets.forEach(function (asset) { cache.add(asset).catch(function () { - console.error('[SW] Cound\'t cache:', asset) + console.error('serviceWorker','Cound not cache:', asset) }) }) }) @@ -46,7 +46,7 @@ self.addEventListener('fetch', async function (event) { async function cacheFirst (request) { const cachedResponse = await caches.match(request) if (cachedResponse === undefined) { - console.error('[SW] Not cached:', request.url) + console.error('serviceWorker','Not cached:', request.url) return fetch(request) } return cachedResponse |