Mercurial > hg > silvet
diff src/LiveInstruments.cpp @ 301:00fab71b80ec livemode
More tweaking of frequencies
author | Chris Cannam |
---|---|
date | Mon, 01 Dec 2014 17:12:19 +0000 |
parents | ba5f3b084466 |
children | cac0be04c43c |
line wrap: on
line diff
--- a/src/LiveInstruments.cpp Fri Nov 28 18:15:44 2014 +0000 +++ b/src/LiveInstruments.cpp Mon Dec 01 17:12:19 2014 +0000 @@ -17,6 +17,8 @@ #include "data/include/templates.h" +#include <iostream> + using namespace std; InstrumentPack @@ -24,6 +26,8 @@ { vector<InstrumentPack::Templates> templates; + cerr << "LiveAdapter: reduced template height is " << SILVET_TEMPLATE_HEIGHT/5 << endl; + for (vector<InstrumentPack::Templates>::const_iterator i = original.templates.begin(); i != original.templates.end(); ++i) { @@ -34,12 +38,22 @@ t.data.resize(i->data.size()); for (int j = 0; j < int(i->data.size()); ++j) { + t.data[j].resize(SILVET_TEMPLATE_HEIGHT/5); + float sum = 0.f; + for (int k = 0; k < SILVET_TEMPLATE_HEIGHT/5; ++k) { - t.data[j][k] = i->data[j][k * 5 + 2 - SILVET_TEMPLATE_MAX_SHIFT]; + + t.data[j][k] = 0.f; + + for (int m = 0; m < 5; ++m) { + t.data[j][k] += i->data[j][k * 5 + m + 2]; + } + sum += t.data[j][k]; } + // re-normalise for (int k = 0; k < (int)t.data[j].size(); ++k) { t.data[j][k] *= 1.f / sum;