I couldn't find any examples on how to play mp3/ogg files without having to load such files entirely into memory (in other words, streaming)... There is this MP3Player_PlayFile() function in mp3player.h but I can't find any information on how to use it.
Any useful help will be greatly appreciated.
Streaming music off of mp3/ogg files
Re: Streaming music off of mp3/ogg files
Use this one which takes a callback that is called whenever more data is necessary:
Code: Select all
s32 MP3Player_PlayFile(void *cb_data,s32 (*reader)(void *,void *,s32),void (*filterfunc)(struct mad_stream *,struct mad_frame *));
int mp3Reader(void *cbdata, void *dst, int size) {
FILE *file = cbdata;
return fread(dst,1,size,file);
}
void play() {
FILE *myFile = fopen("sd:/music.mp3");
MP3Player_PlayFile(myFile, &mp3Reader, NULL);
fclose(myFile);
}
Who is online
Users browsing this forum: Ahrefs [Bot] and 1 guest