OS X Snow Leopard: Fmod Errors

Continuing my stream of threads related to compiling Panda on Snow Leopard, I’ve run into a compilation error with FMod that I think indicates that Panda doesn’t support the latest version of FMod. The error looks like this:

g++ -ftemplate-depth-30  -Wno-deprecated-declarations -c -o Opt3-OSX/p3fmod_audio_fmod_audio_composite1.o -I. -I/Users/dplepage/Downloads/panda3d/panda -I../audio -I../downloader -I../event -I../express -I../gobj -I../gsgbase -I../linmath -I../mathutil -I../movies -I../nativenet -I../net -I../pandabase -I../pipeline -I../pnmimage -I../pstatclient -I../putil -I/usr/local/panda/include -I/opt/local/include -I/opt/local/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -I/Users/dplepage/Downloads/panda3d/dtool/foobar/inc -I/opt/local/include -I/opt/local/include -I/opt/local/include/openssl -I/opt/local/include -I/opt/local/include -I/Library/Frameworks/Cg.framework/Headers -I/opt/local/include -I/opt/local/include    -g -O2 -fPIC fmod_audio_composite1.cxx
In file included from fmod_audio_composite1.cxx:3:
fmodAudioManager.cxx: In constructor ‘FmodAudioManager::FmodAudioManager()’:
fmodAudioManager.cxx:146: error: no matching function for call to ‘FMOD::System::setFileSystem(FMOD_RESULT ()(const char*, int, unsigned int*, void**, void**), FMOD_RESULT ()(void*, void*), FMOD_RESULT ()(void*, void*, unsigned int, unsigned int*, void*), FMOD_RESULT ()(void*, unsigned int, void*), int)’
/Users/dplepage/Downloads/panda3d/dtool/foobar/inc/fmod.hpp:77: note: candidates are: FMOD_RESULT FMOD::System::setFileSystem(FMOD_RESULT (*)(const char*, int, unsigned int*, void**, void**), FMOD_RESULT (*)(void*, void*), FMOD_RESULT (*)(void*, void*, unsigned int, unsigned int*, void*), FMOD_RESULT (*)(void*, unsigned int, void*), FMOD_RESULT (*)(FMOD_ASYNCREADINFO*, void*), FMOD_RESULT (*)(void*, void*), int)
make: *** [Opt3-OSX/p3fmod_audio_fmod_audio_composite1.o] Error 1

and it seems to be caused by the not-backwards-compatible transition from FMod 4.30.05 to FMod 4.31, which changed the System::setFileSystem interface by adding two new parameters, userasyncread and userasynccancel (see linuxtesting.org/upstream-tracke … eport.html)

Is there a simple fix for this, or will I need to roll back FMod?

Thanks!

Good grief, FMod keeps changing their API, how are we supposed to keep up? And how are we supposed to support multiple developers who might have different versions of the library?

If you’d like to put in some selective code to make the correct calls based on FMod’s version, we’d be happy to accept patches. Otherwise, you might have to roll back your FMod version. :slight_smile:

David

Here’s the change I made. Where or to whom should I submit it?

--- panda/src/audiotraits/fmodAudioManager.cxx  2 Jul 2009 16:24:17 -0000       1.41
+++ panda/src/audiotraits/fmodAudioManager.cxx  15 Aug 2010 17:32:47 -0000
@@ -143,7 +143,11 @@ FmodAudioManager() {
       result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
       fmod_audio_errcheck("_system->set3DSettings()", result);
 
+#if (FMOD_VERSION >= 0x00043100) // FMod 4.31.00 changed this API
+      result = _system->setFileSystem(open_callback, close_callback, read_callback, seek_callback, 0, 0, -1);
+#else
       result = _system->setFileSystem(open_callback, close_callback, read_callback, seek_callback, -1);
+#endif
       fmod_audio_errcheck("_system->setFileSystem()", result);
     }
   }

You just did. Thanks! :slight_smile:

David