diff --git a/.gitignore b/.gitignore index ad2c623..e4f21fb 100644 --- a/.gitignore +++ b/.gitignore @@ -36,4 +36,5 @@ ui/log.* ui/t Beep/alguabeep +Beep/*.log diff --git a/Beep/README.md b/Beep/README.md new file mode 100644 index 0000000..cb8bcef --- /dev/null +++ b/Beep/README.md @@ -0,0 +1,5 @@ +# AlguaBeep + +Une expérimentation hasardeuse pour traduire des images de webcam +en sons qui déchirent les oreilles + diff --git a/Beep/alguabeep.c b/Beep/alguabeep.c index 19f0f0c..d9f3088 100644 --- a/Beep/alguabeep.c +++ b/Beep/alguabeep.c @@ -109,6 +109,11 @@ while ((opt = getopt(argc, argv, "d:hIK:n:p:v")) != -1) { case 'K': K = atoi(optarg); break; case 'n': nbre_capt = atoi(optarg); break; case 'p': period = atoi(optarg); break; + case 's': if (2!=sscanf(optarg, "%dx%d", + &width, &height)) { + fprintf(stderr, "'%s' bad\n", optarg); + exit(1); + } case 'v': verbosity++; break; } } @@ -185,6 +190,10 @@ else fprintf(stderr, "just one shoot...\n"); t_debut = dtime(); foo = lancement_thread_son(0); +if (foo) { + fprintf(stderr, "erreur %d lancment thread son\n", foo); + exit(1); + } initialise_ecran(0); diff --git a/Beep/display.c b/Beep/display.c index 31c246a..08a8be1 100644 --- a/Beep/display.c +++ b/Beep/display.c @@ -24,6 +24,8 @@ standout(); mvaddstr(0, 0, chaine); standend(); refresh(); +fprintf(stderr, "%s: COLS=%d LINES=%d\n", __func__, COLS, LINES); + return 0; } /* ---------------------------------------------------------------- */ diff --git a/Beep/funcs.c b/Beep/funcs.c index 9d8db55..ab10f66 100644 --- a/Beep/funcs.c +++ b/Beep/funcs.c @@ -10,7 +10,7 @@ /* --------------------------------------------------------------------- */ /* - * + * calculs sur une zone de l'image * valeur retournee entre 0 et 255 */ double niveau_zone(unsigned char *datas, int w, int h, Rect *rp) diff --git a/Beep/process.c b/Beep/process.c index dd753ef..0bfe699 100644 --- a/Beep/process.c +++ b/Beep/process.c @@ -1,3 +1,7 @@ +/* + * AlguaBeep + */ + #include #include #include @@ -81,11 +85,11 @@ if (stand) standend(); static double i2freq(int i) { -i = 333+i*42; +i = 333+i*42; /* please explain */ if (0==i) abort(); -return 30.0* (1.0 / (double)i); +return 30.0* (1.0 / (double)i); /* please explain */ } static int generate_samples(short *where, int size, Datum *datas) @@ -120,6 +124,7 @@ mvaddstr(35, 0, chaine); return 0; } +/* --------------------------------------------------------------------- */ int charcuteur(unsigned char *datas, int w, int h, int K) @@ -262,14 +267,14 @@ void * thr_action(void *ptr) long idx; // int foo; -// #if DEBUG_LEVEL +#if DEBUG_LEVEL fprintf(stderr, ">>> %s ( %p )\n", __func__, ptr); fprintf(stderr, " value is %d\n", *(int *)ptr); -// #endif +#endif while(1) { if (verbosity > 1) { - fprintf(stderr, "%s t=%g\n", __func__, dtime() - debut); + fprintf(stderr, "%s t=%.3g\n", __func__, dtime() - debut); } for (idx=0; idx<100; idx++) { @@ -296,6 +301,10 @@ debut = dtime(); pid = getpid(); foo = pthread_create(&thread, NULL, thr_action, &pid); fprintf(stderr, "thread creation -> %d\n", foo); +if (foo) { + fprintf(stderr, "epic fail in %s:%s\n", __FILE__, __func__); + exit(1); + } return 0; }