SMART WAV audio processor connected together with the SMART GPU graphics processor, a \"windows media player\" application is demostrated, be sure to download demo\'s used files to the microSD card. http://vizictechnologies.com/#/software-demos-sw/4560115377
Dependencies: SMARTGPU mbed SMARTWAV
main.cpp@0:a38a3a6a3724, 2012-02-12 (annotated)
- Committer:
- emmanuelchio
- Date:
- Sun Feb 12 01:36:34 2012 +0000
- Revision:
- 0:a38a3a6a3724
1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emmanuelchio | 0:a38a3a6a3724 | 1 | /**************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 2 | /*SMARTWAV intelligent embedded Audio processor unit |
emmanuelchio | 0:a38a3a6a3724 | 3 | those examples are for use the SMARTWAV with the mbed microcontoller, just connect tx,rx,and reset |
emmanuelchio | 0:a38a3a6a3724 | 4 | Board: |
emmanuelchio | 0:a38a3a6a3724 | 5 | http://vizictechnologies.com/#/smart-wav/4559021187 |
emmanuelchio | 0:a38a3a6a3724 | 6 | |
emmanuelchio | 0:a38a3a6a3724 | 7 | This example requires pre-loaded content to the micro SD card, Audio .WAV files! |
emmanuelchio | 0:a38a3a6a3724 | 8 | |
emmanuelchio | 0:a38a3a6a3724 | 9 | www.vizictechnologies.com |
emmanuelchio | 0:a38a3a6a3724 | 10 | Vizic Technologies copyright 2012 */ |
emmanuelchio | 0:a38a3a6a3724 | 11 | /**************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 12 | /**************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 13 | |
emmanuelchio | 0:a38a3a6a3724 | 14 | #include "mbed.h" |
emmanuelchio | 0:a38a3a6a3724 | 15 | #include "SMARTWAV.h" |
emmanuelchio | 0:a38a3a6a3724 | 16 | #include "SMARTGPU.h" |
emmanuelchio | 0:a38a3a6a3724 | 17 | |
emmanuelchio | 0:a38a3a6a3724 | 18 | SMARTWAV sWav(p13,p14,p15); //(TX,RX,Reset); |
emmanuelchio | 0:a38a3a6a3724 | 19 | SMARTGPU lcd(p28,p27,p29); //(TX,RX,Reset); |
emmanuelchio | 0:a38a3a6a3724 | 20 | |
emmanuelchio | 0:a38a3a6a3724 | 21 | //Each times we use the touchscreen we must define a int array that stores the X and Y readed or touched coordinates. |
emmanuelchio | 0:a38a3a6a3724 | 22 | int touch[2]; |
emmanuelchio | 0:a38a3a6a3724 | 23 | //Each times we use the touchicon we must define a char array that stores the name of the touched icon. |
emmanuelchio | 0:a38a3a6a3724 | 24 | char icon[3]; |
emmanuelchio | 0:a38a3a6a3724 | 25 | |
emmanuelchio | 0:a38a3a6a3724 | 26 | //Global Variables |
emmanuelchio | 0:a38a3a6a3724 | 27 | char playList[500]; //an array for storing the retrieved list of Audio files |
emmanuelchio | 0:a38a3a6a3724 | 28 | char dirList[500]; //an array for storing the retrieved list of Folders/Dirs |
emmanuelchio | 0:a38a3a6a3724 | 29 | char songName[9]; // 8 characters + null character |
emmanuelchio | 0:a38a3a6a3724 | 30 | char times[6]={0}; //array to store the times |
emmanuelchio | 0:a38a3a6a3724 | 31 | unsigned char audioItems=0; //variable storing the total of audio files on the 'playlist' array |
emmanuelchio | 0:a38a3a6a3724 | 32 | unsigned char dirItems=0; //variable storing the total of Folders/Dirs on the 'dirList' array |
emmanuelchio | 0:a38a3a6a3724 | 33 | unsigned char totalAudioItems=0; |
emmanuelchio | 0:a38a3a6a3724 | 34 | unsigned char songPointer=0; |
emmanuelchio | 0:a38a3a6a3724 | 35 | unsigned char minutes=0,seconds=0; |
emmanuelchio | 0:a38a3a6a3724 | 36 | unsigned int progress=0; //to draw song progress |
emmanuelchio | 0:a38a3a6a3724 | 37 | |
emmanuelchio | 0:a38a3a6a3724 | 38 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 39 | //Simple function to count the number of items on a list |
emmanuelchio | 0:a38a3a6a3724 | 40 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 41 | unsigned char getListItems(char *list){ // returns the number of audio files on current folder/Dir, if none or fails returns 0 |
emmanuelchio | 0:a38a3a6a3724 | 42 | unsigned int i=0; |
emmanuelchio | 0:a38a3a6a3724 | 43 | unsigned char counter=0; |
emmanuelchio | 0:a38a3a6a3724 | 44 | |
emmanuelchio | 0:a38a3a6a3724 | 45 | while(1){ |
emmanuelchio | 0:a38a3a6a3724 | 46 | if(list[i]==','){ |
emmanuelchio | 0:a38a3a6a3724 | 47 | counter ++; |
emmanuelchio | 0:a38a3a6a3724 | 48 | } |
emmanuelchio | 0:a38a3a6a3724 | 49 | if(list[i]==0x00){ |
emmanuelchio | 0:a38a3a6a3724 | 50 | return counter; |
emmanuelchio | 0:a38a3a6a3724 | 51 | } |
emmanuelchio | 0:a38a3a6a3724 | 52 | i++; |
emmanuelchio | 0:a38a3a6a3724 | 53 | } |
emmanuelchio | 0:a38a3a6a3724 | 54 | } |
emmanuelchio | 0:a38a3a6a3724 | 55 | |
emmanuelchio | 0:a38a3a6a3724 | 56 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 57 | //Simple function that returns the name of a given item number of a list |
emmanuelchio | 0:a38a3a6a3724 | 58 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 59 | unsigned char getListNameItem(char *list, unsigned char itemNo, char *name){ // returns the name of the sWav file number 'Item' on the given 'name' buffer; on current buffer, fails or end of items return 0, succesfull returns 1; |
emmanuelchio | 0:a38a3a6a3724 | 60 | unsigned int i=0; |
emmanuelchio | 0:a38a3a6a3724 | 61 | unsigned char counter=0,x=0; |
emmanuelchio | 0:a38a3a6a3724 | 62 | |
emmanuelchio | 0:a38a3a6a3724 | 63 | while(1){ |
emmanuelchio | 0:a38a3a6a3724 | 64 | if(counter==itemNo){ |
emmanuelchio | 0:a38a3a6a3724 | 65 | break; |
emmanuelchio | 0:a38a3a6a3724 | 66 | } |
emmanuelchio | 0:a38a3a6a3724 | 67 | while(1){ |
emmanuelchio | 0:a38a3a6a3724 | 68 | if(list[i]==','){ |
emmanuelchio | 0:a38a3a6a3724 | 69 | i++; |
emmanuelchio | 0:a38a3a6a3724 | 70 | counter ++; |
emmanuelchio | 0:a38a3a6a3724 | 71 | break; |
emmanuelchio | 0:a38a3a6a3724 | 72 | } |
emmanuelchio | 0:a38a3a6a3724 | 73 | if(list[i]==0x00){ |
emmanuelchio | 0:a38a3a6a3724 | 74 | return 0; |
emmanuelchio | 0:a38a3a6a3724 | 75 | } |
emmanuelchio | 0:a38a3a6a3724 | 76 | i++; |
emmanuelchio | 0:a38a3a6a3724 | 77 | } |
emmanuelchio | 0:a38a3a6a3724 | 78 | } |
emmanuelchio | 0:a38a3a6a3724 | 79 | while(1){ |
emmanuelchio | 0:a38a3a6a3724 | 80 | name[x]=list[i]; |
emmanuelchio | 0:a38a3a6a3724 | 81 | i++; |
emmanuelchio | 0:a38a3a6a3724 | 82 | x++; |
emmanuelchio | 0:a38a3a6a3724 | 83 | if(list[i]==','){ |
emmanuelchio | 0:a38a3a6a3724 | 84 | name[x]=0x00; |
emmanuelchio | 0:a38a3a6a3724 | 85 | return 1; |
emmanuelchio | 0:a38a3a6a3724 | 86 | } |
emmanuelchio | 0:a38a3a6a3724 | 87 | if(x>7){ |
emmanuelchio | 0:a38a3a6a3724 | 88 | return 0; |
emmanuelchio | 0:a38a3a6a3724 | 89 | } |
emmanuelchio | 0:a38a3a6a3724 | 90 | } |
emmanuelchio | 0:a38a3a6a3724 | 91 | } |
emmanuelchio | 0:a38a3a6a3724 | 92 | |
emmanuelchio | 0:a38a3a6a3724 | 93 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 94 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 95 | //This function gets the existing folders and songs on the microSD root, and displays them |
emmanuelchio | 0:a38a3a6a3724 | 96 | void getData(){ |
emmanuelchio | 0:a38a3a6a3724 | 97 | unsigned char x; |
emmanuelchio | 0:a38a3a6a3724 | 98 | char name[9]={0}; |
emmanuelchio | 0:a38a3a6a3724 | 99 | |
emmanuelchio | 0:a38a3a6a3724 | 100 | wait_ms(50); |
emmanuelchio | 0:a38a3a6a3724 | 101 | sWav.getFolderList(dirList); |
emmanuelchio | 0:a38a3a6a3724 | 102 | wait_ms(50); |
emmanuelchio | 0:a38a3a6a3724 | 103 | sWav.getFileList(playList); |
emmanuelchio | 0:a38a3a6a3724 | 104 | audioItems=getListItems(playList); |
emmanuelchio | 0:a38a3a6a3724 | 105 | dirItems=getListItems(dirList); |
emmanuelchio | 0:a38a3a6a3724 | 106 | |
emmanuelchio | 0:a38a3a6a3724 | 107 | if(dirItems>8){ //Show up to 8 Folders/Dirs |
emmanuelchio | 0:a38a3a6a3724 | 108 | dirItems=8; |
emmanuelchio | 0:a38a3a6a3724 | 109 | } |
emmanuelchio | 0:a38a3a6a3724 | 110 | |
emmanuelchio | 0:a38a3a6a3724 | 111 | if(audioItems>8){ //Show up to 8 audio Items |
emmanuelchio | 0:a38a3a6a3724 | 112 | audioItems=8; |
emmanuelchio | 0:a38a3a6a3724 | 113 | } |
emmanuelchio | 0:a38a3a6a3724 | 114 | //display the folder items |
emmanuelchio | 0:a38a3a6a3724 | 115 | for(x=0;x<dirItems;x++){ |
emmanuelchio | 0:a38a3a6a3724 | 116 | getListNameItem(dirList,x,name); |
emmanuelchio | 0:a38a3a6a3724 | 117 | lcd.string(15,70+(x*20),319,239,YELLOW,FONT3,UNFILL,name); |
emmanuelchio | 0:a38a3a6a3724 | 118 | } |
emmanuelchio | 0:a38a3a6a3724 | 119 | //display the audio items |
emmanuelchio | 0:a38a3a6a3724 | 120 | for(x=0;x<audioItems;x++){ |
emmanuelchio | 0:a38a3a6a3724 | 121 | getListNameItem(playList,x,name); |
emmanuelchio | 0:a38a3a6a3724 | 122 | lcd.string(170,70+(x*20),319,239,YELLOW,FONT3,UNFILL,name); |
emmanuelchio | 0:a38a3a6a3724 | 123 | } |
emmanuelchio | 0:a38a3a6a3724 | 124 | //get true total items |
emmanuelchio | 0:a38a3a6a3724 | 125 | audioItems=getListItems(playList); |
emmanuelchio | 0:a38a3a6a3724 | 126 | totalAudioItems=audioItems; |
emmanuelchio | 0:a38a3a6a3724 | 127 | dirItems=getListItems(dirList); |
emmanuelchio | 0:a38a3a6a3724 | 128 | } |
emmanuelchio | 0:a38a3a6a3724 | 129 | |
emmanuelchio | 0:a38a3a6a3724 | 130 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 131 | /************************************************************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 132 | //This function search for a song and play it, also displays the song artwork. |
emmanuelchio | 0:a38a3a6a3724 | 133 | void searchSong(){ |
emmanuelchio | 0:a38a3a6a3724 | 134 | char name[9]={0}; |
emmanuelchio | 0:a38a3a6a3724 | 135 | |
emmanuelchio | 0:a38a3a6a3724 | 136 | if(songPointer>=totalAudioItems){//if we reached the end of items |
emmanuelchio | 0:a38a3a6a3724 | 137 | songPointer=0; |
emmanuelchio | 0:a38a3a6a3724 | 138 | } |
emmanuelchio | 0:a38a3a6a3724 | 139 | while(1){ |
emmanuelchio | 0:a38a3a6a3724 | 140 | getListNameItem(playList,songPointer,name); //get a song file name |
emmanuelchio | 0:a38a3a6a3724 | 141 | if(sWav.playTrackName(name)=='O'){ |
emmanuelchio | 0:a38a3a6a3724 | 142 | lcd.imageSD(80,25,name); |
emmanuelchio | 0:a38a3a6a3724 | 143 | lcd.drawRectangle(10,8,75,22,0x0926,FILL); //erase previous song name |
emmanuelchio | 0:a38a3a6a3724 | 144 | lcd.string(10,8,319,239,WHITE,FONT3,FILL,name); //draw song name |
emmanuelchio | 0:a38a3a6a3724 | 145 | lcd.string(265,8,319,239,WHITE,FONT2,FILL,"00:00"); //draw the times |
emmanuelchio | 0:a38a3a6a3724 | 146 | lcd.drawLine(0,204,319,204,BLACK); //draw progress line |
emmanuelchio | 0:a38a3a6a3724 | 147 | lcd.imageSD(146,208,"pause"); |
emmanuelchio | 0:a38a3a6a3724 | 148 | minutes=0; |
emmanuelchio | 0:a38a3a6a3724 | 149 | seconds=0; |
emmanuelchio | 0:a38a3a6a3724 | 150 | progress=0; |
emmanuelchio | 0:a38a3a6a3724 | 151 | songPointer++; //increase song pointer |
emmanuelchio | 0:a38a3a6a3724 | 152 | break; |
emmanuelchio | 0:a38a3a6a3724 | 153 | }else{ |
emmanuelchio | 0:a38a3a6a3724 | 154 | songPointer++; //increase song pointer |
emmanuelchio | 0:a38a3a6a3724 | 155 | wait_ms(100); |
emmanuelchio | 0:a38a3a6a3724 | 156 | } |
emmanuelchio | 0:a38a3a6a3724 | 157 | } |
emmanuelchio | 0:a38a3a6a3724 | 158 | } |
emmanuelchio | 0:a38a3a6a3724 | 159 | |
emmanuelchio | 0:a38a3a6a3724 | 160 | /**************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 161 | /****************** MAIN LOOP *********************/ |
emmanuelchio | 0:a38a3a6a3724 | 162 | /**************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 163 | /**************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 164 | /***************************************************/ |
emmanuelchio | 0:a38a3a6a3724 | 165 | int main() { |
emmanuelchio | 0:a38a3a6a3724 | 166 | unsigned int tick=0; //counter to advance seconds |
emmanuelchio | 0:a38a3a6a3724 | 167 | |
emmanuelchio | 0:a38a3a6a3724 | 168 | //Those two functions must always be called for SMARTGPU support |
emmanuelchio | 0:a38a3a6a3724 | 169 | lcd.reset(); //configure the serial and pinout of arduino board for SMARTGPU support |
emmanuelchio | 0:a38a3a6a3724 | 170 | lcd.start(); //initialize the SMARTGPU processor |
emmanuelchio | 0:a38a3a6a3724 | 171 | //Those two functions must always be called for SMARTWAV support |
emmanuelchio | 0:a38a3a6a3724 | 172 | sWav.reset(); //perform an initial reset |
emmanuelchio | 0:a38a3a6a3724 | 173 | sWav.init(); //initialize the SMARTWAV processor |
emmanuelchio | 0:a38a3a6a3724 | 174 | |
emmanuelchio | 0:a38a3a6a3724 | 175 | lcd.baudChange(2000000); //set high baud for advanced applications |
emmanuelchio | 0:a38a3a6a3724 | 176 | |
emmanuelchio | 0:a38a3a6a3724 | 177 | //load main playlist |
emmanuelchio | 0:a38a3a6a3724 | 178 | lcd.imageSD(0,0,"List"); |
emmanuelchio | 0:a38a3a6a3724 | 179 | lcd.string(5,5,239,239,GREEN,FONT3,UNFILL,"Library Play List:"); |
emmanuelchio | 0:a38a3a6a3724 | 180 | lcd.string(5,40,239,239,GREEN,FONT3,UNFILL,"Folders/Dirs:"); |
emmanuelchio | 0:a38a3a6a3724 | 181 | lcd.string(160,40,319,239,GREEN,FONT3,UNFILL,"Songs/Audio Files:"); |
emmanuelchio | 0:a38a3a6a3724 | 182 | getData(); //get folders and songs and display them |
emmanuelchio | 0:a38a3a6a3724 | 183 | |
emmanuelchio | 0:a38a3a6a3724 | 184 | //wait_ms for a touch on screen to start playing songs |
emmanuelchio | 0:a38a3a6a3724 | 185 | while(lcd.touchScreen(touch)==0); |
emmanuelchio | 0:a38a3a6a3724 | 186 | lcd.imageSD(0,0,"player"); |
emmanuelchio | 0:a38a3a6a3724 | 187 | lcd.drawLine(230,222,271,222,YELLOW); |
emmanuelchio | 0:a38a3a6a3724 | 188 | lcd.imageSD(266,217,"ball"); |
emmanuelchio | 0:a38a3a6a3724 | 189 | lcd.setTextBackground(0x0926); |
emmanuelchio | 0:a38a3a6a3724 | 190 | |
emmanuelchio | 0:a38a3a6a3724 | 191 | while(1){ |
emmanuelchio | 0:a38a3a6a3724 | 192 | // search for a song and play it + show artwork |
emmanuelchio | 0:a38a3a6a3724 | 193 | searchSong(); |
emmanuelchio | 0:a38a3a6a3724 | 194 | |
emmanuelchio | 0:a38a3a6a3724 | 195 | while(1){ |
emmanuelchio | 0:a38a3a6a3724 | 196 | //wait_ms for a touch on screen to perform something |
emmanuelchio | 0:a38a3a6a3724 | 197 | while(lcd.touchScreen(touch)==0 | touch[YCOORD]<200){ |
emmanuelchio | 0:a38a3a6a3724 | 198 | tick++; |
emmanuelchio | 0:a38a3a6a3724 | 199 | if(tick > 500){ //if about 1 second have passed- this isn't accurate, the best way to achieve 1 second is by timesr interrupts |
emmanuelchio | 0:a38a3a6a3724 | 200 | tick=0; //reset counter |
emmanuelchio | 0:a38a3a6a3724 | 201 | seconds++; |
emmanuelchio | 0:a38a3a6a3724 | 202 | progress++; |
emmanuelchio | 0:a38a3a6a3724 | 203 | if(seconds>59){ |
emmanuelchio | 0:a38a3a6a3724 | 204 | minutes++; |
emmanuelchio | 0:a38a3a6a3724 | 205 | seconds=0; |
emmanuelchio | 0:a38a3a6a3724 | 206 | } |
emmanuelchio | 0:a38a3a6a3724 | 207 | times[0]=(minutes/10)+0x30; //get the tens of the minutes and convert them to ascii |
emmanuelchio | 0:a38a3a6a3724 | 208 | times[1]=(minutes%10)+0x30; //get the ones of the minutes and convert them to ascii |
emmanuelchio | 0:a38a3a6a3724 | 209 | times[2]=':'; |
emmanuelchio | 0:a38a3a6a3724 | 210 | times[3]=(seconds/10)+0x30; //get the tens of the seconds and convert them to ascii |
emmanuelchio | 0:a38a3a6a3724 | 211 | times[4]=(seconds%10)+0x30; //get the ones of the seconds and convert them to ascii |
emmanuelchio | 0:a38a3a6a3724 | 212 | lcd.string(265,8,319,239,WHITE,FONT2,FILL,times); //draw the time |
emmanuelchio | 0:a38a3a6a3724 | 213 | lcd.drawLine(0,204,progress,204,YELLOW); //draw progress line |
emmanuelchio | 0:a38a3a6a3724 | 214 | |
emmanuelchio | 0:a38a3a6a3724 | 215 | if(sWav.getStatus()!=0x01){ //if no song is being played-means end of song |
emmanuelchio | 0:a38a3a6a3724 | 216 | wait_ms(500); |
emmanuelchio | 0:a38a3a6a3724 | 217 | sWav.stopTrack(); |
emmanuelchio | 0:a38a3a6a3724 | 218 | wait_ms(500); |
emmanuelchio | 0:a38a3a6a3724 | 219 | searchSong(); //play next songpointer song |
emmanuelchio | 0:a38a3a6a3724 | 220 | } |
emmanuelchio | 0:a38a3a6a3724 | 221 | } |
emmanuelchio | 0:a38a3a6a3724 | 222 | } |
emmanuelchio | 0:a38a3a6a3724 | 223 | |
emmanuelchio | 0:a38a3a6a3724 | 224 | //decode touch into buttons |
emmanuelchio | 0:a38a3a6a3724 | 225 | if(touch[XCOORD]>90 & touch[XCOORD]<117){//touch on STOP button |
emmanuelchio | 0:a38a3a6a3724 | 226 | sWav.stopTrack(); |
emmanuelchio | 0:a38a3a6a3724 | 227 | lcd.imageSD(146,208,"play"); |
emmanuelchio | 0:a38a3a6a3724 | 228 | lcd.string(265,8,319,239,WHITE,FONT2,FILL,"00:00"); //draw the times |
emmanuelchio | 0:a38a3a6a3724 | 229 | lcd.drawLine(0,204,319,204,BLACK); //draw progress line |
emmanuelchio | 0:a38a3a6a3724 | 230 | wait_ms(1000); |
emmanuelchio | 0:a38a3a6a3724 | 231 | //wait_ms for a touch on play button to resume song play-back |
emmanuelchio | 0:a38a3a6a3724 | 232 | while(lcd.touchScreen(touch)==0 | !(touch[XCOORD]>144 & touch[XCOORD]<173)); |
emmanuelchio | 0:a38a3a6a3724 | 233 | break; |
emmanuelchio | 0:a38a3a6a3724 | 234 | }else if(touch[XCOORD]>116 & touch[XCOORD]<145){//touch on REWIND button |
emmanuelchio | 0:a38a3a6a3724 | 235 | sWav.rewindTrack(); |
emmanuelchio | 0:a38a3a6a3724 | 236 | lcd.string(265,8,319,239,WHITE,FONT2,FILL,"00:00"); //draw the times |
emmanuelchio | 0:a38a3a6a3724 | 237 | lcd.drawLine(0,204,319,204,BLACK); //draw progress line |
emmanuelchio | 0:a38a3a6a3724 | 238 | minutes=0; |
emmanuelchio | 0:a38a3a6a3724 | 239 | seconds=0; |
emmanuelchio | 0:a38a3a6a3724 | 240 | progress=0; |
emmanuelchio | 0:a38a3a6a3724 | 241 | }else if(touch[XCOORD]>144 & touch[XCOORD]<173){//touch on PAUSE/PLAY button |
emmanuelchio | 0:a38a3a6a3724 | 242 | sWav.pausePlay(); |
emmanuelchio | 0:a38a3a6a3724 | 243 | lcd.imageSD(146,208,"play"); |
emmanuelchio | 0:a38a3a6a3724 | 244 | wait_ms(1000); |
emmanuelchio | 0:a38a3a6a3724 | 245 | //wait_ms for a touch on pausePlay button to resume song play-back |
emmanuelchio | 0:a38a3a6a3724 | 246 | while(lcd.touchScreen(touch)==0 | !(touch[XCOORD]>144 & touch[XCOORD]<173)); |
emmanuelchio | 0:a38a3a6a3724 | 247 | sWav.pausePlay(); |
emmanuelchio | 0:a38a3a6a3724 | 248 | lcd.imageSD(146,208,"pause"); |
emmanuelchio | 0:a38a3a6a3724 | 249 | }else if(touch[XCOORD]>172 & touch[XCOORD]<202){//touch on NEXT button |
emmanuelchio | 0:a38a3a6a3724 | 250 | sWav.stopTrack(); |
emmanuelchio | 0:a38a3a6a3724 | 251 | wait_ms(200); |
emmanuelchio | 0:a38a3a6a3724 | 252 | break; |
emmanuelchio | 0:a38a3a6a3724 | 253 | }else if(touch[XCOORD]>229 & touch[XCOORD]<272){//touch on VOLUME |
emmanuelchio | 0:a38a3a6a3724 | 254 | lcd.drawLine(touch[XCOORD],222,271,222,BLACK); |
emmanuelchio | 0:a38a3a6a3724 | 255 | lcd.drawLine(230,222,touch[XCOORD],222,YELLOW); |
emmanuelchio | 0:a38a3a6a3724 | 256 | lcd.imageSD(touch[XCOORD]-4,217,"ball"); |
emmanuelchio | 0:a38a3a6a3724 | 257 | sWav.volume(214+ (touch[XCOORD]-230)); |
emmanuelchio | 0:a38a3a6a3724 | 258 | } |
emmanuelchio | 0:a38a3a6a3724 | 259 | wait_ms(200); |
emmanuelchio | 0:a38a3a6a3724 | 260 | } |
emmanuelchio | 0:a38a3a6a3724 | 261 | } |
emmanuelchio | 0:a38a3a6a3724 | 262 | } |
emmanuelchio | 0:a38a3a6a3724 | 263 | |
emmanuelchio | 0:a38a3a6a3724 | 264 | |
emmanuelchio | 0:a38a3a6a3724 | 265 | |
emmanuelchio | 0:a38a3a6a3724 | 266 |