mirror of
https://github.com/italicsjenga/m4ldevices.git
synced 2024-11-22 00:21:34 +11:00
initial
This commit is contained in:
commit
60f7f9a00d
BIN
MIDI cutoff.amxd
Normal file
BIN
MIDI cutoff.amxd
Normal file
Binary file not shown.
BIN
Note Merge.amxd
Normal file
BIN
Note Merge.amxd
Normal file
Binary file not shown.
BIN
Note Sustain.amxd
Normal file
BIN
Note Sustain.amxd
Normal file
Binary file not shown.
BIN
Velocity Panner.amxd
Normal file
BIN
Velocity Panner.amxd
Normal file
Binary file not shown.
BIN
js i dont need any more/Note Merge.amxd
Normal file
BIN
js i dont need any more/Note Merge.amxd
Normal file
Binary file not shown.
82
js i dont need any more/notemerge.js
Normal file
82
js i dont need any more/notemerge.js
Normal file
|
@ -0,0 +1,82 @@
|
|||
inlets = 4;
|
||||
outlets = 2;
|
||||
|
||||
var dirty = false;
|
||||
var note = 0;
|
||||
var velocity = 0;
|
||||
var del_dirty = false;
|
||||
var del_note = 0;
|
||||
var del_velocity = 0;
|
||||
|
||||
var delete_queue = [];
|
||||
|
||||
function msg_int(msg) {
|
||||
if (inlet == 0) {
|
||||
note = msg
|
||||
if (dirty) {
|
||||
handle_main()
|
||||
dirty = false
|
||||
} else {
|
||||
dirty = true
|
||||
}
|
||||
} else if (inlet == 1) {
|
||||
velocity = msg
|
||||
if (dirty) {
|
||||
handle_main()
|
||||
dirty = false
|
||||
} else {
|
||||
dirty = true
|
||||
}
|
||||
} else if (inlet == 2) {
|
||||
del_note = msg
|
||||
if (del_dirty) {
|
||||
handle_delayed()
|
||||
del_dirty = false
|
||||
} else {
|
||||
del_dirty = true
|
||||
}
|
||||
} else if (inlet == 3) {
|
||||
del_velocity = msg
|
||||
if (del_dirty) {
|
||||
handle_delayed()
|
||||
del_dirty = false
|
||||
} else {
|
||||
del_dirty = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function handle_main() {
|
||||
if (velocity != 0) { //note on
|
||||
var indx = delete_queue.indexOf(note)
|
||||
if (indx > -1) { //if in delete queue, remove but dont send new note on
|
||||
delete_queue.splice(indx, 1)
|
||||
return
|
||||
} else { //if not in delete queue, its a new note!
|
||||
send_note(note, velocity)
|
||||
}
|
||||
return
|
||||
} else { //add note off to delete queue
|
||||
delete_queue.push(note)
|
||||
}
|
||||
}
|
||||
|
||||
function handle_delayed() {
|
||||
if (del_velocity > 0) { //dont do anything about the delayed note ons
|
||||
return
|
||||
}
|
||||
var indx = delete_queue.indexOf(del_note)
|
||||
// if (indx == -1) { post("we kept: " + del_note + "\n") }
|
||||
if (indx > -1) { //if note is still in delete queue, delete it
|
||||
send_note(delete_queue[indx], 0)
|
||||
post("sent note off for: " + delete_queue[indx] + "\n")
|
||||
delete_queue.splice(indx, 1)
|
||||
}
|
||||
// post("\nkept notes: ")
|
||||
// post(delete_queue)
|
||||
}
|
||||
|
||||
function send_note(n, v) {
|
||||
outlet(1, v)
|
||||
outlet(0, n)
|
||||
}
|
13
js i dont need any more/notesustain.js
Normal file
13
js i dont need any more/notesustain.js
Normal file
|
@ -0,0 +1,13 @@
|
|||
inlets = 1;
|
||||
outlets = 2;
|
||||
|
||||
var current = 0;
|
||||
var last = 0;
|
||||
|
||||
function msg_int(note) {
|
||||
last = current;
|
||||
current = note;
|
||||
outlet(0, current);
|
||||
outlet(1, last);
|
||||
if (current == last) { current = 0; }
|
||||
}
|
Loading…
Reference in a new issue