[En-Nut-Discussion] Found a bug in MP3 device
Harald Kipp
harald.kipp at egnite.de
Fri Aug 22 13:27:55 CEST 2003
Hi Michel,
>- VsBufferRequest() and VsBufferAvailable() do not return the same amount of
> free space. More than that, the calculation used was wrong.
Works as designed. VsBufferRequest() returns the number of consecutive
bytes available, while VsBufferAvailable() returns the total number
of bytes available.
>So I looked at my code and I saw that there was no way for me to detect
>whether a wrap around occurred in the circular buffer that is used in the
>vs1001k driver.
There's no need to detect this. Your read routine is interested in
the number of bytes it can fill into the buffer. After this is
filled, you call VsBufferRequest() again, which will automatically
return a new buffer pointer.
>- or add a special write() routine to the vs1001k.c file
Exactly that should be avoided, because it requires an additional
data copy.
Generally I'd suggest moving to version 3.3.0 or, even better, grab the
latest from CVS. Since 3.3 buffer handling and MP3 decoder handling had been
separated. See the detailed description at
http://www.ethernut.de/api/group__xg_bank_mem.html
I spent a "few minutes" :-) on your app and packed it into a ready to use
project:
http://www.ethernut.de/arc/playmp3.zip
The code can be viewed here:
http://www.ethernut.de/api/playmp3_2playmp3_8c-example.html
Enjoy,
Harald
More information about the En-Nut-Discussion
mailing list