old demo that i want to try in mbed studio
Dependencies: mbed SDFileSystem_Copy_of_mbed_version I2S
Revision 51:dab013a902bd, committed 2019-09-14
- Comitter:
- roryhand
- Date:
- Sat Sep 14 19:16:41 2019 +0000
- Parent:
- 50:78ded157e9bb
- Child:
- 52:3372052bb105
- Commit message:
- wip - playing stuff but still not correct. try and solve on Mon. 16/09/2019
Changed in this revision
| NotchingDemo.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/NotchingDemo.cpp Mon Sep 09 21:18:27 2019 +0000
+++ b/NotchingDemo.cpp Sat Sep 14 19:16:41 2019 +0000
@@ -317,12 +317,19 @@
void FadeOutIsr()
{
+ if(BlockFlag == 0)
+
+ {
+
+ BlockFlag = 2;
+
+ }
if (BlockFlag == 0) {
BlockFlag = 1;
fseek(wavfile2,44,SEEK_SET);
fseek(wavfile3,44,SEEK_SET);
- } else if(BlockFlag == 1) {
+ } else if(BlockFlag == 2) {
//BlockFlag = 2;
//fclose(wavfile1);
//fclose(wavfile2);
@@ -338,7 +345,7 @@
fseek(wavfile2,44,SEEK_SET);//go to beginning of audio segment
slice1 = 0;
slice2 = 0;
- } else {
+ } else {//if BlockFlag == 1
//BlockFlag = 1;
wavfile2 = fopen("/sd/mydir/SoundDecoder_second/09.wav","rb");
@@ -471,7 +478,8 @@
Sound1 = ReadFileInfo(Sound1,wavfile1);
Sound2 = ReadFileInfo(Sound2,wavfile2);
Sound3 = ReadFileInfo(Sound3,wavfile3);
-
+ fclose(wavfile2);
+ fclose(wavfile3);
NotchFadeIn.LengthSecs = 2;
NotchFadeOut.LengthSecs = 2;
@@ -483,6 +491,17 @@
TickFadeOut.attach(&FadeOutIsr,10.0);
printf("about to play wav file\n\r");
+
+ wavfile2 = fopen("/sd/mydir/SoundDecoder_second/10.wav","rb");//22
+
+ wait(1);
+ timer_open.reset();
+ timer_open.start();
+ fclose(wavfile2);
+ timer_open.stop();
+ printf("It took %d useconds to close file\n\r",timer_open.read_us());
+
+
Play_WaveFileLoop(Sound1,Sound2,Sound3,wavfile1,wavfile2,wavfile3);
//Play_WaveFileDual(StartupWav,WavInfo_Startup);
printf("finished playing Wav file\n\r");
@@ -715,6 +734,8 @@
if(feof(wavfile1)) {
fseek(wavfile1,44,SEEK_SET);
}
+ //printf("Debugging\n\r");
+ //printf("At Sound 1 data assignment section\n\r");
fread(Sound1.FileInfo.slice_buf,Sound1.FileInfo.FileFormat.block_align,1,wavfile1);
Sound1.data_sptr=(short *)Sound1.FileInfo.slice_buf; // 16 bit samples
}
@@ -727,6 +748,8 @@
if(feof(wavfile1)) {
fseek(wavfile1,44,SEEK_SET);
}
+ //printf("Debugging\n\r");
+ //printf("At First set of fades assignment point\n\r");
//Sound1=======================================================================================
fread(Sound1.FileInfo.slice_buf,Sound1.FileInfo.FileFormat.block_align,1,wavfile1);
Sound1.data_sptr=(short *)Sound1.FileInfo.slice_buf; // 16 bit samples
@@ -759,9 +782,10 @@
//or structure. //Confirmed 8/9/2019 this works!
*Sound1.data_sptr = *Sound3.data_sptr*NotchFadeIn.FadeCoeff;//Sound 3 by itself.
+ Sound3 = Sound1;
fclose(wavfile1);
fclose(wavfile2);
- BlockFlag = 1;
+ BlockFlag = 2;
FadeFlag = 0;
} else {
@@ -789,7 +813,8 @@
fseek(wavfile3,44,SEEK_SET);
}
-
+ //printf("Debugging\n\r");
+ //printf("At Second set of fades assignment point\n\r");
//Sound3=======================================================================================
fread(Sound3.FileInfo.slice_buf,Sound3.FileInfo.FileFormat.block_align,1,wavfile3);
Sound3.data_sptr=(short *)Sound3.FileInfo.slice_buf; // 16 bit samples
@@ -833,7 +858,7 @@
*Sound1.data_sptr = *Sound1.data_sptr*NotchFadeIn.FadeCoeff;//Sound 1 by itself.
fclose(wavfile3);
fclose(wavfile2);
- BlockFlag = 2;
+ BlockFlag = 1;
FadeFlag = 0;
} else {
@@ -860,6 +885,9 @@
/**********************************************************************************************************/
/****************************DATA OUTPUT SECTION***********************************************************/
/**********************************************************************************************************/
+
+ //printf("Debugging\n\r");
+ //printf("At Sound output point\n\r");
for (channel=0; channel<Sound1.FileInfo.FileFormat.num_channels; channel++) {
switch (Sound1.FileInfo.FileFormat.sig_bps) {
case 16: