FreeCalypso > hg > gsmhr-codec-ref
diff gsm_hr.c @ 3:a6db7d8d6df4
change compile-time quiet control to runtime,
and suppress all noisy output
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 15 Jun 2024 00:09:40 +0000 |
parents | 9008dbc8ca74 |
children |
line wrap: on
line diff
--- a/gsm_hr.c Fri Jun 14 23:57:53 2024 +0000 +++ b/gsm_hr.c Sat Jun 15 00:09:40 2024 +0000 @@ -100,6 +100,8 @@ FILE *pfileInFile, *pfileOutFile; + int quiet = 0; + /*_________________________________________________________________________ | | | Executable Code | @@ -163,6 +165,16 @@ option = 0; else if (!strcmp(argv[1], "dec")) option = 1; + else if (!strcmp(argv[1], "enc-q")) + { + option = 0; + quiet = 1; + } + else if (!strcmp(argv[1], "dec-q")) + { + option = 1; + quiet = 1; + } else { printf("error in option selection\n"); @@ -206,6 +218,7 @@ exit(1); } +if (!quiet) { puts("\n\n"); puts(" ****************************************"); puts(" * *"); @@ -241,7 +254,7 @@ printf("input file: %s\n", argv[2]); printf("output file: %s\n\n", argv[3]); - +} switch (option) { @@ -260,9 +273,8 @@ giFrmCnt++) { -#ifndef SILENT - printf("encoding frame %d \r", giFrmCnt); -#endif + if (!quiet) + printf("encoding frame %d \r", giFrmCnt); if (encode(pfileInFile, pfileOutFile)) iDoneFrm = 1; @@ -271,7 +283,8 @@ if (iDoneFrm) giFrmCnt--; - printf(" %d speech frames encoded\n", giFrmCnt - 1); + if (!quiet) + printf(" %d speech frames encoded\n", giFrmCnt - 1); break; case 1: /* decode */ @@ -289,9 +302,8 @@ giFrmCnt++) { -#ifndef SILENT - printf("decoding frame %d \r", giFrmCnt); -#endif + if (!quiet) + printf("decoding frame %d \r", giFrmCnt); if (decode(pfileInFile, pfileOutFile)) iDoneFrm = 1; @@ -300,7 +312,8 @@ if (iDoneFrm) giFrmCnt--; - printf(" %d speech frames decoded\n", giFrmCnt - 1); + if (!quiet) + printf(" %d speech frames decoded\n", giFrmCnt - 1); break; }