when stopping a note, look through the channels from oldest to newest, stop only the first matching note, then null it out and return

This commit is contained in:
Brian Stoner 2013-03-14 11:54:05 -04:00
parent 6462f82fde
commit c8047a2779

View file

@ -295,9 +295,13 @@ if (window.Audio) (function () {
var instrumentNoteId = instrumentId + "" + note.id; var instrumentNoteId = instrumentId + "" + note.id;
for(var i=0;i<channelInstrumentNoteIds.length;i++){ for(var i=0;i<channelInstrumentNoteIds.length;i++){
var cId = channelInstrumentNoteIds[i]; var nid = (channel_nid + 1) % channels.length;
var cId = channelInstrumentNoteIds[nid];
if(cId && cId == instrumentNoteId){ if(cId && cId == instrumentNoteId){
channels[i].pause(); channels[i].pause();
channelInstrumentNoteIds[nid] = null;
return;
} }
} }
}; };
@ -582,4 +586,4 @@ MIDI.noteToKey = {}; // 108 == C8
} }
})(); })();
})(); })();