From 86f3f2e3e7d9496ed7addac3b528721588bdf859 Mon Sep 17 00:00:00 2001 From: tTh Date: Thu, 14 Dec 2023 16:56:38 +0100 Subject: [PATCH] big cleanup: step n+1 --- .gitignore | 2 ++ Ecoute/README.md | 7 +++-- Ecoute/README.txt | 21 ------------- Ecoute/{ => src}/Makefile | 2 +- Ecoute/src/README.md | 13 ++++++++ Ecoute/{ => src}/dump.c | 21 +++++-------- Ecoute/{ => src}/ecoute.h | 2 +- Ecoute/{ => src}/ecran.c | 25 ++++++++-------- Ecoute/{ => src}/fonctions.c | 40 +++++++++++-------------- Ecoute/{ => src}/ifao.c | 29 +++++------------- Ecoute/{ => src}/interactive.c | 53 ++++++++++++++++---------------- Ecoute/{ => src}/magic.c | 7 ++--- Ecoute/{ => src}/main.c | 16 +++++----- Ecoute/{ => src}/playau.c | 55 ++++++++++++++++++---------------- Ecoute/{ => src}/playflac.c | 0 Ecoute/{ => src}/playnote.c | 1 + Ecoute/{ => src}/playogg.c | 11 +++++-- Ecoute/{ => src}/playspeex.c | 0 Ecoute/{ => src}/playwav.c | 6 ++-- 19 files changed, 145 insertions(+), 166 deletions(-) delete mode 100644 Ecoute/README.txt rename Ecoute/{ => src}/Makefile (99%) create mode 100644 Ecoute/src/README.md rename Ecoute/{ => src}/dump.c (81%) rename Ecoute/{ => src}/ecoute.h (98%) rename Ecoute/{ => src}/ecran.c (88%) rename Ecoute/{ => src}/fonctions.c (90%) rename Ecoute/{ => src}/ifao.c (83%) rename Ecoute/{ => src}/interactive.c (90%) rename Ecoute/{ => src}/magic.c (86%) rename Ecoute/{ => src}/main.c (92%) rename Ecoute/{ => src}/playau.c (75%) rename Ecoute/{ => src}/playflac.c (100%) rename Ecoute/{ => src}/playnote.c (99%) rename Ecoute/{ => src}/playogg.c (81%) rename Ecoute/{ => src}/playspeex.c (100%) rename Ecoute/{ => src}/playwav.c (98%) diff --git a/.gitignore b/.gitignore index cd531cf..c1190ae 100644 --- a/.gitignore +++ b/.gitignore @@ -43,6 +43,8 @@ *.idb *.pdb +core + # Kernel Module Compile Results *.mod* *.cmd diff --git a/Ecoute/README.md b/Ecoute/README.md index 6d9eeae..ea0c893 100644 --- a/Ecoute/README.md +++ b/Ecoute/README.md @@ -20,8 +20,8 @@ qui manquent. ## Compilation Il faut installer les paquets -`libao-dev` et `libsndfile-dev` avoir de pouvoir -générer le moindre exécutable. +`libao-dev`, `libogg-dev`, et `libsndfile-dev` avoir de +pouvoir générer le moindre exécutable. Les machins *ncurses* sont censé être là, sinon c'est `ncurses-dev` qui manque. @@ -65,6 +65,9 @@ différents modules. Deuxième étape : Implémenter une fonction bien *molly-guarded* pour pouvoir effacer un fichier sans le moindre risque d'erreur. +Troisième étape : Ajouter un controle du volume sonore, ce qui implique +de replonger dans `alsa` ou la doc de la libao... + tTh. diff --git a/Ecoute/README.txt b/Ecoute/README.txt deleted file mode 100644 index 7479cd4..0000000 --- a/Ecoute/README.txt +++ /dev/null @@ -1,21 +0,0 @@ - - 4 Feb 2005 : this is a new project. I want a console player for ogg/wav - audiofiles, and may be ogg & speex. - who suit my needs: standalone, lowcost, easytouse. - - You need libsndfile and libao installed. - - I DON'T know the technic for playing .ogg files :( - ---------------------------------------------------------------------------- -TODO: - - build the ogg player *now* - - rename some files, because the 'info displayer' go in the - same file as the player. - - write a better english. - - build a function for detecting sound file with a bad .EXT - ---------------------------------------------------------------------------- - - - - Thierry 'tTh' Boudet - diff --git a/Ecoute/Makefile b/Ecoute/src/Makefile similarity index 99% rename from Ecoute/Makefile rename to Ecoute/src/Makefile index 814be95..972d8ec 100644 --- a/Ecoute/Makefile +++ b/Ecoute/src/Makefile @@ -8,7 +8,7 @@ # #---------------------------------------------------------------- -VERSION=0.0039 +VERSION=0.0040 TEKFLAG= -DDEBUG_LEVEL=1 -g CFLAGS=-Wall -Wextra -ansi $(TEKFLAG) -DVERSION=\"$(VERSION)\" diff --git a/Ecoute/src/README.md b/Ecoute/src/README.md new file mode 100644 index 0000000..af7980b --- /dev/null +++ b/Ecoute/src/README.md @@ -0,0 +1,13 @@ +## dump.c +## ecran.c +## fonctions.c +## ifao.c +## interactive.c +## magic.c +## main.c +## playau.c +## playflac.c +## playnote.c +## playogg.c +## playspeex.c +## playwav.c diff --git a/Ecoute/dump.c b/Ecoute/src/dump.c similarity index 81% rename from Ecoute/dump.c rename to Ecoute/src/dump.c index 83109f0..515a791 100644 --- a/Ecoute/dump.c +++ b/Ecoute/src/dump.c @@ -14,7 +14,7 @@ /*==------------------------------------------------------------------==*/ #define T_BUFF_HEX (16*16) -int hexadump(char *fname, WINDOW *w) +static int hexadump(char *fname, WINDOW *w) { int fd; unsigned char buffer[T_BUFF_HEX]; @@ -25,24 +25,20 @@ char chaine[10], lettre; fprintf(stderr, "hexadump of %s\n", fname); #endif -if ( (fd=open(fname, O_RDONLY)) < 0 ) - { +if ( (fd=open(fname, O_RDONLY)) < 0 ) { mvwaddstr(w, 2, 2, "err open"); wrefresh(w); getch(); return -1; } -if ( T_BUFF_HEX != read(fd, buffer, T_BUFF_HEX) ) - { +if ( T_BUFF_HEX != read(fd, buffer, T_BUFF_HEX) ) { mvwaddstr(w, 2, 2, "err read"); wrefresh(w); getch(); } close(fd); -for (lig=0; lig<16; lig++) - { - for (col=0; col<16; col++) - { +for (lig=0; lig<16; lig++) { + for (col=0; col<16; col++) { idx = (lig*16) + col; sprintf(chaine, "%02x", buffer[idx]); mvwaddstr(w, lig+1, (col*3)+1, chaine); @@ -64,7 +60,6 @@ return 0; int dump_this_file(char *fname, int flag) { WINDOW *popup; -int foo; #if DEBUG_LEVEL fprintf(stderr, ">> dump_this_file ( '%s' %d )\n", fname, flag); @@ -73,11 +68,11 @@ fprintf(stderr, ">> dump_this_file ( '%s' %d )\n", fname, flag); popup = newwin(18, 68, L_POPUP, C_POPUP); bordure(popup, 1); mvwaddstr(popup, 0, 2, "{ dump of "); -mvwaddstr(popup, 0, 13, fname); -mvwaddstr(popup, 0, 13+strlen(fname), " }"); +mvwaddstr(popup, 0, 12, fname); +mvwaddstr(popup, 0, 12+strlen(fname), " }"); wrefresh(popup); -foo = hexadump(fname, popup); +(void)hexadump(fname, popup); wrefresh(popup); getch(); diff --git a/Ecoute/ecoute.h b/Ecoute/src/ecoute.h similarity index 98% rename from Ecoute/ecoute.h rename to Ecoute/src/ecoute.h index a9ea54e..f831bcb 100644 --- a/Ecoute/ecoute.h +++ b/Ecoute/src/ecoute.h @@ -97,6 +97,6 @@ int start_sound_output(int k); int stop_sound_output(int k); int infos_sound_output(char *title); -void infos_driver_son(void); +void infos_techniques(void); /*==------------------------------------------------------------------==*/ diff --git a/Ecoute/ecran.c b/Ecoute/src/ecran.c similarity index 88% rename from Ecoute/ecran.c rename to Ecoute/src/ecran.c index 93dd0b7..8e4b705 100644 --- a/Ecoute/ecran.c +++ b/Ecoute/src/ecran.c @@ -19,10 +19,8 @@ int couleur = 0; /*==------------------------------------------------------------------==*/ void bordure(WINDOW * w, int flag) { -if (flag) - box(w, 0, 0); -else - wborder(w, '|', '|', '-', '-', '+', '+', '+', '+'); +if (flag) box(w, 0, 0); +else wborder(w, '|', '|', '-', '-', '+', '+', '+', '+'); } /*==------------------------------------------------------------------==*/ int alerte(char *texte, int flag) @@ -63,12 +61,16 @@ fprintf(stderr, "maxval %ld val %ld largeur %d curseur %d\n", #endif chaine[0] = '[', chaine[largeur] = ']', chaine[largeur+1] = '\0'; -for (foo=1; foo>> %s ( )\n", __func__); initscr(); -if (has_colors()) - { +if (has_colors()) { use_default_colors(); couleur = 1; } diff --git a/Ecoute/fonctions.c b/Ecoute/src/fonctions.c similarity index 90% rename from Ecoute/fonctions.c rename to Ecoute/src/fonctions.c index 19362d0..76328ea 100644 --- a/Ecoute/fonctions.c +++ b/Ecoute/src/fonctions.c @@ -15,6 +15,7 @@ long taille_fichier(int fd) { struct stat st; int foo; + foo = fstat(fd, &st); if (foo) { perror("fonctions.c:18 fstat"); @@ -27,14 +28,15 @@ struct un_type_de_fichier { char *extension; int numtype; char *descr; - } types_de_fichiers[] = -{ + } types_de_fichiers[] = { { ".note", SON_NOTE, "tTh .note files" }, { ".wav", SON_WAV, "Microsoft Wave" }, { ".ogg", SON_OGG, "Xiph Ogg/Vorbis" }, { ".speex", SON_SPEEX, "Xiph Compressed speach" }, { ".au", SON_AU, "Sun/NeXT audio data" }, { ".flac", SON_FLAC, "Free Lossless Audio Codec" }, + { ".opus", SON_OPUS, "OPUS" }, + { ".mp3", SON_MP3, "mp3" }, }; #define NBR_TYPES \ (sizeof(types_de_fichiers)/sizeof(struct un_type_de_fichier)) @@ -55,12 +57,10 @@ int foo, len_nom, len_ext; fprintf(stderr, "type_du_fichier(%s)\n", nom); #endif len_nom = strlen(nom); -for (foo=0; foo len_ext) && - !strcmp(nom+(len_nom-len_ext), types_de_fichiers[foo].extension) ) - { + !strcmp(nom+(len_nom-len_ext), types_de_fichiers[foo].extension) ) { #if DEBUG_LEVEL > 1 fprintf(stderr, " found %s\n", types_de_fichiers[foo].descr); #endif @@ -78,11 +78,9 @@ char *type2ext(int type) { int foo; -if (type == SON_UNKNOW) - return "unknow"; +if (type == SON_UNKNOW) return "unknow"; -for (foo=0; foo #include #include - +#include #include "ecoute.h" /*==------------------------------------------------------------------==*/ @@ -98,39 +98,24 @@ fprintf(stderr, " | is active ? %s\n", isactive ? "yes" : "no"); return -1; } /*==------------------------------------------------------------------==*/ -void infos_driver_son(void) +void infos_techniques(void) { int foo; WINDOW *popup; +char *cptr; #if DEBUG_LEVEL fprintf(stderr, ">>> %s ( )\n", __func__); #endif -#define VID_INV 0 - popup = newwin(12, 60, L_POPUP, C_POPUP); bordure(popup, 1); -#if VID_INV -wstandout(popup); -#endif -mvwaddstr(popup, 0, 2, "{{ sound driver }}"); -#if VID_INV -wstandend(popup); -#endif -wrefresh(popup); +mvwaddstr(popup, 0, 2, "{ Technical infos }"); -foo = start_sound_output(0); -if (foo) { - fprintf(stderr, " %s: start_sound_output -> %d\n", __func__, foo); - } -foo = stop_sound_output(0); -if (foo) { - fprintf(stderr, " %s: stop_sound_output -> %d\n", __func__, foo); - } +cptr = sf_version_string(); +mvwaddstr(popup, 2, 3, cptr); -mvwaddstr(popup, 4, 9, "* function not implemented *"); -mvwaddstr(popup, 11, 2, "{{ hit any key to reboot }}"); +/* mvwaddstr(popup, 11, 2, "* hit any key to reboot *"); */ wrefresh(popup); getch(); delwin(popup); diff --git a/Ecoute/interactive.c b/Ecoute/src/interactive.c similarity index 90% rename from Ecoute/interactive.c rename to Ecoute/src/interactive.c index 613bba7..6094b8e 100644 --- a/Ecoute/interactive.c +++ b/Ecoute/src/interactive.c @@ -44,6 +44,11 @@ static int nombre; /* nbre d'entr int teste_fichier(char *nom, struct stat *stb, int flag) { int foo; + +if (flag) { + fprintf(stderr, "in %s, flag must be 0, was %d\n", __func__, flag); + } + foo = stat(nom, stb); if (foo) { fprintf(stderr, "in %s stat -> %d\n", __func__, errno); @@ -83,8 +88,7 @@ int trier_la_liste(int mode) #if DEBUG_LEVEL fprintf(stderr, "tri de la liste, mode=%d\n", mode); #endif -switch(mode) - { +switch(mode) { case 1: qsort(liste, nombre, sizeof(FICH), cmp_name_asc); break; @@ -117,8 +121,7 @@ int foo, type; int devine; long magicbits; -if ( NULL == (liste = malloc(TCHONK*sizeof(FICH))) ) - { +if ( NULL == (liste = malloc(TCHONK*sizeof(FICH))) ) { fprintf(stderr, "\nno memory in file-listing\n"); abort(); } @@ -127,17 +130,12 @@ dir = opendir("."); if (dir == NULL) { abort(); } /* XXX hard failure */ nombre = 0; -while ( (de=readdir(dir)) != NULL) - { -#if DEBUG_LEVEL -#endif - if ( ! teste_fichier(de->d_name, &statbuf, 0) ) - { +while ( (de=readdir(dir)) != NULL) { + if ( ! teste_fichier(de->d_name, &statbuf, 0) ) { continue; } type = type_du_fichier(de->d_name); - if (type < 0) - { + if (type < 0) { continue; } @@ -159,8 +157,7 @@ while ( (de=readdir(dir)) != NULL) #endif nombre++; /* if needed, increase the size of the list */ - if (nombre >= taille) - { + if (nombre >= taille) { liste = realloc(liste, sizeof(FICH)*(taille+TCHONK)); taille += TCHONK; } @@ -177,7 +174,7 @@ int ln; ln = strlen(liste[number].nom); -mvwprintw(w, line, 2, "%3d %-40s %9d ", +mvwprintw(w, line, 2, " %3d %-50s %9d ", liste[number].idx, liste[number].nom, liste[number].taille); @@ -197,7 +194,9 @@ fprintf(stderr, ">>> %s ( )\n", __func__); #endif foo = faire_la_liste(); - +if (0 == foo) { + /* XXX ERROR MESSAGE AND QUIT ? */ + } affh = LINES-7; /* * create a subwindow for list of files @@ -215,16 +214,14 @@ flag_exit = 0; fprintf(stderr, " %s enter interactive\n", __func__); #endif -do - { +do { #if DEBUG_LEVEL > 1 sprintf(chaine, "nombre:%3d first:%3d curseur:%3d", nombre, first, curseur); mvwaddstr(wfs, 0, 50, chaine); #endif - for (foo=0; foo= nombre) break; @@ -241,8 +238,7 @@ do /* * ici il faudrait effacer le curseur ? */ - switch (key) - { + switch (key) { case KEY_UP: if (curseur) curseur--; else if (first>0) first--; @@ -262,21 +258,24 @@ do case '\r': case 'p': idx = curseur+first; /* ??? */ foo = play_this_file(liste[idx].nom, liste[idx].son.type, 0); +#if DEBUG_LEVEL fprintf(stderr, "play '%s' => %d\n",liste[idx].nom, foo); +#endif break; case 'D': case 'd': - idx = curseur+first; /* ??? FIXME */ + idx = curseur+first; + /* second parameter is ignored */ dump_this_file(liste[idx].nom, 0); break; case 'I': case 'i': - idx = curseur+first; /* ??? FIXME */ + idx = curseur+first; info_about_this_file(liste[idx].nom, liste[idx].son.type); break; - case 'A': case 'a': about(); break; + case 'A': case 'a': about(); break; case 'H': case 'h': case '?': help(); break; case 'n': trier_la_liste(1); break; @@ -286,9 +285,9 @@ do case 'u': trier_la_liste(10); break; case 'U': trier_la_liste(11); break; - case '$': infos_driver_son(); break; + case '$': infos_techniques(); break; - case 'Q': case 'q': + case 'Q': flag_exit = 1; break; } diff --git a/Ecoute/magic.c b/Ecoute/src/magic.c similarity index 86% rename from Ecoute/magic.c rename to Ecoute/src/magic.c index bf81d49..ddf24a6 100644 --- a/Ecoute/magic.c +++ b/Ecoute/src/magic.c @@ -20,13 +20,11 @@ int magic_detect(char *fname, long *pbits) int fd; char buffer[T_BUFF_MAGIC]; -if ( (fd=open(fname, O_RDONLY)) < 0 ) - { +if ( (fd=open(fname, O_RDONLY)) < 0 ) { perror(fname); return -1; } -if ( T_BUFF_MAGIC != read(fd, buffer, T_BUFF_MAGIC) ) - { +if ( T_BUFF_MAGIC != read(fd, buffer, T_BUFF_MAGIC) ) { close(fd); return -2; } @@ -69,4 +67,3 @@ if (0 == strncmp(buffer, "OggS", 4)) return SON_UNKNOW; } /*==------------------------------------------------------------------==*/ -/*==------------------------------------------------------------------==*/ diff --git a/Ecoute/main.c b/Ecoute/src/main.c similarity index 92% rename from Ecoute/main.c rename to Ecoute/src/main.c index f728fbf..1971c57 100644 --- a/Ecoute/main.c +++ b/Ecoute/src/main.c @@ -17,7 +17,7 @@ /*==------------------------------------------------------------------==*/ static char *about_texte[] = { - "{{ About... }}", + "{ About... }", "Ecoute, a sound player - version " VERSION, "Another ugly software made by tontonTh", "", @@ -38,7 +38,7 @@ static char *help_texte[] = "tT Sort by file time", "uU Sort by order (unsort)", "I Infos about this file", - "$ What is the sound driver ?", + "$ Technical infos", "", "Q Quit", NULL @@ -52,8 +52,7 @@ char **ptr; nblignes = largmax = 0; ptr = lignes+1; -while ( *ptr != NULL ) - { +while ( *ptr != NULL ) { #if DEBUG_LEVEL > 1 fprintf(stderr, "%p %s\n", ptr, *ptr); #endif @@ -63,12 +62,11 @@ while ( *ptr != NULL ) ptr++; } -popup = newwin((nblignes)+5, largmax+6, L_POPUP, C_POPUP); +popup = newwin((nblignes)+4, largmax+7, L_POPUP, C_POPUP); bordure(popup, 1); wrefresh(popup); -for (foo=1; foo<=nblignes; foo++) - { +for (foo=1; foo<=nblignes; foo++) { mvwaddstr(popup, (foo)+1, 3, lignes[foo]); #if DEBUG_LEVEL > 1 fprintf(stderr, "%4d %s\n", foo, lignes[foo]); @@ -118,6 +116,10 @@ int foo; char *audiodevice = "none"; char *newdir = NULL; +#if DEBUG_LEVEL +fprintf(stderr, "\n\tE C O U T E %d\n\n", getpid()); +#endif + while ((opt = getopt(argc, argv, "d:hs:x")) != -1) { switch (opt) { case 'd': diff --git a/Ecoute/playau.c b/Ecoute/src/playau.c similarity index 75% rename from Ecoute/playau.c rename to Ecoute/src/playau.c index 443c7fd..40c54c5 100644 --- a/Ecoute/playau.c +++ b/Ecoute/src/playau.c @@ -27,7 +27,7 @@ int driver; char chaine[100]; short * samples; long total_lu; -int lu; +int foo, bar, lu; int maxsample; #if DEBUG_LEVEL @@ -40,8 +40,7 @@ fprintf(stderr, ">>> %s ( '%s' %p )\n", __func__, fname, popup); memset(&sfinfo, 0, sizeof(sfinfo)); sndf = sf_open(fname, SFM_READ, &sfinfo); -if (sndf==NULL) - { +if (NULL == sndf) { mvwaddstr(popup, 4, 4, "Invalid file ?"); wrefresh(popup); getch(); @@ -58,34 +57,41 @@ sprintf(chaine, "channels %d", sfinfo.channels); mvwaddstr(popup, 4, 5, chaine); sprintf(chaine, "format %x", sfinfo.format); mvwaddstr(popup, 5, 5, chaine); - wrefresh(popup); -#if DEBUG_LEVEL -getch(); -#endif /* * memory allocation * warning, we can get multiples channels. */ -if ( NULL == (samples = malloc(T_BUFFER*sizeof(short))) ) - { - perror("\n no memory in AU player"); +if ( NULL == (samples = malloc(T_BUFFER*sizeof(short)))) { + perror("no memory in AU player\n"); abort(); } /* * configuration of the sound output */ -ao_initialize(); +ao_initialize(); +#if DEBUG_LEVEL +fprintf(stderr, "%s: ao ititialised\n", __func__); +#endif + driver = ao_default_driver_id(); +#if DEBUG_LEVEL +fprintf(stderr, "%s: ao default driver = %d\n", __func__, driver); +#endif + +memset(&format, 0, sizeof(format)); format.bits = 16; /* ? */ format.channels = sfinfo.channels; format.rate = sfinfo.samplerate; format.byte_format = AO_FMT_LITTLE; /* XXX ??? */ + +fprintf(stderr, "%s: going to open ao\n", __func__); + device = ao_open_live(driver, &format, NULL); -if (device == NULL) - { +fprintf(stderr, "%s: open live -> %p\n", device); +if (NULL == device) { fprintf(stderr, "\nEcoute: Error open device\n"); /* * comment connaitre la cause de l'erreur ? @@ -99,28 +105,25 @@ if (device == NULL) */ total_lu = 0L; maxsample = 0; -while ( (lu=sf_read_short(sndf, samples, T_BUFFER)) > 0 ) - { + +#if DEBUG_LEVEL +fprintf(stderr, "%s: enter loop\n", __func__); +#endif +while ( (lu=sf_read_short(sndf, samples, T_BUFFER)) > 0 ) { ao_play(device, (char *)samples, lu*2); - - /* WHY IS THIS CODE COMMENTED-OUT ? - - for (foo=0; foo maxsample) - { - sprintf(chaine, "%9ld %6d", total_lu, bar); + for (foo=0; foo maxsample) { + sprintf(chaine, "%9ld max %6d", total_lu, bar); mvwaddstr(popup, 7, 1, chaine); wrefresh(popup); maxsample = bar; } } maxsample = 0; - */ total_lu += (long)lu; - progress_bar(popup, total_lu/sfinfo.channels, sfinfo.frames, 0); + progress_bar(popup, total_lu/sfinfo.channels, sfinfo.frames, 1); wrefresh(popup); } diff --git a/Ecoute/playflac.c b/Ecoute/src/playflac.c similarity index 100% rename from Ecoute/playflac.c rename to Ecoute/src/playflac.c diff --git a/Ecoute/playnote.c b/Ecoute/src/playnote.c similarity index 99% rename from Ecoute/playnote.c rename to Ecoute/src/playnote.c index 40dd3f8..8dddea2 100644 --- a/Ecoute/playnote.c +++ b/Ecoute/src/playnote.c @@ -83,6 +83,7 @@ while ( (lu=read(fd, samples, T_BUFFER)) > 0 ) /* * this is the end, my friends... */ +free(samples); ao_close(device); ao_shutdown(); /* must be paired with ao_initialise */ diff --git a/Ecoute/playogg.c b/Ecoute/src/playogg.c similarity index 81% rename from Ecoute/playogg.c rename to Ecoute/src/playogg.c index 0218344..5e54078 100644 --- a/Ecoute/playogg.c +++ b/Ecoute/src/playogg.c @@ -9,6 +9,7 @@ #include #include +#include #include #include /* for the sound output */ @@ -21,10 +22,11 @@ ogg_sync_state oy; char *oggbuff; int ret; -mvwaddstr(popup, 1, 2, "Ogg playing: work in progress..."); +mvwaddstr(popup, 5, 2, fname); +mvwaddstr(popup, 3, 2, "Ogg playing: work in progress..."); wrefresh(popup); sleep(1); -mvwaddstr(popup, 6, 6, "*** COREDUMPING ***"); +/* mvwaddstr(popup, 6, 6, "*** COREDUMPING ***"); */ wrefresh(popup); getch(); return -42; /* XXX */ @@ -32,6 +34,7 @@ return -42; /* XXX */ /* * preparation */ +memset(&oy, 0, sizeof(oy)); ret = ogg_sync_init(&oy); mvwprintw(popup, 2, 2, "ogg_sync_init -> %d", ret); @@ -40,6 +43,10 @@ mvwprintw(popup, 3, 2, "ogg_sync_buffer -> %p", oggbuff); wrefresh(popup); getch(); +/* + * action ! + */ + /* * termination */ diff --git a/Ecoute/playspeex.c b/Ecoute/src/playspeex.c similarity index 100% rename from Ecoute/playspeex.c rename to Ecoute/src/playspeex.c diff --git a/Ecoute/playwav.c b/Ecoute/src/playwav.c similarity index 98% rename from Ecoute/playwav.c rename to Ecoute/src/playwav.c index 8d7b757..66dec77 100644 --- a/Ecoute/playwav.c +++ b/Ecoute/src/playwav.c @@ -31,9 +31,8 @@ fprintf(stderr, ">>> %s ( '%s' %p )\n", __func__, fname, popup); * get help from 'sndfile' for getting datas */ memset(&sfinfo, 0, sizeof(sfinfo)); - sndf = sf_open(fname, SFM_READ, &sfinfo); -if (sndf==NULL) +if (NULL==sndf) { mvwaddstr(popup, 4, 4, "Invalid file ?"); wrefresh(popup); @@ -53,7 +52,6 @@ sprintf(chaine, "format 0x%x", sfinfo.format); mvwaddstr(popup, 5, 5, chaine); sprintf(chaine, "sections %d", sfinfo.sections); mvwaddstr(popup, 6, 5, chaine); - wrefresh(popup); #if DEBUG_LEVEL > 1 @@ -82,7 +80,7 @@ format.channels = sfinfo.channels; format.rate = sfinfo.samplerate; format.byte_format = AO_FMT_LITTLE; /* XXX ??? */ device = ao_open_live(driver, &format, NULL); -if (device == NULL) +if (NULL==device) { fprintf(stderr, "\nEcoute: Error open device\n"); /*