From fd52b21e3ff75622e80230b00d361dfa74da70ab Mon Sep 17 00:00:00 2001 From: Andy Sloane Date: Tue, 3 Nov 2015 09:50:19 -0800 Subject: [PATCH] only instruments with samplemaps can play by refactoring the xm loader i inadvertently broke this --- xm.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xm.js b/xm.js index 0f93491..05ddf84 100644 --- a/xm.js +++ b/xm.js @@ -244,11 +244,11 @@ function next_row() { // instrument trigger if (r[i][1] != -1) { inst = xm.instruments[r[i][1] - 1]; - if (inst != undefined) { + if (inst && inst.samplemap) { ch.inst = inst; // retrigger unless overridden below triggernote = true; - if (ch.note) { + if (ch.note && inst.samplemap) { ch.samp = inst.samples[inst.samplemap[ch.note]]; ch.vol = ch.samp.vol; ch.pan = ch.samp.pan; @@ -264,7 +264,7 @@ function next_row() { ch.release = 1; triggernote = false; } else { - if (inst != undefined) { + if (inst && inst.samplemap) { var note = r[i][0]; ch.note = note; ch.samp = inst.samples[inst.samplemap[ch.note]]; @@ -324,7 +324,7 @@ function next_row() { ch.periodtarget = PeriodForNote(ch, ch.note); } triggernote = false; - if (inst != undefined) { + if (inst && inst.samplemap) { if (ch.env_vol == undefined) { // note wasn't already playing; we basically have to ignore the // portamento and just trigger