MP3 Playback sample code

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

MP3 Playback sample code

Post by Shapyi »

I hear libmad is used to decode MP3s. I am new to libmad and I was wondering if anyone had any sample code or source code on how to play an MP3 on PSP. I am making a simple 2D game and I would like music in it. Thanks.
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

Alright, I downloaded libmad, compiled it and typed "make install". But it doesn't put the include file and lib file in any directory. I put mad include in the right directory, but no matter where I put libmad.a, my program doesn't compile, I get

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/bin/ld: cannot find -libmad
collect2: ld returned 1 exit status
Here is my make file

Code: Select all

TARGET = gamesdk
OBJS = main.o pg.o mp3player.o

INCDIR = 
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)

LIBDIR = 
LDFLAGS =
LIBS= -lpspgu -lpspaudiolib -lpspaudio -libmad

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Test App

PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
Can anyone help?
Chrighton
Posts: 58
Joined: Wed Jun 15, 2005 8:24 pm

Post by Chrighton »

Shapyi wrote:Alright, I downloaded libmad, compiled it and typed "make install". But it doesn't put the include file and lib file in any directory. I put mad include in the right directory, but no matter where I put libmad.a, my program doesn't compile, I get

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/bin/ld: cannot find -libmad
collect2: ld returned 1 exit status
Perhaps -lmad will do (provided the lib can be found in your searchpaths somewhere)
Shapyi
Posts: 95
Joined: Mon Apr 25, 2005 9:31 am

Post by Shapyi »

Chrighton wrote:
Shapyi wrote:Alright, I downloaded libmad, compiled it and typed "make install". But it doesn't put the include file and lib file in any directory. I put mad include in the right directory, but no matter where I put libmad.a, my program doesn't compile, I get

Code: Select all

/usr/local/pspdev/lib/gcc/psp/4.0.0/../../../../psp/bin/ld: cannot find -libmad
collect2: ld returned 1 exit status
Perhaps -lmad will do (provided the lib can be found in your searchpaths somewhere)
Yup. That did it. Thank you.

And if anyone is reading this thread and is interested in MP3 Decoding I used the source code from PSPMediaCenter by John_K. Worked like a charm.
Shito
Posts: 21
Joined: Wed May 11, 2005 1:38 am

Post by Shito »

Works like a charm, but this thing is killing my fps !!! :/
I'm really bad when it comes to audio, I guess mp3 is quite cpu intensive, isn't there a way to use the ME for this (and how?^^), or is there another format I should be using instead, which would be a little bit lighter on the cpu ??
Post Reply