Mercurial > hg > svgui
diff layer/SpectrogramLayer.cpp @ 545:be5c35d3f409
* solaris build fixes
author | Chris Cannam |
---|---|
date | Thu, 10 Sep 2009 18:44:45 +0000 |
parents | 1092181784a3 |
children | 0ce7566717b2 |
line wrap: on
line diff
--- a/layer/SpectrogramLayer.cpp Tue Aug 18 11:01:57 2009 +0000 +++ b/layer/SpectrogramLayer.cpp Thu Sep 10 18:44:45 2009 +0000 @@ -45,6 +45,10 @@ #include <cassert> #include <cmath> +#ifndef __GNUC__ +#include <alloca.h> +#endif + //#define DEBUG_SPECTROGRAM_REPAINT 1 SpectrogramLayer::SpectrogramLayer(Configuration config) : @@ -2256,8 +2260,13 @@ bufwid = w; } +#ifdef __GNUC__ int binforx[bufwid]; float binfory[h]; +#else + int *binforx = (int *)alloca(bufwid * sizeof(int)); + float *binfory = (float *)alloca(h * sizeof(float)); +#endif bool usePeaksCache = false; @@ -2502,7 +2511,12 @@ FFTModel::PeakSet peakfreqs; int px = -1, psx = -1; + +#ifdef __GNUC__ float values[maxbin - minbin + 1]; +#else + float *values = (float *)alloca((maxbin - minbin + 1) * sizeof(float)); +#endif for (int x = 0; x < w; ++x) { @@ -2642,10 +2656,17 @@ } int psx = -1; + +#ifdef __GNUC__ float autoarray[maxbin - minbin + 1]; + float peaks[h]; +#else + float *autoarray = (float *)alloca((maxbin - minbin + 1) * sizeof(float)); + float *peaks = (float *)alloca(h * sizeof(float)); +#endif + const float *values = autoarray; DenseThreeDimensionalModel::Column c; - float peaks[h]; for (int x = 0; x < w; ++x) {