does not work yet. Sound starts but then stops after a few seconds, whole thing hangs. Published so as I can import through mbed CLI.
Dependencies: mbed sinelookup SDFileSystem_Copy_of_mbed_version I2S
Revision 4:1a9482a07ee2, committed 2018-10-06
- Comitter:
- roryhand
- Date:
- Sat Oct 06 11:51:23 2018 +0000
- Parent:
- 3:6fba0a044d85
- Child:
- 5:5b120a2d9249
- Commit message:
- plays a very bad quality sound out through i2s WITHOUT using interrupt routine. not really sure why....;
Changed in this revision
| wolfson_3_wav.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/wolfson_3_wav.cpp Sat Oct 06 11:34:37 2018 +0000
+++ b/wolfson_3_wav.cpp Sat Oct 06 11:51:23 2018 +0000
@@ -69,13 +69,15 @@
buffer[0] = (*data_sptr)>>1;
myled = 1;
int bufflen = sizeof(buffer);
+ printf("buffer data: %d \n\r",buffer);
+ printf("data_sptr data: %d \n\r",data_sptr);
//t.start();
//buffer[0] = (int*)data_sptr;
//buffer[0] = newvar;
//buffer[0] = sine16lookup[i];//>>1;//sine16lookup[i];//scale down volume a bit on amp//how would this scale down the volume a bit??
//buffer[0] = *fp;
//printf("value: %d",data_sptr);
- i2s.write(buffer, bufflen);//Send next PWM value to amp
+ i2s.write(data_sptr, bufflen);//Send next PWM value to amp
//t.stop();
//printf("The time taken was %f seconds\n", t.read());
myled = 0;
@@ -328,7 +330,7 @@
printf("chunk_size - sizeof(wav_format) %d\n\r",wav_data.subchunk2_size-sizeof(wav_format));
printf("sizeof(wav_format): %d\n\r",sizeof(wav_format));
printf("do we egt to this point:\n\r");
- sampletick.attach(&isr,1/96000);
+ //sampletick.attach(&isr,1/96000);
//while(!feof(my_wav)){
//while(1){
//if (wav_data.subchunk2_size > sizeof(wav_format)){
@@ -388,6 +390,7 @@
slice_value+=32768;
break;
}
+ i2s.write(data_sptr,2);
//t.stop();
//printf("The time taken was %f seconds\n", t.read());
}