From 593e1cbe3470f409c19a7f06f5d10c6f5677361a Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sat, 16 Jun 2012 21:16:46 +0000 Subject: Bon, calcul du niveau sonore dans la plage 200 à 2000Hz en reprennant les choses calmement. Il n'est pas impossible que les valeurs soient bonnes :P 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@19 6be1fa4d-33ac-4c33-becc-79fcb3794bb6 --- tests/test6/test6.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'tests/test6/test6.c') diff --git a/tests/test6/test6.c b/tests/test6/test6.c index abaa3e4..e5a2a12 100644 --- a/tests/test6/test6.c +++ b/tests/test6/test6.c @@ -2,6 +2,8 @@ #include #include +#include "compute.h" + typedef void (*cb_processdata_t)(int n, float *); @@ -60,10 +62,12 @@ void parse_testfile(cb_processdata_t cb) { FILE *fh=fopen("./test.raw", "r"); if (fh==NULL) return; - n=128; + //n=128; + n=512; while ( (n=fread(f, sizeof(float), n, fh)) > 0 ) { cb(n,f); - n=128+256*(rand()%7); + //n=128+256*(rand()%7); + n=512; } fclose(fh); } @@ -81,10 +85,19 @@ void process_mean_max(int n, float *f) { printf("%+.3f %+.3f %4i\n", mean, max, n); } +void process_level(int n, float *f) { + int rate=24000; + float level; + + level=compute_level(f, n, rate); + printf("%+.3f %4i\n", level, n); +} + int main() { //test_todb_a(); //dump_testfile(); - parse_testfile(process_mean_max); + //parse_testfile(process_mean_max); + parse_testfile(process_level); return 0; } -- cgit v1.2.3