mbeduino MP3 Sheild player MP3 player that runs on mebeduin with MP3 Shield. Regarding mbeduino, refer to: http://mbed.org/users/okini3939/notebook/mbeduino/ Regarding MP3 Shiled, refer to: http://www.sparkfun.com/commerce/product_info.php?products_id=9736
Dependencies: mbed SDFileSystem
Diff: main.cpp
- Revision:
- 1:c47269f0e9e1
- Parent:
- 0:67cb2f650c15
--- a/main.cpp Tue Oct 12 14:11:52 2010 +0000 +++ b/main.cpp Sat Oct 16 05:14:59 2010 +0000 @@ -5,12 +5,18 @@ // (1)Push reset button on the MP3 Sheild to reboot // when this program does not work correctly. // (2)Remenber the file system does not support long file/directory name. -// (3)I have confirmed MP3,Ogg,MIDI work correcly. -// But other formats(WAV,WMA,AAC) do Not work. I don't know reason why... +// (3)I have confirmed MP3,Ogg,MIDI,WMA,FLAC,AAC work correcly. (FLAC needs patch) +// WAV needs data transfer(mbed to VS1053) optimized. +// +// 2010/10/16 +// Patch loading is supported. +// (the patch is needed to make FLAC decoder work) +// MP3,Ogg,MIDI,WMA,FLAC,AAC work correcly. // // 2010/10/12 // ported on mbeduino with MP3 Shield by xshige + #define mbeduino #include "mbed.h" @@ -81,16 +87,13 @@ VS1053 mp3( // PinName mosi, PinName miso, PinName sck, PinName cs, PinName rst, // PinName dreq, PinName dcs, PinName vol) -#ifndef mbeduino - p11, p12, p13, p14, p15, - p16, p17, p20); -#endif + #ifdef mbeduino ARD_D11,ARD_D12,ARD_D13,ARD_D9,p15, ARD_D3,ARD_D2,p20); - -DigitalOut common_cs(ARD_D10); -DigitalOut sdFile_cs(p8); +#else + p11, p12, p13, p14, p15, + p16, p17, p20); #endif @@ -102,24 +105,13 @@ pc.baud(115200); // pc.baud(230400); -#ifdef mbeduino -// I am not sure that the followig code needed - common_cs = 1; // init for de-select???? - sdFile_cs = 1; - wait_ms(100); -#endif /*============================================================ * MP3 Initialising *==========================================================*/ - - mp3._RST = 1; - mp3.cs_high(); //chip disabled - mp3.sci_initialise(); //initialise MBED - mp3.sci_write(0x00,(SM_SDINEW+SM_STREAM)); // set mode reg. - mp3.sci_write(0x03, 0x9800); - mp3.sdi_initialise(); - + + mp3.initialize(); + /*============================================================ * This is the good part *==========================================================*/ @@ -186,7 +178,8 @@ printf("Now Playing: %s\r\n",str); FILE *song; - unsigned char array[512]; +// unsigned char array[8*1024]; + unsigned char array[4*1024]; // bigger size makes click tone in AAC playing song = fopen(str, "rb");