aboutsummaryrefslogtreecommitdiff
path: root/examples/simpletest
diff options
context:
space:
mode:
authorJamie Bullock <jamie@jamiebullock.com>2013-06-18 13:23:17 -0700
committerJamie Bullock <jamie@jamiebullock.com>2013-06-18 13:23:17 -0700
commit56563ec2f10f8d4ff449259a9ba5fa3af61eb056 (patch)
tree2a44886520bfc47b42d7b34b5b39d59a9316731a /examples/simpletest
parent6dbfcddf8250cb981f7bd630e9e6f1fdb12608e6 (diff)
downloadLibXtract-56563ec2f10f8d4ff449259a9ba5fa3af61eb056.tar.gz
LibXtract-56563ec2f10f8d4ff449259a9ba5fa3af61eb056.tar.bz2
LibXtract-56563ec2f10f8d4ff449259a9ba5fa3af61eb056.zip
Dynamically allocate storage in simpltest example. Ooura doesn't seem to like the being passed memory on the stack on Linux. Fixes #11
Diffstat (limited to 'examples/simpletest')
-rw-r--r--examples/simpletest/simpletest.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/examples/simpletest/simpletest.c b/examples/simpletest/simpletest.c
index 1f3a85e..c182a90 100644
--- a/examples/simpletest/simpletest.c
+++ b/examples/simpletest/simpletest.c
@@ -92,13 +92,13 @@ int main(void)
double mean = 0.0;
double f0 = 0.0;
double centroid = 0.0;
- double spectrum[BLOCKSIZE];
- double windowed[BLOCKSIZE];
- double peaks[BLOCKSIZE];
- double harmonics[BLOCKSIZE];
+ double *spectrum = calloc(BLOCKSIZE, sizeof(double));
+ double *windowed = calloc(BLOCKSIZE, sizeof(double));
+ double *peaks = calloc(BLOCKSIZE, sizeof(double));
+ double *harmonics = calloc(BLOCKSIZE, sizeof(double));
double *window = NULL;
- double mfccs[MFCC_FREQ_BANDS * sizeof(double)];
- double argd[4];
+ double *mfccs = calloc(MFCC_FREQ_BANDS, sizeof(double));
+ double argd[4] = {0};
double samplerate = 44100.0;
int n;
xtract_mel_filter mel_filters;
@@ -182,6 +182,12 @@ int main(void)
}
free(mel_filters.filters);
+ free(spectrum);
+ free(windowed);
+ free(peaks);
+ free(harmonics);
+ free(mfccs);
+
return 0;
}