old demo that i want to try in mbed studio

Dependencies:   mbed SDFileSystem_Copy_of_mbed_version I2S

Files at this revision

API Documentation at this revision

Comitter:
roryhand
Date:
Sun Sep 08 20:33:59 2019 +0000
Parent:
46:de390e45c2af
Child:
48:01490448a05a
Child:
54:606a83fff291
Commit message:
FINISHED - a basic Fade In demo. We aren't even using a switch on the input, and we have not yet written block 2. We also need to add in appropriate code to make fclose of different files work (hopefully)

Changed in this revision

NotchingDemo.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/NotchingDemo.cpp	Sun Sep 08 20:13:09 2019 +0000
+++ b/NotchingDemo.cpp	Sun Sep 08 20:33:59 2019 +0000
@@ -318,6 +318,7 @@
     FadeFlag = 1;
     fseek(wavfile2,44,SEEK_SET);
     fseek(wavfile3,44,SEEK_SET);
+    //printf("We are inside the FadeOut interrupt routine\n\r");
 
 }
 
@@ -414,7 +415,7 @@
     
     
     timer_open.start();
-    wavfile2 = fopen("/sd/mydir/SoundDecoder_second/02.wav","rb");
+    wavfile2 = fopen("/sd/mydir/SoundDecoder_second/09.wav","rb");
         if(wavfile2 == NULL) {
         printf("Cannot Open wavfile2\n\r");
     }
@@ -422,7 +423,7 @@
     printf("It took %d useconds to open file\n\r",timer_open.read_us());
     
     timer_open.start();
-    wavfile3 = fopen("/sd/mydir/SoundDecoder_second/03.wav","rb");
+    wavfile3 = fopen("/sd/mydir/SoundDecoder_second/02.wav","rb");
         if(wavfile3 == NULL) {
         printf("Cannot Open wavfile3\n\r");
     }
@@ -435,7 +436,7 @@
     Sound3 = ReadFileInfo(Sound3,wavfile3);
 
 
-    NotchFadeIn.LengthSecs = 4;
+    NotchFadeIn.LengthSecs = 2;
     NotchFadeOut.LengthSecs = 2;
     NotchFadeIn = FadeDataInitialise(NotchFadeIn);
     NotchFadeOut = FadeDataInitialise(NotchFadeOut);
@@ -673,10 +674,6 @@
 
         //make sure we are reading in the correct "notch" here
 
-        if(FadeFlag) {
-            if(feof(wavfile1)) {
-                fseek(wavfile1,44,SEEK_SET);
-            }
 
 
             /*Block1*/
@@ -688,6 +685,9 @@
                 slice1 = 0;
                 fseek(wavfile1,44,SEEK_SET);
             }
+            if(feof(wavfile1)) {
+                fseek(wavfile1,44,SEEK_SET);
+            }
             fread(Sound1.FileInfo.slice_buf,Sound1.FileInfo.FileFormat.block_align,1,wavfile1);
             Sound1.data_sptr=(short *)Sound1.FileInfo.slice_buf;     // 16 bit samples
 //=============================================================================================
@@ -715,13 +715,19 @@
             //Sounds[NotchingSet.Notch-1].data_sptr = (short *)Sounds[NotchingSet.Notch-1].FileInfo.slice_buf;
             //We are now performing this section above.
 
+
+        if(FadeFlag) {
+            if(feof(wavfile1)) {
+                fseek(wavfile1,44,SEEK_SET);
+            }
+
+
             //require this to get the fadeout coefficient for Sound1.
             NotchFadeOut.FadeCoeff = NotchFadeOut.FadeOut();//compute new FadeOut Coeff value
 
 
 
             if( ((Sound2.FileInfo.FileData.subchunk2_size) - NotchFadeIn.Length - 2*11025) <= (ftell(wavfile2) + 44))
-                //if( (WavInfo_IdleN2.FileData.subchunk2_size)/8 <=ftell(IdleN2Wav) )
             {