first 2021 run: ok !

This commit is contained in:
tth 2021-04-13 19:14:08 +02:00
parent 1f2755d894
commit 824828226c
6 changed files with 32 additions and 6 deletions

1
.gitignore vendored
View File

@ -36,4 +36,5 @@ ui/log.*
ui/t ui/t
Beep/alguabeep Beep/alguabeep
Beep/*.log

5
Beep/README.md Normal file
View File

@ -0,0 +1,5 @@
# AlguaBeep
Une expérimentation hasardeuse pour traduire des images de webcam
en sons qui déchirent les oreilles

View File

@ -109,6 +109,11 @@ while ((opt = getopt(argc, argv, "d:hIK:n:p:v")) != -1) {
case 'K': K = atoi(optarg); break; case 'K': K = atoi(optarg); break;
case 'n': nbre_capt = atoi(optarg); break; case 'n': nbre_capt = atoi(optarg); break;
case 'p': period = 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; case 'v': verbosity++; break;
} }
} }
@ -185,6 +190,10 @@ else fprintf(stderr, "just one shoot...\n");
t_debut = dtime(); t_debut = dtime();
foo = lancement_thread_son(0); foo = lancement_thread_son(0);
if (foo) {
fprintf(stderr, "erreur %d lancment thread son\n", foo);
exit(1);
}
initialise_ecran(0); initialise_ecran(0);

View File

@ -24,6 +24,8 @@ standout(); mvaddstr(0, 0, chaine); standend();
refresh(); refresh();
fprintf(stderr, "%s: COLS=%d LINES=%d\n", __func__, COLS, LINES);
return 0; return 0;
} }
/* ---------------------------------------------------------------- */ /* ---------------------------------------------------------------- */

View File

@ -10,7 +10,7 @@
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
/* /*
* * calculs sur une zone de l'image
* valeur retournee entre 0 et 255 * valeur retournee entre 0 et 255
*/ */
double niveau_zone(unsigned char *datas, int w, int h, Rect *rp) double niveau_zone(unsigned char *datas, int w, int h, Rect *rp)

View File

@ -1,3 +1,7 @@
/*
* AlguaBeep
*/
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -81,11 +85,11 @@ if (stand) standend();
static double i2freq(int i) static double i2freq(int i)
{ {
i = 333+i*42; i = 333+i*42; /* please explain */
if (0==i) abort(); 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) static int generate_samples(short *where, int size, Datum *datas)
@ -120,6 +124,7 @@ mvaddstr(35, 0, chaine);
return 0; return 0;
} }
/* --------------------------------------------------------------------- */
int charcuteur(unsigned char *datas, int w, int h, int K) int charcuteur(unsigned char *datas, int w, int h, int K)
@ -262,14 +267,14 @@ void * thr_action(void *ptr)
long idx; long idx;
// int foo; // int foo;
// #if DEBUG_LEVEL #if DEBUG_LEVEL
fprintf(stderr, ">>> %s ( %p )\n", __func__, ptr); fprintf(stderr, ">>> %s ( %p )\n", __func__, ptr);
fprintf(stderr, " value is %d\n", *(int *)ptr); fprintf(stderr, " value is %d\n", *(int *)ptr);
// #endif #endif
while(1) { while(1) {
if (verbosity > 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++) { for (idx=0; idx<100; idx++) {
@ -296,6 +301,10 @@ debut = dtime();
pid = getpid(); pid = getpid();
foo = pthread_create(&thread, NULL, thr_action, &pid); foo = pthread_create(&thread, NULL, thr_action, &pid);
fprintf(stderr, "thread creation -> %d\n", foo); fprintf(stderr, "thread creation -> %d\n", foo);
if (foo) {
fprintf(stderr, "epic fail in %s:%s\n", __FILE__, __func__);
exit(1);
}
return 0; return 0;
} }