From 181c7738f1d8bd135f0378570beaf6f5c8028fcf Mon Sep 17 00:00:00 2001 From: Devine Lu Linvega Date: Wed, 17 Oct 2018 21:24:51 +1200 Subject: Stack midi nodes on frame --- desktop/core/lib/__qqq.js | 3 ++- desktop/sources/scripts/qqq.js | 16 ++++++++++++++-- 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() -- cgit v1.2.3