Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

midi note off events #5

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions cookdsp/midi.jsfx-inc
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ Attributes

If a midi note has been detected, this attribute will be set to `true`.

#### notein.on ####

`true` if note on, `false` if note off

#### notein.channel ####

Holds the channel number of the current midi note.
Expand Down Expand Up @@ -224,7 +228,7 @@ Example
while (n.notein()) (
// If midi event is a midi note
n.ok ? (
n.velocity > 0 ? (
n.velocity > 0 && n.on ? (
// noteon
midinote = n.pitch;
freq = mtof(midinote);
Expand Down Expand Up @@ -253,6 +257,7 @@ function notein()
ret ? (
// Retrieve midi note messages
(msg1 & 0xF0) == 0x90 || (msg1 & 0xF0) == 0x80 ? (
this.on = (msg1 & 0x10) >> 4;
this.ok = 1;
this.channel = (msg1 & 0x0F) + 1;
this.pitch = msg2;
Expand Down Expand Up @@ -411,7 +416,7 @@ function poly_do(pitch velocity)
k_ = this.indexes[this.icount];
this.voice = k_;
this.pitches[k_] = pitch;
this.icount = (this.icount + 1) % this.voices;
this.icount = (this.icount + 1) % this.voices;
);
) : (
while (k_ < this.voices && found_ == 0) (
Expand Down