# HG changeset patch # User Chris Cannam # Date 1432025511 -3600 # Node ID 8545b883775ef53a80df86e67661242c072a0c69 # Parent df9a8e16bae672bacc16ce7129a21502e13c6271 A small improvement, but not enough diff -r df9a8e16bae6 -r 8545b883775e src/LiveInstruments.cpp --- a/src/LiveInstruments.cpp Tue May 19 09:29:00 2015 +0100 +++ b/src/LiveInstruments.cpp Tue May 19 09:51:51 2015 +0100 @@ -44,25 +44,25 @@ for (const auto &origt: original.templates) { - t.lowestNote = origt.lowestNote + 12; + t.lowestNote = origt.lowestNote; t.highestNote = origt.highestNote; - t.data.resize(origt.data.size()); - for (int j = 0; j < int(origt.data.size()); ++j) { + t.data.resize(SILVET_TEMPLATE_NOTE_COUNT); + + for (int j = 0; j < SILVET_TEMPLATE_NOTE_COUNT; ++j) { t.data[j].resize(height); - for (int k = 0; k < height; ++k) { - - if (!merge || first) { - t.data[j][k] = 0.f; + if (j >= t.lowestNote && j <= t.highestNote) { + for (int k = 0; k < height; ++k) { + // This is the index of the middle template, no. 2 + // of 5, in each 5-bin semitone series. (We add 4 + // because there are 2 blank shift-space slots at + // the start of the template data.) + t.data[j][k] += origt.data[j][60 + k * 5 + 4]; } - - for (int m = 2; m < 3; ++m) { - t.data[j][k] += origt.data[j][60 + k * 5 + m + 2]; - } - } - } + } + } if (!merge) { templates.push_back(t); @@ -86,8 +86,8 @@ } } - InstrumentPack live(original.lowestNote, - original.highestNote, + InstrumentPack live(templates[0].lowestNote, + templates[0].highestNote, original.name, templates);