Streaming music off of mp3/ogg files

Post Reply
Posts: 2
Joined: Sun Jun 15, 2014 10:07 am

Streaming music off of mp3/ogg files

Post by TheCodingBrony » Sun Jun 15, 2014 10:41 am

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.

Posts: 3
Joined: Thu Jun 19, 2014 11:34 pm

Re: Streaming music off of mp3/ogg files

Post by emu_kidid » Mon Nov 10, 2014 4:22 am

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);

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests