comparison layer/SpectrogramLayer.cpp @ 545:be5c35d3f409

* solaris build fixes
author Chris Cannam
date Thu, 10 Sep 2009 18:44:45 +0000
parents 1092181784a3
children 0ce7566717b2
comparison
equal deleted inserted replaced
544:1dd2cddc32eb 545:be5c35d3f409
42 42
43 using std::cerr; 43 using std::cerr;
44 using std::endl; 44 using std::endl;
45 #include <cassert> 45 #include <cassert>
46 #include <cmath> 46 #include <cmath>
47
48 #ifndef __GNUC__
49 #include <alloca.h>
50 #endif
47 51
48 //#define DEBUG_SPECTROGRAM_REPAINT 1 52 //#define DEBUG_SPECTROGRAM_REPAINT 1
49 53
50 SpectrogramLayer::SpectrogramLayer(Configuration config) : 54 SpectrogramLayer::SpectrogramLayer(Configuration config) :
51 m_model(0), 55 m_model(0),
2254 } else { 2258 } else {
2255 2259
2256 bufwid = w; 2260 bufwid = w;
2257 } 2261 }
2258 2262
2263 #ifdef __GNUC__
2259 int binforx[bufwid]; 2264 int binforx[bufwid];
2260 float binfory[h]; 2265 float binfory[h];
2266 #else
2267 int *binforx = (int *)alloca(bufwid * sizeof(int));
2268 float *binfory = (float *)alloca(h * sizeof(float));
2269 #endif
2261 2270
2262 bool usePeaksCache = false; 2271 bool usePeaksCache = false;
2263 2272
2264 if (bufferBinResolution) { 2273 if (bufferBinResolution) {
2265 for (int x = 0; x < bufwid; ++x) { 2274 for (int x = 0; x < bufwid; ++x) {
2500 if (!fft) return false; 2509 if (!fft) return false;
2501 2510
2502 FFTModel::PeakSet peakfreqs; 2511 FFTModel::PeakSet peakfreqs;
2503 2512
2504 int px = -1, psx = -1; 2513 int px = -1, psx = -1;
2514
2515 #ifdef __GNUC__
2505 float values[maxbin - minbin + 1]; 2516 float values[maxbin - minbin + 1];
2517 #else
2518 float *values = (float *)alloca((maxbin - minbin + 1) * sizeof(float));
2519 #endif
2506 2520
2507 for (int x = 0; x < w; ++x) { 2521 for (int x = 0; x < w; ++x) {
2508 2522
2509 if (binforx[x] < 0) continue; 2523 if (binforx[x] < 0) continue;
2510 2524
2640 interpolate = true; 2654 interpolate = true;
2641 } 2655 }
2642 } 2656 }
2643 2657
2644 int psx = -1; 2658 int psx = -1;
2659
2660 #ifdef __GNUC__
2645 float autoarray[maxbin - minbin + 1]; 2661 float autoarray[maxbin - minbin + 1];
2662 float peaks[h];
2663 #else
2664 float *autoarray = (float *)alloca((maxbin - minbin + 1) * sizeof(float));
2665 float *peaks = (float *)alloca(h * sizeof(float));
2666 #endif
2667
2646 const float *values = autoarray; 2668 const float *values = autoarray;
2647 DenseThreeDimensionalModel::Column c; 2669 DenseThreeDimensionalModel::Column c;
2648 float peaks[h];
2649 2670
2650 for (int x = 0; x < w; ++x) { 2671 for (int x = 0; x < w; ++x) {
2651 2672
2652 if (binforx[x] < 0) continue; 2673 if (binforx[x] < 0) continue;
2653 2674