waveplayer with play pause
Dependents: WavePlayer_HelloWorld_RTOS5
Diff: wave_player.cpp
- Revision:
- 2:cb60c55b6628
- Parent:
- 0:62c18ade9a60
- Child:
- 3:a94dd18e8d8e
--- a/wave_player.cpp Tue Jan 18 03:57:27 2011 +0000 +++ b/wave_player.cpp Sun Dec 12 20:08:11 2021 +0000 @@ -15,6 +15,8 @@ #include <stdio.h> #include <wave_player.h> + extern bool playing; + //----------------------------------------------------------------------------- // constructor -- accepts an mbed pin to use for AnalogOut. Only p18 will work @@ -129,6 +131,10 @@ // while 16 and 32 bit wave files use signed data // for (slice=0;slice<num_slices;slice+=1) { + if (playing == true){ + + break; + } fread(slice_buf,wav_format.block_align,1,wavefile); if (feof(wavefile)) { printf("Oops -- not enough slices in the wave file\n");