Revision: 18834
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=18834
Author:   campbellbarton
Date:     2009-02-06 17:38:53 +0100 (Fri, 06 Feb 2009)

Log Message:
-----------
[#18257] Workaround for bug in freealut 1.1.0
by J?\195?\182rg M?\195?\188ller (nexyon) 

Since this area is not maintained, I can only say it works on my system 
(linux/32bit)
And nexyon assured me he checked over this patch well.
Blender using the deprecated function is not great, but nexyon's bugfix would 
not be available until the next version of freealut so better to work around it 
by using the new function.

Please test game sounds play back on win32 and Mac, in cases that it worked in 
the first place.

Modified Paths:
--------------
    trunk/blender/intern/SoundSystem/openal/SND_OpenALDevice.cpp

Modified: trunk/blender/intern/SoundSystem/openal/SND_OpenALDevice.cpp
===================================================================
--- trunk/blender/intern/SoundSystem/openal/SND_OpenALDevice.cpp        
2009-02-06 16:34:05 UTC (rev 18833)
+++ trunk/blender/intern/SoundSystem/openal/SND_OpenALDevice.cpp        
2009-02-06 16:38:53 UTC (rev 18834)
@@ -235,7 +235,8 @@
 
                        if (m_context) {
 #ifdef AL_VERSION_1_1
-               alcMakeContextCurrent((ALCcontext*)m_context);
+                       alcMakeContextCurrent((ALCcontext*)m_context);
+                       alutInitWithoutContext(NULL, NULL); /* in this case we 
dont want alut to initialize the context, see above */
 #else
                        alcMakeContextCurrent(m_context);
 #endif
@@ -380,7 +381,10 @@
 #else
        if (m_device)
                alcCloseDevice((ALCdevice*) m_device);
+#ifdef AL_VERSION_1_1
+       alutExit();
 #endif
+#endif
 }
 
 
@@ -437,7 +441,9 @@
                                        alutLoadWAVMemory((char*)memlocation, 
&sampleformat, &data, &numberofsamples, &samplerate);                           
  //      openal_2.12
 #else
 #ifdef AL_VERSION_1_1                                  
-                                       alutLoadWAVMemory((ALbyte*)memlocation, 
&sampleformat, &data, &numberofsamples, &samplerate, &loop);//  openal_2.14+
+                                       float frequency = 0.0f;
+                                       data = 
alutLoadMemoryFromFileImage(memlocation, size, &sampleformat, &numberofsamples, 
&frequency);
+                                       samplerate = (int)frequency;
 #else
                                         alutLoadWAVMemory((signed 
char*)memlocation, &sampleformat, &data, &numberofsamples, &samplerate, 
&loop);//  openal_2.14+
                                         
@@ -480,7 +486,11 @@
                                }
                                
                                /* and free the original stuff (copy was made 
in openal) */
+#if defined(OUDE_OPENAL) || defined (__APPLE__) || !defined(AL_VERSION_1_1)
                                alutUnloadWAV(sampleformat, data, 
numberofsamples, samplerate);
+#else
+                               free(data);
+#endif
                        }
                }
                else


_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to