Browse Source

compile against fmod 4.22.05

David Rose 17 years ago
parent
commit
8403e175f5

+ 4 - 4
panda/src/audiotraits/fmodAudioManager.cxx

@@ -345,7 +345,7 @@ update_dsp_chain(FMOD::DSP *head, FilterProperties *config) {
       break;
     }
     FMOD::DSP *prev;
-    res2 = head->getInput(0, &prev);
+    res2 = head->getInput(0, &prev, NULL);
     void *userdata;
     res3 = prev->getUserData(&userdata);
     if (userdata != USER_DSP_MAGIC) {
@@ -363,10 +363,10 @@ update_dsp_chain(FMOD::DSP *head, FilterProperties *config) {
     FMOD::DSP *dsp = make_dsp(conf[i]);
     if (dsp == 0) break;
     FMOD::DSP *prev;
-    res1 = head->getInput(0, &prev);
+    res1 = head->getInput(0, &prev, NULL);
     res2 = head->disconnectFrom(prev);
-    res3 = head->addInput(dsp);
-    res4 = dsp->addInput(prev);
+    res3 = head->addInput(dsp, NULL);
+    res4 = dsp->addInput(prev, NULL);
     res5 = dsp->setActive(true);
     if ((res1!=FMOD_OK)||(res2!=FMOD_OK)||(res3!=FMOD_OK)||(res4!=FMOD_OK)||(res5!=FMOD_OK)) {
       audio_error("Could not update DSP chain.");

+ 13 - 10
panda/src/audiotraits/fmodAudioSound.cxx

@@ -163,11 +163,16 @@ play() {
 ////////////////////////////////////////////////////////////////////
 FMOD_RESULT F_CALLBACK sound_end_callback(FMOD_CHANNEL *  channel, 
 					  FMOD_CHANNEL_CALLBACKTYPE  type, 
-					  int  command, 
-					  unsigned int  commanddata1, 
-					  unsigned int  commanddata2) {
-  FmodAudioSound *fsound = (FmodAudioSound*)command;
-  fsound->_self_ref = fsound;
+					  void *commanddata1, 
+					  void *commanddata2) {
+  if (type == FMOD_CHANNEL_CALLBACKTYPE_END) {
+    FMOD::Channel *fc = (FMOD::Channel *)channel;
+    void *userdata = NULL;
+    FMOD_RESULT result = fc->getUserData(&userdata);
+    fmod_audio_errcheck("channel->getUserData()", result);
+    FmodAudioSound *fsound = (FmodAudioSound*)userdata;
+    fsound->_self_ref = fsound;
+  }
   return FMOD_OK;
 }
 
@@ -311,13 +316,11 @@ set_time(float start_time) {
   }
   
   if (_channel == 0) {
-    // This is because setCallback expects an integer
-    // but 64-bits pointers wont fit in a 32-bits int.
-    nassertv_always((intptr_t)this < UINT_MAX);
-    
     result = _manager->_system->playSound(FMOD_CHANNEL_FREE, _sound, true, &_channel);
     fmod_audio_errcheck("_system->playSound()", result);
-    result = _channel->setCallback(FMOD_CHANNEL_CALLBACKTYPE_END, sound_end_callback, (intptr_t)this);
+    result = _channel->setUserData(this);
+    fmod_audio_errcheck("_channel->setUserData()", result);
+    result = _channel->setCallback(sound_end_callback);
     fmod_audio_errcheck("_channel->setCallback()", result);
     result = _channel->setPosition( startTime , FMOD_TIMEUNIT_MS );
     fmod_audio_errcheck("_channel->setPosition()", result);

+ 2 - 3
panda/src/audiotraits/fmodAudioSound.h

@@ -204,9 +204,8 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound {
 
   friend FMOD_RESULT F_CALLBACK sound_end_callback(FMOD_CHANNEL *  channel, 
                                                    FMOD_CHANNEL_CALLBACKTYPE  type, 
-                                                   int  command, 
-                                                   unsigned int  commanddata1, 
-                                                   unsigned int  commanddata2);
+                                                   void *commanddata1, 
+                                                   void *commanddata2);
 
   ////////////////////////////////////////////////////////////
   //These are needed for Panda's Pointer System. DO NOT ERASE!