From 88f174d0b8b749cf96a38e284f266d3bdaa55ef4 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 10 Jun 2012 20:22:56 +0000 Subject: Bon, on reprends à plat les problèmes de maths avec des fichiers en entrée pour valider tutes les étapes... 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@16 6be1fa4d-33ac-4c33-becc-79fcb3794bb6 --- tests/test5/compute.c | 52 +++++++++++++++++++++++++++++---------------------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'tests/test5/compute.c') diff --git a/tests/test5/compute.c b/tests/test5/compute.c index e8b03fc..d64f8c1 100644 --- a/tests/test5/compute.c +++ b/tests/test5/compute.c @@ -3,8 +3,9 @@ #include "fft.h" #include +#define MIN_SAMPLES 256 #define MAX_SAMPLES 2048 -static inline float todB_a(const float *x); +//static inline float todB_a(const float *x); void compute_spectrum(float * data, int width, double rate, float *output); @@ -13,42 +14,49 @@ gfloat compute_level(const float *data, size_t nsamples, size_t nchan) { double rate=44100; //TODO dynamique size_t i; float input[MAX_SAMPLES], output[128]; - float level; + float value; + int gain=20, range=80; 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= %i\n", nsamples, MIN_SAMPLES); + for (i=0;i