MP3 not playing with OSLib 2.10

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

Moderators: cheriff, TyRaNiD

Post Reply
G43L
Posts: 8
Joined: Sat Nov 07, 2009 8:03 pm

MP3 not playing with OSLib 2.10

Post by G43L »

Dear community,

I'm simply trying to play an MP3 with OSLib 2.10 but... it fails. Tags have been removed with the program 'Mp3 TAG Remover!' (I've verified with XMPlay before and after removal).

Note: I program in C++

Code: Select all

PSP_MODULE_INFO("Screamwind", 0, 0, 2);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_HEAP_SIZE_MAX();
PSP_MAIN_THREAD_STACK_SIZE_KB(512);
In init routine:

Code: Select all

...
oslInitAudio();
...

Code: Select all

#include <oslib/oslib.h>

OSL_SOUND			*pMusic;

void UpdateAudio&#40;&#41;
&#123;
	oslAudioVSync&#40;&#41;;
&#125;

void LoadMusic&#40;string music&#41;
&#123;
	pMusic = oslLoadSoundFile&#40;music.c_str&#40;&#41;, OSL_FMT_STREAM&#41;;
	oslSetSoundLoop&#40;pMusic, 1&#41;;
&#125;

void PlayMusic&#40;&#41;
&#123;
	oslPlaySound&#40;pMusic, 0&#41;;
&#125;

Code: Select all

host0&#58;/src/> ./screamwind.prx
Load/Start host0&#58;/src/screamwind.prx UID&#58; 0x04971F43 Name&#58; "Screamwind"
host0&#58;/src/> Exception - Bus error &#40;data&#41;
Thread ID - 0x0496974F
Th Name   - user_main
Module ID - 0x04971F43
Mod Name  - "Screamwind"
EPC       - 0x08809904
Cause     - 0x1000001C
BadVAddr  - 0x24A206D0
Status    - 0x60088613
zr&#58;0x00000000 at&#58;0xDEADBEEF v0&#58;0x00000000 v1&#58;0x0880F95C
a0&#58;0x08860000 a1&#58;0x00000400 a2&#58;0x0883713E a3&#58;0x0896A5E6
t0&#58;0x0896A5E8 t1&#58;0x00000003 t2&#58;0x0883667C t3&#58;0x0896A5BC
t4&#58;0x00000002 t5&#58;0x00000000 t6&#58;0x08860000 t7&#58;0xDEADBEEF
s0&#58;0x09FBFE08 s1&#58;0x09FBFE34 s2&#58;0x00000001 s3&#58;0x09FBFEE0
s4&#58;0x0000001A s5&#58;0x00000013 s6&#58;0xDEADBEEF s7&#58;0xDEADBEEF
t8&#58;0xDEADBEEF t9&#58;0xDEADBEEF k0&#58;0x09FBFF00 k1&#58;0x00000000
gp&#58;0x08849110 sp&#58;0x09FBFDE8 fp&#58;0x09FBFEA0 ra&#58;0x088096B0
0x08809904&#58; 0xAC430068 'h.C.' - sw         $v1, 104&#40;$v0&#41;

host0&#58;/src/> reset
Resetting psplink
host0&#58;/src/>
Hope you might help,
G43L
Last edited by G43L on Wed Nov 18, 2009 4:48 pm, edited 2 times in total.
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

try this:

change
PSP_HEAP_SIZE_MAX();
to
PSP_HEAP_SIZE_KB(-2048);
So you have space to load the codec prxes.

Have you initalised the audio system?

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
G43L
Posts: 8
Joined: Sat Nov 07, 2009 8:03 pm

Post by G43L »

jojojoris wrote:try this:

change
PSP_HEAP_SIZE_MAX();
to
PSP_HEAP_SIZE_KB(-2048);
So you have space to load the codec prxes.

Have you initalised the audio system?
I've tried PSP_HEAP_SIZE_KB(-2048) without success.

Yes, I init the audio system with oslInitAudio().


Thanks for your help,
G43L
G43L
Posts: 8
Joined: Sat Nov 07, 2009 8:03 pm

Post by G43L »

Code: Select all

host0&#58;/src/> ./screamwind.prx
Load/Start host0&#58;/src/screamwind.prx UID&#58; 0x04971F47 Name&#58; "Screamwind"
host0&#58;/src/> Exception - Bus error &#40;data&#41;
Thread ID - 0x04969753
Th Name   - user_main
Module ID - 0x04971F47
Mod Name  - "Screamwind"
EPC       - 0x08809904
Cause     - 0x1000001C
BadVAddr  - 0x24A206D0
Status    - 0x60088613
zr&#58;0x00000000 at&#58;0xDEADBEEF v0&#58;0x00000000 v1&#58;0x0880F95C
a0&#58;0x08860000 a1&#58;0x00000400 a2&#58;0x0883713E a3&#58;0x0896A5E6
t0&#58;0x0896A5E8 t1&#58;0x00000003 t2&#58;0x0883667C t3&#58;0x0896A5BC
t4&#58;0x00000002 t5&#58;0x00000000 t6&#58;0x08860000 t7&#58;0xDEADBEEF
s0&#58;0x09FBFE08 s1&#58;0x09FBFE34 s2&#58;0x00000001 s3&#58;0x09FBFEE0
s4&#58;0x0000001A s5&#58;0x00000013 s6&#58;0xDEADBEEF s7&#58;0xDEADBEEF
t8&#58;0xDEADBEEF t9&#58;0xDEADBEEF k0&#58;0x09FBFF00 k1&#58;0x00000000
gp&#58;0x08849110 sp&#58;0x09FBFDE8 fp&#58;0x09FBFEA0 ra&#58;0x088096B0
0x08809904&#58; 0xAC430068 'h.C.' - sw         $v1, 104&#40;$v0&#41;
By the way, can someone tell me which information is important in the the listing above?


G43L
a_noob
Posts: 97
Joined: Sun Sep 17, 2006 8:33 am
Location: _start: jr 0xDEADBEEF

Post by a_noob »

The EPC

run this in psplink
calc $epc-$mod
psp-addr2line -e youapp.elf (addr from calc)

and it will tell you the line of code you need to look at.

The problem is a bad pointer.

you have v0 as null then you are trying to reference v0 + 104 which is an invalid memory address.

Code: Select all

.øOº'ºOø.
'ºOo.oOº'
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

a_noob wrote:The EPC

run this in psplink
calc $epc-$mod
psp-addr2line -e youapp.elf (addr from calc)

and it will tell you the line of code you need to look at.

The problem is a bad pointer.

you have v0 as null then you are trying to reference v0 + 104 which is an invalid memory address.
NOTE:
add -g to your cflags so it will include debugger information in the prx/elf if you don't see any usefull information in psp-addr2line

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
G43L
Posts: 8
Joined: Sat Nov 07, 2009 8:03 pm

Post by G43L »

jojojoris wrote:
a_noob wrote:The EPC

run this in psplink
calc $epc-$mod
psp-addr2line -e youapp.elf (addr from calc)

and it will tell you the line of code you need to look at.

The problem is a bad pointer.

you have v0 as null then you are trying to reference v0 + 104 which is an invalid memory address.
NOTE:
add -g to your cflags so it will include debugger information in the prx/elf if you don't see any usefull information in psp-addr2line
OK, thank you for the explanation and the how to. I'll remember that for later...

I've been advised on another forum to use oslLoadSoundFileMP3 instead
of oslLoadSoundFile. Also, I've read in the lib documentation that oslInitAudioME(OSL_FMT_MP3) must be called before using this function.
And now, it works :)


G43L
Post Reply