old demo that i want to try in mbed studio
Dependencies: mbed SDFileSystem_Copy_of_mbed_version I2S
Revision 74:e71a7815f63d, committed 2019-09-30
- Comitter:
- roryhand
- Date:
- Mon Sep 30 22:06:03 2019 +0000
- Branch:
- LargeFile_Tests
- Parent:
- 73:a5ab93214728
- Child:
- 75:8a71e269b890
- Commit message:
- WIP can play a single sound but can't do the fading yet (just sounds bitty and horrible for no apparent reason).
Changed in this revision
| NotchingDemo.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/NotchingDemo.cpp Mon Sep 30 20:54:14 2019 +0000
+++ b/NotchingDemo.cpp Mon Sep 30 22:06:03 2019 +0000
@@ -294,6 +294,7 @@
NotchFadeIn.FadeDataInitialise();
NotchFadeOut.FadeDataInitialise();
TransitionFlag = 1;
+ //printf("We are in the NotchUpIsr() section \n\r");
//NotchFadeOut.FadeDataInitialise;
}
}
@@ -306,6 +307,7 @@
NotchingSet.NotchDirection = 0;
NotchFadeIn.FadeDataInitialise();
NotchFadeOut.FadeDataInitialise();
+ TransitionFlag = 1;
}
}
short * data_sptr1;
@@ -452,6 +454,8 @@
printf("hello\n\r");
//Set up the wolfson Audio Codec board
+
+
wm8731_Config_setup();
//i2s audio data transfer code??
i2s.stereomono(I2S_STEREO);
@@ -463,19 +467,25 @@
sampletick.attach(&isr,1.0/sampling_freq); //1/16000
NotchUpTick.attach(&NotchUpIsr,10.0);
+
+
NotchFadeIn.LengthSecs = 2;
NotchFadeOut.LengthSecs = 2;
NotchFadeIn.FadeDataInitialise();
NotchFadeOut.FadeDataInitialise();
+
classPositionIndicators Positions;
- slice1 = Positions.notch7_start_pt;
+ slice1 = Positions.notch_start_pts[1];
+
+
TransitionFlag = 0;
FILE* wavfile1 = fopen("/sd/mydir/SoundDecoder_second/All_eight_notches.wav","rb");
- FILE* wavfile2 = fopen("/sd/mydir/SoundDecoder_second/All_14_Notch_Transitions","rb");
+ FILE* wavfile2 = fopen("/sd/mydir/SoundDecoder_second/All_14_Notch_Transitions.wav","rb");
+
//FILE* wavfile1 = fopen("/sd/mydir/SoundDecoder_second/01.wav","rb");
classSoundFile Sound1;
classSoundFile Sound2;
@@ -503,6 +513,7 @@
i2s.stop();
+
}
@@ -614,17 +625,22 @@
if(TransitionFlag)
{
+ //printf("TransitionFlag == 1, so now we are going to do some other processing\n\r");
//NOTCH 1
fseek(wavfile1,Positions.notch_position_indicators[NotchingSet.Notch],SEEK_SET);
- fread(slice_buf1, Sound1.FileInfo.FileFormat.block_align,1,wavfile1);
- data_sptr1=(short *)slice_buf1;
+ //printf("We have seeked through the file\n\r");
+ fread(Sound1.FileInfo.slice_buf, Sound1.FileInfo.FileFormat.block_align,1,wavfile1);
+ //printf("We have now read in 2 bytes of data (i.e. 1 sample)\n\r");
+ data_sptr1=(short *)Sound1.FileInfo.slice_buf;
+ //printf("We have now cast this data to a short data type\n\r");
Positions.notch_position_indicators[NotchingSet.Notch] = Positions.notch_position_indicators[NotchingSet.Notch] + 2;
+ //printf("We have incremented up the Positions.notch_position_indicator");
//increment up the position indicator!
//NOTCH 2
fseek(wavfile1,Positions.notch_position_indicators[NotchingSet.Notch - 1],SEEK_SET);
- fread(slice_buf3, Sound1.FileInfo.FileFormat.block_align,1,wavfile1);
- data_sptr3=(short *)slice_buf3;
+ fread(Sound1.FileInfo.slice_buf, Sound1.FileInfo.FileFormat.block_align,1,wavfile1);
+ data_sptr3=(short *)Sound1.FileInfo.slice_buf;
Positions.notch_position_indicators[NotchingSet.Notch - 1] = Positions.notch_position_indicators[NotchingSet.Notch - 1] + 2;
//increment up the position indicator!
@@ -632,18 +648,19 @@
if(NotchingSet.NotchDirection)
{
+ printf("Reached if(NotchingSet.NotchDirection)\n\r");
//N1 N2 Transition
fseek(wavfile2,Positions.notch_position_indicators[NotchingSet.NotchTransUp],SEEK_SET);
- fread(slice_buf2, Sound1.FileInfo.FileFormat.block_align,1,wavfile2);
- data_sptr2=(short *)slice_buf2;
+ fread(Sound1.FileInfo.slice_buf, Sound1.FileInfo.FileFormat.block_align,1,wavfile2);
+ data_sptr2=(short *)Sound1.FileInfo.slice_buf;
Positions.notch_transitions_position_indicators[NotchingSet.NotchTransUp] = Positions.notch_transitions_position_indicators[NotchingSet.NotchTransUp] + 2;
} else {
//N1 N2 Transition
fseek(wavfile2,Positions.notch_position_indicators[NotchingSet.NotchTransDown],SEEK_SET);
- fread(slice_buf2, Sound1.FileInfo.FileFormat.block_align,1,wavfile2);
- data_sptr2=(short *)slice_buf2;
+ fread(Sound1.FileInfo.slice_buf, Sound1.FileInfo.FileFormat.block_align,1,wavfile2);
+ data_sptr2=(short *)Sound1.FileInfo.slice_buf;
Positions.notch_transitions_position_indicators[NotchingSet.NotchTransUp] = Positions.notch_transitions_position_indicators[NotchingSet.NotchTransUp] + 2;
}