Tom Coxon / Mbed 2 deprecated EA_WavPlayer

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 /*
00002  Demo of Embedded Artists LPCXpresso baseboard SD card reader and audio facilities.
00003 
00004  By Tom Coxon
00005 
00006  Based on WAVEplayer by Vlad Cazan/Stephan Rochon modified by Tom Coxon to:
00007 
00008  1. Run correctly on the Embedded Artists LPCXpresso baseboard.
00009  2. To play 8 bit sample size in addition to original 16 bit
00010  3. To be more fault tolerant when playing wav files.
00011 
00012  Place suitable uncompressed wav files with 8 or 16 bit sample sizes on the SD card and ensure the
00013  file names are 8.3 format.  Then change the main method below to the relevant file paths.
00014 
00015  Please set all jumpers on board to the default case except for the following:
00016 
00017  Audio setup:
00018 
00019  1. Insert a jumper in J31 to connect signal PIO1_2 to the low
00020  pass filer as described in section 4.7.2. of base board users
00021  guide.
00022 
00023  2. Insert three jumpers in J33 to connect PIO3_0, PIO3_1 and
00024  PIO3_2 to control the amplifier as described in section 4.8
00025  of base board users guide.
00026 
00027  3. Insert a jumper in J32 and remove any from J34 to use the
00028  internal speaker as described in section 4.8
00029  of base board users guide.
00030 
00031  SD Card setup:
00032 
00033  4. Insert all five jumpers in J39 as described in section 4.3.3
00034  of base board users guide.
00035 
00036  5. Remove jumper marked "A" in J55 In order to connect PIO1_11
00037  to CS signal of J40 (the SPI-SSEL signal)  as described in section 4.3.3
00038  of base board users guide.
00039 */
00040 
00041 #include "mbed.h"
00042 #include "wavplayer.h"
00043 #include "SDHCFileSystem.h"
00044 
00045 DigitalOut led1(LED1);
00046 DigitalOut led4(LED4);
00047 
00048 SDFileSystem sd(p5, p6, p7, p24, "sd");
00049 
00050 int main() {
00051 
00052     WavPlayer myWavPlayer;
00053 
00054     led1 = 1 ;
00055     printf("\r\n--------------- Starting -----------------\r\n");
00056 
00057     myWavPlayer.play_wave("/sd/startup.wav"); //  8 bit sample size
00058 
00059     myWavPlayer.play_wave("/sd/baddonut.wav");  // 16 bit sample size
00060 
00061     myWavPlayer.play_wave("/sd/dduck.wav");  // 8 bit sample size
00062 
00063     myWavPlayer.play_wave("/sd/bbunny.wav");  // 8 bit sample size
00064 
00065     printf("<<<<<<<<<<<<<<<< All done >>>>>>>>>>>>>>>>\r\n");
00066     led1 = 0;
00067     led4 = 1;
00068 }