Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed SDFileSystem_Copy_of_mbed_version I2S
Diff: NotchingDemo.cpp
- Revision:
- 47:9334a8f54997
- Parent:
- 46:de390e45c2af
- Child:
- 48:01490448a05a
- Child:
- 54:606a83fff291
diff -r de390e45c2af -r 9334a8f54997 NotchingDemo.cpp
--- 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) )
{