need to use nid to find channel to pause, and forgot to add i to channel_nid to get nid

This commit is contained in:
Brian Stoner 2013-03-14 13:20:32 -04:00
parent c8047a2779
commit 91988b15b7

View file

@ -294,14 +294,14 @@ if (window.Audio) (function () {
if (!note) return; if (!note) return;
var instrumentNoteId = instrumentId + "" + note.id; var instrumentNoteId = instrumentId + "" + note.id;
for(var i=0;i<channelInstrumentNoteIds.length;i++){ for(var i=0;i<channels.length;i++){
var nid = (channel_nid + 1) % channels.length; var nid = (i + channel_nid + 1) % channels.length;
var cId = channelInstrumentNoteIds[nid]; var cId = channelInstrumentNoteIds[nid];
if(cId && cId == instrumentNoteId){ if(cId && cId == instrumentNoteId){
channels[i].pause(); channels[nid].pause();
channelInstrumentNoteIds[nid] = null; channelInstrumentNoteIds[nid] = null;
return; return;
} }
} }
}; };