[PSP] cpplibs libpspsnd fix

Create a single thread for each patch to be added to the repository. Please try to stay on topic.
Post Reply
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

[PSP] cpplibs libpspsnd fix

Post by jojojoris »

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

Code: Select all

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: Select all

int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

By "current mikmod version" do you mean libmikmod or mikmodlib?
The existing code should work fine with mikmodlib.
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

eehhhrrrr :$
I got compile errors when i want to compile it with the default libmikmod?

Code: Select all

int main(){
     SetupCallbacks();
     makeNiceGame();
     sceKernelExitGame();
}
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

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.
Post Reply