From 9c7c14513dfe3440dad9cf0b1c652dde9e4f1de7 Mon Sep 17 00:00:00 2001 From: Ludovic Pouzenc Date: Sun, 3 Jun 2012 21:45:00 +0000 Subject: Version qui marchouille sans le pointeur de fonction (segfault incompris). Problèmes d'offset. Le vu-mètre donne juste la valeur abs max ce qui ne correspond pas à grand chose 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@11 6be1fa4d-33ac-4c33-becc-79fcb3794bb6 --- tests/test5/capture.c | 16 +++++++++++----- tests/test5/compil.sh | 6 +++--- tests/test5/test5.c | 16 ++++++++-------- tests/test5/win_main.c | 6 ++++++ 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/tests/test5/capture.c b/tests/test5/capture.c index d003fe8..441a6ac 100644 --- a/tests/test5/capture.c +++ b/tests/test5/capture.c @@ -5,6 +5,8 @@ #define APP_TITLE "Test 5 lpo" #define BUFSIZE 1024 +extern void my_process(gint sound_level, void *userdata); + capture_sound_level_cb_t *capture_sound_level_cb=NULL; int capture_init(pa_mainloop **m, pa_context **c); @@ -26,7 +28,7 @@ void audio_thread(void *args) { capture_sound_level_cb=(capture_sound_level_cb_t *)args; - printf("debug : args==%p capture_sound_level_cb==%p\n", args, capture_sound_level_cb); + //printf("debug : args==%p capture_sound_level_cb==%p\n", args, capture_sound_level_cb); res=capture_init(&m, &c); g_assert(res==0); @@ -194,11 +196,14 @@ void stream_read_callback(pa_stream *s, size_t nbytes, void *userdata) { printf("pa_stream_peek() failed\n");//: %s", pa_strerror(pa_context_errno(context))); return; } - printf("level : %i\n", compute_level(p,nbytes)); + //printf("level : %i\n", compute_level(p,nbytes)); + +//printf("debug : before call capture_sound_level_cb==%p\n", capture_sound_level_cb); + + my_process(compute_level(p,nbytes), NULL); +// (*capture_sound_level_cb)(compute_level(p,nbytes), NULL); -printf("debug : before call capture_sound_level_cb==%p\n", capture_sound_level_cb); - (*capture_sound_level_cb)(compute_level(p,nbytes), NULL); -printf("debug : after call capture_sound_level_cb==%p\n", capture_sound_level_cb); +//printf("debug : after call capture_sound_level_cb==%p\n", capture_sound_level_cb); pa_stream_drop(s); } @@ -208,6 +213,7 @@ gint compute_level(const void *data, size_t nbytes) { gint val, level=0; for (i=0;i