no print statements

Dependents:   Space Invaders

Files at this revision

API Documentation at this revision

Comitter:
wminix3
Date:
Thu Apr 29 05:37:08 2021 +0000
Parent:
1:acc3e18e77ad
Commit message:
no print statements

Changed in this revision

wave_player.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r acc3e18e77ad -r 9eb24aca2bbe wave_player.cpp
--- a/wave_player.cpp	Tue Jan 18 03:57:27 2011 +0000
+++ b/wave_player.cpp	Thu Apr 29 05:37:08 2021 +0000
@@ -68,29 +68,29 @@
   fread(&chunk_id,4,1,wavefile);
   fread(&chunk_size,4,1,wavefile);
   while (!feof(wavefile)) {
-    if (verbosity)
-      printf("Read chunk ID 0x%x, size 0x%x\n",chunk_id,chunk_size);
+//    if (verbosity)
+//      printf("Read chunk ID 0x%x, size 0x%x\n",chunk_id,chunk_size);
     switch (chunk_id) {
       case 0x46464952:
         fread(&data,4,1,wavefile);
-        if (verbosity) {
-          printf("RIFF chunk\n");
-          printf("  chunk size %d (0x%x)\n",chunk_size,chunk_size);
-          printf("  RIFF type 0x%x\n",data);
-        }
+//        if (verbosity) {
+//          printf("RIFF chunk\n");
+//          printf("  chunk size %d (0x%x)\n",chunk_size,chunk_size);
+//          printf("  RIFF type 0x%x\n",data);
+//        }
         break;
       case 0x20746d66:
         fread(&wav_format,sizeof(wav_format),1,wavefile);
-        if (verbosity) {
-          printf("FORMAT chunk\n");
-          printf("  chunk size %d (0x%x)\n",chunk_size,chunk_size);
-          printf("  compression code %d\n",wav_format.comp_code);
-          printf("  %d channels\n",wav_format.num_channels);
-          printf("  %d samples/sec\n",wav_format.sample_rate);
-          printf("  %d bytes/sec\n",wav_format.avg_Bps);
-          printf("  block align %d\n",wav_format.block_align);
-          printf("  %d bits per sample\n",wav_format.sig_bps);
-        }
+//        if (verbosity) {
+//          printf("FORMAT chunk\n");
+//          printf("  chunk size %d (0x%x)\n",chunk_size,chunk_size);
+//          printf("  compression code %d\n",wav_format.comp_code);
+//          printf("  %d channels\n",wav_format.num_channels);
+//          printf("  %d samples/sec\n",wav_format.sample_rate);
+//          printf("  %d bytes/sec\n",wav_format.avg_Bps);
+//          printf("  block align %d\n",wav_format.block_align);
+//          printf("  %d bits per sample\n",wav_format.sig_bps);
+//        }
         if (chunk_size > sizeof(wav_format))
           fseek(wavefile,chunk_size-sizeof(wav_format),SEEK_CUR);
         break;
@@ -98,18 +98,18 @@
 // allocate a buffer big enough to hold a slice
         slice_buf=(char *)malloc(wav_format.block_align);
         if (!slice_buf) {
-          printf("Unable to malloc slice buffer");
+//          printf("Unable to malloc slice buffer");
           exit(1);
         }
         num_slices=chunk_size/wav_format.block_align;
         samp_int=1000000/(wav_format.sample_rate);
-        if (verbosity) {
-          printf("DATA chunk\n");
-          printf("  chunk size %d (0x%x)\n",chunk_size,chunk_size);
-          printf("  %d slices\n",num_slices);
-          printf("  Ideal sample interval=%d\n",(unsigned)(1000000.0/wav_format.sample_rate));
-          printf("  programmed interrupt tick interval=%d\n",samp_int);
-        }
+//        if (verbosity) {
+//          printf("DATA chunk\n");
+//          printf("  chunk size %d (0x%x)\n",chunk_size,chunk_size);
+//          printf("  %d slices\n",num_slices);
+//          printf("  Ideal sample interval=%d\n",(unsigned)(1000000.0/wav_format.sample_rate));
+//          printf("  programmed interrupt tick interval=%d\n",samp_int);
+//        }
 
 // starting up ticker to write samples out -- no printfs until tick.detach is called
         if (verbosity)
@@ -131,7 +131,7 @@
         for (slice=0;slice<num_slices;slice+=1) {
           fread(slice_buf,wav_format.block_align,1,wavefile);
           if (feof(wavefile)) {
-            printf("Oops -- not enough slices in the wave file\n");
+//            printf("Oops -- not enough slices in the wave file\n");
             exit(1);
           }
           data_sptr=(short *)slice_buf;     // 16 bit samples
@@ -141,18 +141,18 @@
           for (channel=0;channel<wav_format.num_channels;channel++) {
             switch (wav_format.sig_bps) {
               case 16:
-                if (verbosity)
-                  printf("16 bit channel %d data=%d ",channel,data_sptr[channel]);
+                //if (verbosity)
+//                  printf("16 bit channel %d data=%d ",channel,data_sptr[channel]);
                 slice_value+=data_sptr[channel];
                 break;
               case 32:
-                if (verbosity)
-                  printf("32 bit channel %d data=%d ",channel,data_wptr[channel]);
+                //if (verbosity)
+//                  printf("32 bit channel %d data=%d ",channel,data_wptr[channel]);
                 slice_value+=data_wptr[channel];
                 break;
               case 8:
-                if (verbosity)
-                  printf("8 bit channel %d data=%d ",channel,(int)data_bptr[channel]);
+                //if (verbosity)
+//                  printf("8 bit channel %d data=%d ",channel,(int)data_bptr[channel]);
                 slice_value+=data_bptr[channel];
                 break;
             }
@@ -171,8 +171,8 @@
                         break;
           }
           dac_data=(short unsigned)slice_value;
-          if (verbosity)
-            printf("sample %d wptr %d slice_value %d dac_data %u\n",slice,DAC_wptr,(int)slice_value,dac_data);
+          //if (verbosity)
+//            printf("sample %d wptr %d slice_value %d dac_data %u\n",slice,DAC_wptr,(int)slice_value,dac_data);
           DAC_fifo[DAC_wptr]=dac_data;
           DAC_wptr=(DAC_wptr+1) & 0xff;
           while (DAC_wptr==DAC_rptr) {
@@ -183,12 +183,12 @@
         free(slice_buf);
         break;
       case 0x5453494c:
-        if (verbosity)
-          printf("INFO chunk, size %d\n",chunk_size);
+        //if (verbosity)
+//          printf("INFO chunk, size %d\n",chunk_size);
         fseek(wavefile,chunk_size,SEEK_CUR);
         break;
       default:
-        printf("unknown chunk type 0x%x, size %d\n",chunk_id,chunk_size);
+        //printf("unknown chunk type 0x%x, size %d\n",chunk_id,chunk_size);
         data=fseek(wavefile,chunk_size,SEEK_CUR);
         break;
     }
@@ -202,7 +202,7 @@
 {
   if (DAC_on) {
 #ifdef VERBOSE
-  printf("ISR rdptr %d got %u\n",DAC_rptr,DAC_fifo[DAC_rptr]);
+  //printf("ISR rdptr %d got %u\n",DAC_rptr,DAC_fifo[DAC_rptr]);
 #endif
     wave_DAC->write_u16(DAC_fifo[DAC_rptr]);
     DAC_rptr=(DAC_rptr+1) & 0xff;