diff options
-rw-r--r-- | desktop/sources/scripts/client.js | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/clock.js | 11 | ||||
-rw-r--r-- | desktop/sources/scripts/core/io/midi.js | 4 | ||||
-rw-r--r-- | desktop/sources/scripts/core/io/osc.js | 2 | ||||
-rw-r--r-- | desktop/sources/scripts/core/library.js | 30 | ||||
-rw-r--r-- | resources/listener.js | 2 | ||||
-rw-r--r-- | sw.js | 4 |
7 files changed, 32 insertions, 23 deletions
diff --git a/desktop/sources/scripts/client.js b/desktop/sources/scripts/client.js index 6af4247..47fc0e1 100644 --- a/desktop/sources/scripts/client.js +++ b/desktop/sources/scripts/client.js @@ -12,7 +12,7 @@ /* global Theme */ function Client () { - this.version = 177 + this.version = 178 this.library = library this.theme = new Theme(this) diff --git a/desktop/sources/scripts/clock.js b/desktop/sources/scripts/clock.js index 95086cf..d64272b 100644 --- a/desktop/sources/scripts/clock.js +++ b/desktop/sources/scripts/clock.js @@ -62,10 +62,10 @@ function Clock (client) { this.isPaused = false if (this.isPuppet === true) { console.warn('Clock', 'External Midi control') - if (!pulse.frame || midiStart) { // no frames counted while paused (starting from no clock, unlikely) or triggered by MIDI clock START - this.setFrame(0) // make sure frame aligns with pulse count for an accurate beat + if (!pulse.frame || midiStart) { // no frames counted while paused (starting from no clock, unlikely) or triggered by MIDI clock START + this.setFrame(0) // make sure frame aligns with pulse count for an accurate beat pulse.frame = 0 - pulse.count = 5 // by MIDI standard next pulse is the beat + pulse.count = 5 // by MIDI standard next pulse is the beat } } else { if (msg === true) { client.io.midi.sendClockStart() } @@ -93,7 +93,7 @@ function Clock (client) { count: 0, last: null, timer: null, - frame: 0 // paused frame counter + frame: 0 // paused frame counter } this.tap = function () { @@ -109,8 +109,7 @@ function Clock (client) { }, 2000) } if (pulse.count == 0) { - if (this.isPaused) { pulse.frame++ } - else { + if (this.isPaused) { pulse.frame++ } else { if (pulse.frame > 0) { this.setFrame(client.orca.f + pulse.frame) pulse.frame = 0 diff --git a/desktop/sources/scripts/core/io/midi.js b/desktop/sources/scripts/core/io/midi.js index 7f4875a..c5691aa 100644 --- a/desktop/sources/scripts/core/io/midi.js +++ b/desktop/sources/scripts/core/io/midi.js @@ -146,7 +146,7 @@ function Midi (client) { this.selectOutput = function (id) { if (id === -1) { this.outputIndex = -1; console.log('MIDI', 'Select Output Device: None'); return } - if (!this.outputs[id]) { console.warn('MIDI',`Unknown device with id ${id}`); return } + if (!this.outputs[id]) { console.warn('MIDI', `Unknown device with id ${id}`); return } this.outputIndex = parseInt(id) console.log('MIDI', `Select Output Device: ${this.outputDevice().name}`) @@ -155,7 +155,7 @@ function Midi (client) { this.selectInput = function (id) { if (this.inputDevice()) { this.inputDevice().onmidimessage = null } if (id === -1) { this.inputIndex = -1; console.log('MIDI', 'Select Input Device: None'); return } - if (!this.inputs[id]) { console.warn('MIDI',`Unknown device with id ${id}`); return } + if (!this.inputs[id]) { console.warn('MIDI', `Unknown device with id ${id}`); return } this.inputIndex = parseInt(id) this.inputDevice().onmidimessage = (msg) => { this.receive(msg) } diff --git a/desktop/sources/scripts/core/io/osc.js b/desktop/sources/scripts/core/io/osc.js index 635e2ea..7058d50 100644 --- a/desktop/sources/scripts/core/io/osc.js +++ b/desktop/sources/scripts/core/io/osc.js @@ -32,7 +32,7 @@ function Osc (client) { this.play = function ({ path, msg }) { if (!this.socket) { console.warn('OSC', 'Unavailable socket'); return } const oscMsg = new osc.Message(path) - for (var i = 0; i < msg.length; i++) { + for (let i = 0; i < msg.length; i++) { oscMsg.append(client.orca.valueOf(msg.charAt(i))) } this.socket.send(oscMsg, (err) => { diff --git a/desktop/sources/scripts/core/library.js b/desktop/sources/scripts/core/library.js index 9319ec1..fae31ba 100644 --- a/desktop/sources/scripts/core/library.js +++ b/desktop/sources/scripts/core/library.js @@ -168,12 +168,17 @@ library.j = function OperatorJ (orca, x, y, passive) { this.name = 'jumper' this.info = 'Outputs northward operand' - this.ports.val = { x: 0, y: -1 } - this.ports.output = { x: 0, y: 1, output: true } - this.operation = function (force = false) { - orca.lock(this.x, this.y + 1) - return this.listen(this.ports.val) + const val = this.listen({ x: 0, y: -1, output: true }) + if (val != this.glyph) { + let i = 0 + while (orca.inBounds(this.x, this.y + i)) { + if (this.listen({ x: 0, y: ++i }) != this.glyph) { break } + } + this.addPort('input', { x: 0, y: -1 }) + this.addPort('output', { x: 0, y: i, output: true }) + return val + } } } @@ -442,12 +447,17 @@ library.y = function OperatorY (orca, x, y, passive) { this.name = 'jymper' this.info = 'Outputs westward operand' - this.ports.val = { x: -1, y: 0 } - this.ports.output = { x: 1, y: 0, output: true } - this.operation = function (force = false) { - orca.lock(this.x + 1, this.y) - return this.listen(this.ports.val) + const val = this.listen({ x: -1, y: 0, output: true }) + if (val != this.glyph) { + let i = 0 + while (orca.inBounds(this.x + i, this.y)) { + if (this.listen({ x: ++i, y: 0 }) != this.glyph) { break } + } + this.addPort('input', { x: -1, y: 0 }) + this.addPort('output', { x: i, y: 0, output: true }) + return val + } } } diff --git a/resources/listener.js b/resources/listener.js index 582955a..d08829b 100644 --- a/resources/listener.js +++ b/resources/listener.js @@ -36,4 +36,4 @@ udpserver.bind(UDP_PORT) // Send a run message to orca -udpserver.send('run', 0, 3, 49160, IP_ADDR)
\ No newline at end of file +udpserver.send('run', 0, 3, 49160, IP_ADDR) @@ -30,7 +30,7 @@ self.addEventListener('install', async function () { const cache = await caches.open('Orca') assets.forEach(function (asset) { cache.add(asset).catch(function () { - console.error('serviceWorker','Cound not cache:', asset) + console.error('serviceWorker', 'Cound not cache:', asset) }) }) }) @@ -43,7 +43,7 @@ self.addEventListener('fetch', async function (event) { async function cacheFirst (request) { const cachedResponse = await caches.match(request) if (cachedResponse === undefined) { - console.error('serviceWorker','Not cached:', request.url) + console.error('serviceWorker', 'Not cached:', request.url) return fetch(request) } return cachedResponse |