old demo that i want to try in mbed studio
Dependencies: mbed SDFileSystem_Copy_of_mbed_version I2S
Diff: NotchingDemo.cpp
- Revision:
- 53:954e8ac1df17
- Parent:
- 52:3372052bb105
--- a/NotchingDemo.cpp Sat Sep 14 19:23:22 2019 +0000 +++ b/NotchingDemo.cpp Sun Sep 15 19:33:55 2019 +0000 @@ -347,6 +347,7 @@ slice2 = 0; } else {//if BlockFlag == 1 + printf("Section to open wavfiles 2 and 3\n\r"); //BlockFlag = 1; /* wavfile2 = fopen("/sd/mydir/SoundDecoder_second/09.wav","rb"); @@ -506,7 +507,8 @@ wavfile2 = fopen("/sd/mydir/SoundDecoder_second/09.wav","rb");//22 wavfile3 = fopen("/sd/mydir/SoundDecoder_second/02.wav","rb");//22 - + FadeDataInitialise(NotchFadeIn); + FadeDataInitialise(NotchFadeOut); Play_WaveFileLoop(Sound1,Sound2,Sound3,wavfile1,wavfile2,wavfile3); //Play_WaveFileDual(StartupWav,WavInfo_Startup); @@ -757,12 +759,14 @@ //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); + /*fread(Sound1.FileInfo.slice_buf,Sound1.FileInfo.FileFormat.block_align,1,wavfile1); Sound1.data_sptr=(short *)Sound1.FileInfo.slice_buf; // 16 bit samples + */ //Sound1======================================================================================= if(FadeFlag == 1) { + //printf("FadeFlag == 1 BlockFlag == 1\n\r"); //require this to get the fadeout coefficient for Sound1. NotchFadeOut.FadeCoeff = NotchFadeOut.FadeOut();//compute new FadeOut Coeff value @@ -787,20 +791,21 @@ //If not then we need to pass in the 3 different "data_sptr" variables in separately, and not tied to a specific class //or structure. //Confirmed 8/9/2019 this works! - *Sound1.data_sptr = *Sound3.data_sptr*NotchFadeIn.FadeCoeff;//Sound 3 by itself. + *Sound1.data_sptr = *Sound3.data_sptr;//*NotchFadeIn.FadeCoeff;//Sound 3 by itself. Sound3 = Sound1; fclose(wavfile1); fclose(wavfile2); BlockFlag = 2; FadeFlag = 0; } else { - - *Sound1.data_sptr = *Sound1.data_sptr*NotchFadeOut.FadeCoeff + *Sound2.data_sptr + *Sound3.data_sptr*NotchFadeIn.FadeCoeff;//Sounds 1, 2 and 3 Cross-fade. + *Sound1.data_sptr = *Sound1.data_sptr + *Sound2.data_sptr + *Sound3.data_sptr;//Sounds 1, 2 and 3 Cross-fade. + //*Sound1.data_sptr = *Sound1.data_sptr*NotchFadeOut.FadeCoeff + *Sound2.data_sptr + *Sound3.data_sptr*NotchFadeIn.FadeCoeff;//Sounds 1, 2 and 3 Cross-fade. //probably later on redesign this to work with flags - that way it may be a little easier to debug any issues. } } else { - *Sound1.data_sptr = *Sound1.data_sptr*NotchFadeOut.FadeCoeff + *Sound2.data_sptr;//Sound1 and Sound 2 cross fade + *Sound1.data_sptr = *Sound1.data_sptr + *Sound2.data_sptr;//Sound1 and Sound 2 cross fade + //*Sound1.data_sptr = *Sound1.data_sptr*NotchFadeOut.FadeCoeff + *Sound2.data_sptr;//Sound1 and Sound 2 cross fade } }