From 438cfc61ee3fae8875dbbf24a44fa7d75969f2b3 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Wed, 6 Jun 2012 21:42:40 +0000 Subject: Ajout Makefile, résolution crash malloc (tableau statique à la place). Données audio 2 channels : apparament avec un offset style [i*nchan] on obtient bcp de valeurs à 0... FFT : valeurs en sortie toutes pétées, faut débugguer. Conso CPU : correcte MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///var/svn/2012-violon-leds/trunk@13 6be1fa4d-33ac-4c33-becc-79fcb3794bb6 --- tests/test5/compute.c | 172 ++++++-------------------------------------------- 1 file changed, 18 insertions(+), 154 deletions(-) (limited to 'tests/test5/compute.c') diff --git a/tests/test5/compute.c b/tests/test5/compute.c index f6f08c4..2658904 100644 --- a/tests/test5/compute.c +++ b/tests/test5/compute.c @@ -1,20 +1,21 @@ #include "compute.h" -#include +#include "fft.h" #include -#define MaxFastBits 16 - -int **gFFTBitTable = NULL; +#define MAX_SAMPLES 2048 gfloat compute_level(const float *data, size_t nsamples, size_t nchan) { + double rate=44100; //TODO dynamique size_t i; - float level=0; - float *input = malloc(nsamples*sizeof(float)); - float *output = malloc(nsamples*sizeof(float)); + float input[MAX_SAMPLES], output[MAX_SAMPLES]; + float level; - double rate=44100; //TODO dynamique + if (nsamples >= MAX_SAMPLES) { + printf("WARN : nsamples >= MAX_SAMPLES : %i >= %i\n", nsamples, MAX_SAMPLES); + nsamples=MAX_SAMPLES; + } /* Just return the max peak for (i=0;i>= 1; - } - - return rev; -} - - void audio2hsv_1(gint audio_level, gint *light_h, gint *light_s, gint *light_v) { // Dummy code *light_h=-audio_level; -- cgit v1.2.3