forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[SOLVED] Problem with SceMp3Init

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Geecko



Joined: 04 Nov 2008
Posts: 7

PostPosted: Sat Feb 12, 2011 5:57 pm    Post subject: [SOLVED] Problem with SceMp3Init Reply with quote

Hi all,

I'm actually coding a new game so I want to add some sound, using Arshia001's Advanced Audio Library.
My game is using several threads. When I do this :
Code:
int audioThread(SceSize args, void *argp)
{
  while (!exit_state)
  {
     [...]
  }
  return 0;
}


void initAudio()
{
  AalibInit();
  AalibLoad("./audio/music.mp3",MUSIC_CHANNEL,0);
  AalibSetAutoloop(MUSIC_CHANNEL,1);
  AalibPlay(MUSIC_CHANNEL);

  // Start audio thread
  SceUID thid = sceKernelCreateThread("audio_thread",audioThread,0x11,0xFA0,
                                      0,NULL);
}

It's working, the music plays well but when I put AalibLoad in the thread :
Code:
int audioThread(SceSize args, void *argp)
{
  AalibLoad("./audio/music.mp3",MUSIC_CHANNEL,0);
  AalibSetAutoloop(MUSIC_CHANNEL,1);
  AalibPlay(MUSIC_CHANNEL);

  while (!exit_state)
  {
     [...]
  }
  return 0;
}


void initAudio()
{
  AalibInit();

  // Start audio thread
  SceUID thid = sceKernelCreateThread("audio_thread",audioThread,0x11,0xFA0,
                                      0,NULL);
}

It's absolutely not working : AalibLoad returns 22 (PSPAALIB_ERROR_SCEMP3_INIT) and sceMp3Init returns 0x807F00FD. I don't know why... any ideas ?


Last edited by Geecko on Sun Feb 13, 2011 9:12 am; edited 1 time in total
Back to top
View user's profile Send private message
psPea



Joined: 01 Sep 2007
Posts: 67

PostPosted: Sun Feb 13, 2011 5:33 am    Post subject: Reply with quote

I don't think a cwd is setup when you create a new thread, you'll have to set one or use absolute path.
_________________
Click ME!
Back to top
View user's profile Send private message Yahoo Messenger MSN Messenger
Geecko



Joined: 04 Nov 2008
Posts: 7

PostPosted: Sun Feb 13, 2011 8:14 am    Post subject: Reply with quote

Great ! Working like a charm :D

I just got the cwd by calling this in the main function :
Code:
strcpy(cwd,argv[0]);
cwd[strlen(cwd)-strlen("/eboot.pbp")] = '\0';


Then, just added this to your freshly created thread :
Code:
sceIoChdir(cwd);


DONE !
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group