Mercurial > hg > nnls-chroma
comparison chromamethods.cpp @ 77:ba930176df5b matthiasm-plugin
fixed. warning: I added some arrays with variable length (though not at runtime).
author | Matthias Mauch <mail@matthiasmauch.net> |
---|---|
date | Thu, 11 Nov 2010 10:27:58 +0900 |
parents | d398e73b46e0 |
children | 026a5c0ee2c2 |
comparison
equal
deleted
inserted
replaced
76:d398e73b46e0 | 77:ba930176df5b |
---|---|
48 float s; | 48 float s; |
49 int m, n; | 49 int m, n; |
50 int lenConvolvee = convolvee.size(); | 50 int lenConvolvee = convolvee.size(); |
51 int lenKernel = kernel.size(); | 51 int lenKernel = kernel.size(); |
52 | 52 |
53 vector<float> Z(256,0); | 53 vector<float> Z(nNote,0); |
54 assert(lenKernel % 2 != 0); // no exception handling !!! | 54 assert(lenKernel % 2 != 0); // no exception handling !!! |
55 | 55 |
56 for (n = lenKernel - 1; n < lenConvolvee; n++) { | 56 for (n = lenKernel - 1; n < lenConvolvee; n++) { |
57 s=0.0; | 57 s=0.0; |
58 for (m = 0; m < lenKernel; m++) { | 58 for (m = 0; m < lenKernel; m++) { |
204 // cerr << floatbin << endl; | 204 // cerr << floatbin << endl; |
205 curr_amp = pow(s_param,float(iHarm-1)); | 205 curr_amp = pow(s_param,float(iHarm-1)); |
206 // cerr << "curramp" << curr_amp << endl; | 206 // cerr << "curramp" << curr_amp << endl; |
207 for (unsigned iNote = 0; iNote < nNote; ++iNote) { | 207 for (unsigned iNote = 0; iNote < nNote; ++iNote) { |
208 if (abs(iNote+1.0-floatbin)<2) { | 208 if (abs(iNote+1.0-floatbin)<2) { |
209 dm[iNote + 256 * iOut] += cospuls(iNote+1.0, floatbin, binspersemitone + 0.0) * curr_amp; | 209 dm[iNote + nNote * iOut] += cospuls(iNote+1.0, floatbin, binspersemitone + 0.0) * curr_amp; |
210 // dm[iNote + nNote * iOut] += 1 * curr_amp; | 210 // dm[iNote + nNote * iOut] += 1 * curr_amp; |
211 } | 211 } |
212 } | 212 } |
213 } | 213 } |
214 } | 214 } |