stopAllNotes -> stopAllNotesAllChannels. stopAllNotes per Channel.

This commit is contained in:
Denis Knauf 2013-06-03 21:04:21 +02:00
parent bce55c3d82
commit 082fcd8d9c

View file

@ -32,6 +32,7 @@ var setPlugin = function(root) {
MIDI.noteOff = root.noteOff; MIDI.noteOff = root.noteOff;
MIDI.chordOn = root.chordOn; MIDI.chordOn = root.chordOn;
MIDI.chordOff = root.chordOff; MIDI.chordOff = root.chordOff;
MIDI.stopAllNotesAllChannels = root.stopAllNotesAllChannels;
MIDI.stopAllNotes = root.stopAllNotes; MIDI.stopAllNotes = root.stopAllNotes;
MIDI.getInput = root.getInput; MIDI.getInput = root.getInput;
MIDI.getOutputs = root.getOutputs; MIDI.getOutputs = root.getOutputs;
@ -68,6 +69,13 @@ var setPlugin = function(root) {
output.send([0x80 + channel, note, 0], delay * 1000); output.send([0x80 + channel, note, 0], delay * 1000);
}; };
root.stopAllNotes = function (channel, delay) {
if( null === channel)
root.stopAllNotesAllChannels( channel);
else
output.send([0xB0 + channel, 0x7B, 0], delay * 1000);
};
root.chordOn = function (channel, chord, velocity, delay) { root.chordOn = function (channel, chord, velocity, delay) {
for (var n = 0; n < chord.length; n ++) { for (var n = 0; n < chord.length; n ++) {
var note = chord[n]; var note = chord[n];
@ -82,9 +90,9 @@ var setPlugin = function(root) {
} }
}; };
root.stopAllNotes = function () { root.stopAllNotesAllChannels = function () {
for (var channel = 0; channel < 16; channel ++) { for (var channel = 0; channel < 16; channel ++) {
output.send([0xB0 + channel, 0x7B, 0]); output.send([0xB0 + channel, 0x7B, 0], delay * 1000);
} }
}; };
@ -368,7 +376,14 @@ if (window.Audio) (function () {
} }
}; };
root.stopAllNotes = function () { root.stopAllNotes = function (channel, delay) {
if( null === channel)
root.stopAllNotesAllChannels();
else
channels[channel].pause();
};
root.stopAllNotesAllChannels = function () {
for (var nid = 0, length = channels.length; nid < length; nid++) { for (var nid = 0, length = channels.length; nid < length; nid++) {
channels[nid].pause(); channels[nid].pause();
} }
@ -451,6 +466,10 @@ if (window.Audio) (function () {
}; };
root.stopAllNotesAllChannels = function () {
};
root.connect = function (instruments, conf) { root.connect = function (instruments, conf) {
soundManager.flashVersion = 9; soundManager.flashVersion = 9;
soundManager.useHTML5Audio = true; soundManager.useHTML5Audio = true;