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 

[PSP] cpplibs libpspsnd fix

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> Patch Submissions
View previous topic :: View next topic  
Author Message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Wed Oct 28, 2009 4:09 am    Post subject: [PSP] cpplibs libpspsnd fix Reply with quote

I created this fix for libpspsnd to compile with the current mikmod version. I hope i created a right changes.

Code:
Index: libpspsnd/Music.cpp
===================================================================
--- libpspsnd/Music.cpp   (revision 2486)
+++ libpspsnd/Music.cpp   (working copy)
@@ -50,14 +50,14 @@
 
 Music::Music(const string& filename, bool loop, unsigned char maxchan)
 {
-    _mf = MikMod_LoadSong((char*)filename.c_str(), maxchan);
+    _mf = Player_Load((char*)filename.c_str(), maxchan, 0);
     _mf->loop = (int)loop;
 }
 
 Music::~Music()
 {
     if (_mf)
-       MikMod_FreeSong(_mf);
+       Player_Free(_mf);
 }
 
 void Music::start()
@@ -74,7 +74,7 @@
        return;
 
     Player_Stop();
-    MikMod_FreeSong(_mf);
+    Player_Free(_mf);
     _mf = NULL;
 }
 
@@ -92,7 +92,7 @@
     md_sndfxvolume = 128;
     md_reverb = 0;
     md_pansep = 128;
-    MikMod_Init();
+    MikMod_Init("");
     MikMod_SetNumVoices(128, 32);
 
     MikMod_EnableOutput();
Index: libpspsnd/Music.h
===================================================================
--- libpspsnd/Music.h   (revision 2486)
+++ libpspsnd/Music.h   (working copy)
@@ -94,7 +94,7 @@
        static void uninit(void);
 
       protected:
-       UNIMOD *_mf;
+       MODULE *_mf;
     };
 };
 
Index: libpspsnd/Sound.cpp
===================================================================
--- libpspsnd/Sound.cpp   (revision 2486)
+++ libpspsnd/Sound.cpp   (working copy)
@@ -42,19 +42,19 @@
 
 Sound::Sound(const string& filename)
 {
-    _sf = WAV_LoadFN((char*)filename.c_str()); // ugh...
+    _sf = Sample_Load((char*)filename.c_str()); // ugh...
 
     // TODO: check
 }
 
 Sound::~Sound()
 {
-    WAV_Free(_sf);
+    Sample_Free(_sf);
 }
 
 void Sound::start()
 {
-    MikMod_PlaySample(_sf, 0, 0);
+    Sample_Play(_sf, 0, 0);
 }
 
 void Sound::setVolume(unsigned char volume)

_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Oct 28, 2009 4:21 am    Post subject: Reply with quote

By "current mikmod version" do you mean libmikmod or mikmodlib?
The existing code should work fine with mikmodlib.
Back to top
View user's profile Send private message
jojojoris



Joined: 30 Mar 2008
Posts: 261

PostPosted: Wed Oct 28, 2009 4:48 am    Post subject: Reply with quote

eehhhrrrr :$
I got compile errors when i want to compile it with the default libmikmod?
_________________
Code:
int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Oct 28, 2009 7:09 am    Post subject: Reply with quote

Yeah, libmikmod and mikmodlib aren't compatible. I guess libpspsnd was written for mikmodlib. I think we should keep mikmodlib as an compile-time option if we add libmikmod support.
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 -> Patch Submissions 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