Wrapper class for wav_player.
Diff: playSound.cpp
- Revision:
- 0:d20271759ae8
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/playSound.cpp Sat Apr 09 06:51:24 2016 +0000 @@ -0,0 +1,26 @@ +#include "playSound.h" +#include "uLCD_4DGL.h" +#include "SDFileSystem.h" +#include "wave_player.h" + +extern uLCD_4DGL uLCD; +extern wave_player player; + +// Given the filename of a .wav file in the SD card, play the file over the speaker. +void playSound(char * wav) +{ + // open wav file + FILE *wave_file; + wave_file=fopen(wav,"r"); + + if(wave_file == NULL){ + uLCD.locate(0,4); + uLCD.printf("Error in SD"); + return; + } + // play wav file + player.play(wave_file); + + // close wav file + fclose(wave_file); +} \ No newline at end of file