diff options
author | Devine Lu Linvega <[email protected]> | 2018-10-17 21:24:51 +1200 |
---|---|---|
committer | Devine Lu Linvega <[email protected]> | 2018-10-17 21:24:51 +1200 |
commit | 181c7738f1d8bd135f0378570beaf6f5c8028fcf (patch) | |
tree | 1a2b6d1ad712a896e7cff0c533bf2680b66dfd87 | |
parent | 52e6e67458b86fb3b249fd79d8126a206b84da23 (diff) | |
download | Orca-181c7738f1d8bd135f0378570beaf6f5c8028fcf.tar.gz Orca-181c7738f1d8bd135f0378570beaf6f5c8028fcf.zip |
Stack midi nodes on frame
-rw-r--r-- | desktop/core/lib/__qqq.js | 3 | ||||
-rw-r--r-- | desktop/sources/scripts/qqq.js | 16 | ||||
-rw-r--r-- | desktop/sources/scripts/terminal.js | 2 |
3 files changed, 18 insertions, 3 deletions
diff --git a/desktop/core/lib/__qqq.js b/desktop/core/lib/__qqq.js index b4f10c5..69aaa95 100644 --- a/desktop/core/lib/__qqq.js +++ b/desktop/core/lib/__qqq.js @@ -21,10 +21,11 @@ function FnQqq (pico, x, y) { if (!n) { return } const e = this.east() + const channel = 3 const octave = !e ? 3 : this.convert(e.glyph) const note = this.convert(n.glyph) const velocity = 127 - terminal.qqq.send(octave, note, velocity) + terminal.qqq.send(channel, octave, note, velocity) } this.convert = function (glyph) { diff --git a/desktop/sources/scripts/qqq.js b/desktop/sources/scripts/qqq.js index 1797ef7..9bf071c 100644 --- a/desktop/sources/scripts/qqq.js +++ b/desktop/sources/scripts/qqq.js @@ -5,13 +5,25 @@ function QQQ (terminal) { this.volume = 1 this.midi = false this.outputs = [] + this.stack = [] this.start = function () { this.midiSetup() } + this.clear = function () { + this.stack = [] + } + this.run = function () { + if (this.stack.length < 1) { return } + let html = '' + for (const id in this.stack) { + const note = this.stack[id] + html += `Ch${note[0]}:${note[1]}+${note[2]}(${note[3]}) ` + } + terminal.log(`Playing: ${html}`) } this.midiSetup = function () { @@ -32,8 +44,8 @@ function QQQ (terminal) { console.warn('No Midi') } - this.send = function (octave, note, velocity) { - console.log('Received ', octave, note, velocity) + this.send = function (channel, octave, note, velocity) { + this.stack.push([channel, octave, note, velocity]) } this.play = function () { diff --git a/desktop/sources/scripts/terminal.js b/desktop/sources/scripts/terminal.js index 027ca36..ccabebc 100644 --- a/desktop/sources/scripts/terminal.js +++ b/desktop/sources/scripts/terminal.js @@ -45,6 +45,8 @@ function Terminal (pico) { this.run = function () { if (this.isPaused) { return } + this.qqq.clear() + this.pico.run() this.qqq.run() this.update() |