@@ -314,6 +314,7 @@ int main (int argc, char *argv[])
314
314
if (decimate < 1 || decimate > 8 ) {
315
315
text_color_set (DW_COLOR_ERROR );
316
316
dw_printf ("Unreasonable value for -D.\n" );
317
+ dw_printf ("\e[0m\e\n\e[0J\e" );
317
318
exit (EXIT_FAILURE );
318
319
}
319
320
dw_printf ("Divide audio sample rate by %d\n" , decimate );
@@ -331,6 +332,7 @@ int main (int argc, char *argv[])
331
332
if (upsample < 1 || upsample > 4 ) {
332
333
text_color_set (DW_COLOR_ERROR );
333
334
dw_printf ("Unreasonable value for -U.\n" );
335
+ dw_printf ("\e[0m\e\n\e[0J\e" );
334
336
exit (EXIT_FAILURE );
335
337
}
336
338
dw_printf ("Multiply audio sample rate by %d\n" , upsample );
@@ -344,6 +346,7 @@ int main (int argc, char *argv[])
344
346
if (my_audio_config .achan [0 ].fix_bits < RETRY_NONE || my_audio_config .achan [0 ].fix_bits >= RETRY_MAX ) {
345
347
text_color_set (DW_COLOR_ERROR );
346
348
dw_printf ("Invalid Fix Bits level.\n" );
349
+ dw_printf ("\e[0m\e\n\e[0J\e" );
347
350
exit (EXIT_FAILURE );
348
351
}
349
352
break ;
@@ -424,6 +427,7 @@ int main (int argc, char *argv[])
424
427
if (my_audio_config .achan [0 ].baud < MIN_BAUD || my_audio_config .achan [0 ].baud > MAX_BAUD ) {
425
428
text_color_set (DW_COLOR_ERROR );
426
429
dw_printf ("Use a more reasonable bit rate in range of %d - %d.\n" , MIN_BAUD , MAX_BAUD );
430
+ dw_printf ("\e[0m\e\n\e[0J\e" );
427
431
exit (EXIT_FAILURE );
428
432
}
429
433
@@ -547,6 +551,7 @@ int main (int argc, char *argv[])
547
551
text_color_set (DW_COLOR_ERROR );
548
552
dw_printf ("Couldn't open file for read: %s\n" , argv [optind ]);
549
553
//perror ("more info?");
554
+ dw_printf ("\e[0m\e\n\e[0J\e" );
550
555
exit (EXIT_FAILURE );
551
556
}
552
557
@@ -561,6 +566,7 @@ int main (int argc, char *argv[])
561
566
if (strncmp (header .riff , "RIFF" , 4 ) != 0 || strncmp (header .wave , "WAVE" , 4 ) != 0 ) {
562
567
text_color_set (DW_COLOR_ERROR );
563
568
dw_printf ("This is not a .WAV format file.\n" );
569
+ dw_printf ("\e[0m\e\n\e[0J\e" );
564
570
exit (EXIT_FAILURE );
565
571
}
566
572
@@ -574,11 +580,13 @@ int main (int argc, char *argv[])
574
580
if (strncmp (chunk .id , "fmt " , 4 ) != 0 ) {
575
581
text_color_set (DW_COLOR_ERROR );
576
582
dw_printf ("WAV file error: Found \"%4.4s\" where \"fmt \" was expected.\n" , chunk .id );
583
+ dw_printf ("\e[0m\e\n\e[0J\e" );
577
584
exit (EXIT_FAILURE );
578
585
}
579
586
if (chunk .datasize != 16 && chunk .datasize != 18 ) {
580
587
text_color_set (DW_COLOR_ERROR );
581
588
dw_printf ("WAV file error: Need fmt chunk datasize of 16 or 18. Found %d.\n" , chunk .datasize );
589
+ dw_printf ("\e[0m\e\n\e[0J\e" );
582
590
exit (EXIT_FAILURE );
583
591
}
584
592
@@ -589,24 +597,28 @@ int main (int argc, char *argv[])
589
597
if (strncmp (wav_data .data , "data" , 4 ) != 0 ) {
590
598
text_color_set (DW_COLOR_ERROR );
591
599
dw_printf ("WAV file error: Found \"%4.4s\" where \"data\" was expected.\n" , wav_data .data );
600
+ dw_printf ("\e[0m\e\n\e[0J\e" );
592
601
exit (EXIT_FAILURE );
593
602
}
594
603
595
604
if (format .wformattag != 1 ) {
596
605
text_color_set (DW_COLOR_ERROR );
597
606
dw_printf ("Sorry, I only understand audio format 1 (PCM). This file has %d.\n" , format .wformattag );
607
+ dw_printf ("\e[0m\e\n\e[0J\e" );
598
608
exit (EXIT_FAILURE );
599
609
}
600
610
601
611
if (format .nchannels != 1 && format .nchannels != 2 ) {
602
612
text_color_set (DW_COLOR_ERROR );
603
613
dw_printf ("Sorry, I only understand 1 or 2 channels. This file has %d.\n" , format .nchannels );
614
+ dw_printf ("\e[0m\e\n\e[0J\e" );
604
615
exit (EXIT_FAILURE );
605
616
}
606
617
607
618
if (format .wbitspersample != 8 && format .wbitspersample != 16 ) {
608
619
text_color_set (DW_COLOR_ERROR );
609
620
dw_printf ("Sorry, I only understand 8 or 16 bits per sample. This file has %d.\n" , format .wbitspersample );
621
+ dw_printf ("\e[0m\e\n\e[0J\e" );
610
622
exit (EXIT_FAILURE );
611
623
}
612
624
@@ -709,14 +721,17 @@ int main (int argc, char *argv[])
709
721
if (error_if_less_than != -1 && packets_decoded_total < error_if_less_than ) {
710
722
text_color_set (DW_COLOR_ERROR );
711
723
dw_printf ("\n * * * TEST FAILED: number decoded is less than %d * * * \n" , error_if_less_than );
724
+ dw_printf ("\e[0m\e\n\e[0J\e" );
712
725
exit (EXIT_FAILURE );
713
726
}
714
727
if (error_if_greater_than != -1 && packets_decoded_total > error_if_greater_than ) {
715
728
text_color_set (DW_COLOR_ERROR );
716
729
dw_printf ("\n * * * TEST FAILED: number decoded is greater than %d * * * \n" , error_if_greater_than );
730
+ dw_printf ("\e[0m\e\n\e[0J\e" );
717
731
exit (EXIT_FAILURE );
718
732
}
719
733
734
+ dw_printf ("\e[0m\e\n\e[0J\e" );
720
735
exit (EXIT_SUCCESS );
721
736
}
722
737
@@ -1008,6 +1023,7 @@ static void usage (void) {
1008
1023
dw_printf (" Try different combinations of options to compare decoding\n" );
1009
1024
dw_printf (" performance.\n" );
1010
1025
1026
+ dw_printf ("\e[0m\e\n\e[0J\e" );
1011
1027
exit (1 );
1012
1028
}
1013
1029
0 commit comments