diff --git a/Beep/Makefile b/Beep/Makefile index bc01e2e..0d621e4 100644 --- a/Beep/Makefile +++ b/Beep/Makefile @@ -1,3 +1,10 @@ +# +# _ _ ____ _ _ _ ____ _____ _____ ____ +# / \ ! ! / ___! ! ! ! / \ ! __ )! ____! ____! _ \ +# / _ \ ! ! ! ! _! ! ! !/ _ \ ! _ \! _! ! _! ! !_) ! +# / ___ \! !__! !_! ! !_! / ___ \! !_) ! !___! !___! __/ +# /_/ \_\_____\____!\___/_/ \_\____/!_____!_____!_! +# CC = gcc diff --git a/Beep/README.md b/Beep/README.md index c1226c0..cfb6796 100644 --- a/Beep/README.md +++ b/Beep/README.md @@ -1,11 +1,22 @@ # AlguaBeep -Une expérimentation hasardeuse pour traduire des images de webcam -en sons qui déchirent les oreilles, mais qui sont bio-dégradables. +C'est une expérimentation hasardeuse pour traduire des images de webcam +en sons qui déchirent les oreilles, mais qui sont relativement +inoffensifs. + +Pour le moment, il n'y a pas de procédure d'installation, il faut +donc lancer le binaire à partir du répertoire de dèv : +`~/Devel/DD2-monitor/Beep/alguabeep [options]`, ce qui implique +de ne pas aller mettre la grouille dans ce coin-là. + +Ensuite, pour apprécier pleinement la kitchitude (assumée) de l'affichage +numérique de la machinerie en action, il faut un `xterm` en 150 caractères +de large, et une toute petite fonte. ## Usage ``` +available options: -d /dev/? select video device -I take pictures -K set the K parameter diff --git a/Beep/alguabeep.c b/Beep/alguabeep.c index d9f3088..a841c54 100644 --- a/Beep/alguabeep.c +++ b/Beep/alguabeep.c @@ -1,4 +1,10 @@ - /* V4L2 video picture grabber + /* + + A crude sound experiment, by Clairchanoir et tTh + + approimatively based on : + + V4L2 video picture grabber Copyright (C) 2009 Mauro Carvalho Chehab This program is free software; you can redistribute it and/or modify @@ -58,14 +64,14 @@ do { } while (r == -1 && ((errno == EINTR) || (errno == EAGAIN))); if (r == -1) { - fprintf(stderr, "error %d, %s\n", errno, strerror(errno)); + fprintf(stderr, "%s: error %d, %s\n", __func__, errno, strerror(errno)); exit(EXIT_FAILURE); } } /* --------------------------------------------------------------------- */ void help(int v) { -puts("options :"); +puts("available options:"); puts("\t-d /dev/?\tselect video device"); puts("\t-I\t\ttake pictures"); puts("\t-K\t\tset the K parameter"); @@ -200,7 +206,7 @@ initialise_ecran(0); type = V4L2_BUF_TYPE_VIDEO_CAPTURE; xioctl(fd, VIDIOC_STREAMON, &type); -sprintf(chaine, "entering main loop, %d iters\n", nbre_capt); +sprintf(chaine, "entering main loop, %9d iters\n", nbre_capt); mvaddstr(1, 0, chaine); refresh(); fprintf(stderr, "%s\n", chaine); @@ -243,8 +249,8 @@ for (i = 0; i < nbre_capt; i++) { // fmt.fmt.pix.width, fmt.fmt.pix.height, K); if (mk_img) { - sprintf(out_name, "i/out%04d.ppm", i); - if (verbosity) fprintf(stderr, "--> %s\n", out_name); + sprintf(out_name, "o/out%04d.ppm", i); + if (verbosity) fprintf(stderr, "\t--> %s\n", out_name); fout = fopen(out_name, "w"); if (!fout) { @@ -257,6 +263,10 @@ for (i = 0; i < nbre_capt; i++) { fclose(fout); } + /* XXX CRITICAL BUG XXX + Doc say 'period can be real', so why not + use nanosleep(2) ? + */ if (nbre_capt > 1 && period) { sleep(period); } diff --git a/Beep/controls.c b/Beep/controls.c index 6a024d1..5840d7c 100644 --- a/Beep/controls.c +++ b/Beep/controls.c @@ -1,4 +1,10 @@ - +/* + * Ugly hack made for AlguaBeep + * + * +++++++++++++++++++++++++++++++++++++++++ + * + DO NOT USE IN REAL LIFE + + * +++++++++++++++++++++++++++++++++++++++++ + */ #include #include #include @@ -27,10 +33,10 @@ if (-1 == ioctl (fd, VIDIOC_QUERYCTRL, &queryctrl)) { perror ("VIDIOC_QUERYCTRL"); exit (EXIT_FAILURE); } else { - printf ("V4L2_CID_BRIGHTNESS is not supported\n"); + fprintf (stderr, "V4L2_CID_BRIGHTNESS is not supported\n"); } } else if (queryctrl.flags & V4L2_CTRL_FLAG_DISABLED) { - printf ("V4L2_CID_BRIGHTNESS is not supported\n"); + fprintf (stderr, "V4L2_CID_BRIGHTNESS is not supported\n"); } else { memset (&control, 0, sizeof (control)); control.id = V4L2_CID_BRIGHTNESS; diff --git a/Beep/controls.h b/Beep/controls.h index 504d1aa..8c9f6be 100644 --- a/Beep/controls.h +++ b/Beep/controls.h @@ -1,3 +1,8 @@ +/* + * AlguaBeep is a cool project. + * merci clairchanoir. + */ + /* * various V4L2 functions */ diff --git a/Beep/display.c b/Beep/display.c index 08a8be1..7ec371a 100644 --- a/Beep/display.c +++ b/Beep/display.c @@ -1,3 +1,6 @@ +/* + * un module 'curses' de AlguaBeep + */ #include #include @@ -18,7 +21,7 @@ keypad(stdscr, TRUE); /* acces aux touches 'curseur' */ atexit(finish); -sprintf(chaine, " alguabeep (%s %s) pid=%d \n", __DATE__, __TIME__, +sprintf(chaine, " AlguaBeep (%s %s) pid=%d \n", __DATE__, __TIME__, getpid()); standout(); mvaddstr(0, 0, chaine); standend(); diff --git a/Beep/funcs.c b/Beep/funcs.c index ab10f66..e5665f4 100644 --- a/Beep/funcs.c +++ b/Beep/funcs.c @@ -1,10 +1,14 @@ /* * algua beep module + * + * il faut etre honnete, mais ce module m'interpelle, parce + * ce que je ne comprend plus l'intention premiere. + * */ #include #include -#include +#include #include "funcs.h" diff --git a/Beep/funcs.h b/Beep/funcs.h index ff0029b..203e74b 100644 --- a/Beep/funcs.h +++ b/Beep/funcs.h @@ -1,5 +1,7 @@ /* --------------------------------------------------------------------- */ - +/* + * did you'v got funk with this funcs.h file ? + */ typedef struct { int x, y, w, h; } Rect; diff --git a/Beep/process.c b/Beep/process.c index 0bfe699..d4e7020 100644 --- a/Beep/process.c +++ b/Beep/process.c @@ -28,6 +28,9 @@ static ao_sample_format format; static double debut; /* --------------------------------------------------------------------- */ +/* + * what is the meaning of the 'K' parameter ? + */ int init_process(int K) { // int foo; @@ -50,7 +53,7 @@ format.rate = 44100; format.byte_format = AO_FMT_LITTLE; device = ao_open_live(default_driver, &format, NULL); if (device == NULL) { - fprintf(stderr, "Error opening AO device.\n"); + fprintf(stderr, "%s: Error opening AO device.\n", __func__); return -1; } @@ -69,8 +72,8 @@ typedef struct { static int cmp_datums(const void *a, const void *b) { -Datum *pa = (Datum *)a; -Datum *pb = (Datum *)b; +Datum *pa = (Datum *)a; /* nice */ +Datum *pb = (Datum *)b; /* code */ return pa->v < pb->v; } @@ -95,7 +98,7 @@ return 30.0* (1.0 / (double)i); /* please explain */ static int generate_samples(short *where, int size, Datum *datas) { int loop; -short value; +short svalue; double vol; char chaine[100]; @@ -108,24 +111,26 @@ for (loop=0; loop