Hello
I duplicated a song called "test.mp3" on the SD-Card with this code, using Chans FatFS-Tiny:
WORD br, bw; // File R/W count int Index=1; char file[]="test.mp3"; char filetype[]=".mp3"; char prefix[]="Song"; char filename[100]={}; // Open source file on the drive 1 res = f_open(&fsrc, file, FA_OPEN_EXISTING | FA_READ); // Create destination file on the drive 0 res = f_open(&fdst, filename, FA_CREATE_ALWAYS | FA_WRITE); if (res) LED_EVENT3(LED2,4); // Copy source to destination for (;;) { res = f_write(&fdst, buffer, br, &bw); if (res || bw < br) break; // error or disk full res = f_read(&fsrc, buffer, sizeof(buffer), &br); if (res || br == 0) break; // error or eof } // Close open files f_close(&fsrc); f_close(&fdst);
Attention: The Forum software is too dumb to display this as code:
This line is inserted before the second file is opened.
The problem now is: the new mp3, when i play it, has no id-Tag and no length information.
Another strange thing: in winamp the used bitrate is shown while playing. The test.mp3 has a constant bitrate of 320 kbit/s. While playing the copied file though, the rate slowly increased from 290 or so. I just could watch it. It grew from 290 to 300 in 15 seconds or so.
The buffer size, i used for the code is 800.