Wave player with increased output frequency.
Fork of wave_player by
Revision 2:f8dce50a1fd6, committed 2016-03-16
- Comitter:
- bricecroxton
- Date:
- Wed Mar 16 19:11:00 2016 +0000
- Parent:
- 1:acc3e18e77ad
- Commit message:
- Frequency augmentation.
Changed in this revision
wave_player.cpp | Show annotated file Show diff for this revision Revisions of this file |
wave_player.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r acc3e18e77ad -r f8dce50a1fd6 wave_player.cpp --- a/wave_player.cpp Tue Jan 18 03:57:27 2011 +0000 +++ b/wave_player.cpp Wed Mar 16 19:11:00 2016 +0000 @@ -56,6 +56,9 @@ int *data_wptr; FMT_STRUCT wav_format; long slice,num_slices; + + + DAC_wptr=0; DAC_rptr=0; for (i=0;i<256;i+=2) { @@ -68,6 +71,8 @@ fread(&chunk_id,4,1,wavefile); fread(&chunk_size,4,1,wavefile); while (!feof(wavefile)) { + + if (verbosity) printf("Read chunk ID 0x%x, size 0x%x\n",chunk_id,chunk_size); switch (chunk_id) { @@ -193,7 +198,7 @@ break; } fread(&chunk_id,4,1,wavefile); - fread(&chunk_size,4,1,wavefile); + fread(&chunk_size,4,1,wavefile); } } @@ -204,7 +209,7 @@ #ifdef VERBOSE printf("ISR rdptr %d got %u\n",DAC_rptr,DAC_fifo[DAC_rptr]); #endif - wave_DAC->write_u16(DAC_fifo[DAC_rptr]); + wave_DAC->write_u16(DAC_fifo[DAC_rptr] *(16-volume)/16); DAC_rptr=(DAC_rptr+1) & 0xff; } }
diff -r acc3e18e77ad -r f8dce50a1fd6 wave_player.h --- a/wave_player.h Tue Jan 18 03:57:27 2011 +0000 +++ b/wave_player.h Wed Mar 16 19:11:00 2016 +0000 @@ -58,6 +58,9 @@ */ void set_verbosity(int v); +public: +unsigned int volume; + private: void dac_out(void); int verbosity;