Sophie

Sophie

distrib > Mageia > 5 > i586 > by-pkgid > ff379b9450ea434d1de957e06db09f32 > files > 3

cultivation-9-13.mga5.src.rpm

Author: Barry deFreese <bdefreese@debian.org>
Description: Patch system to utilize portaudio v19
Bug-Debian: http://bugs.debian.org/594015
Last-Update: 2013-06-01
--- a/game2/gameSource/sound/SoundPlayer.h
+++ b/game2/gameSource/sound/SoundPlayer.h
@@ -239,7 +239,7 @@
         char mFadingIn;
         int mNumFadeFramesRemaining;
         
-        PortAudioStream *mAudioStream;
+        PaStream *mAudioStream;
 
         // realtime sounds that should be mixed into the next to-speaker call
         SimpleVector<PlayableSound *> *mRealtimeSounds;
--- a/game2/gameSource/sound/SoundPlayer.cpp
+++ b/game2/gameSource/sound/SoundPlayer.cpp
@@ -52,9 +52,11 @@
 
 
 // callback passed into portaudio
-static int portaudioCallback( void *inputBuffer, void *outputBuffer,
+int portaudioCallback( const void *inputBuffer, void *outputBuffer,
                               unsigned long framesPerBuffer,
-                              PaTimestamp outTime, void *userData ) {
+                              const PaStreamCallbackTimeInfo *outTime,
+                              PaStreamCallbackFlags statusFlags,
+                              void *userData ) {
 
 
     SoundPlayer *player = (SoundPlayer *)userData;
@@ -157,21 +159,13 @@
 
     if( error == paNoError ) {
     
-        error = Pa_OpenStream(
+        error = Pa_OpenDefaultStream(
             &mAudioStream,
-            paNoDevice,// default input device 
             0,              // no input 
-            paFloat32,  // 32 bit floating point input 
-            NULL,
-            Pa_GetDefaultOutputDeviceID(),
             2,          // stereo output 
             paFloat32,      // 32 bit floating point output 
-            NULL,
             mSampleRate,
             1024,   // frames per buffer
-            0,    // number of buffers, if zero then use default minimum 
-            paClipOff, // we won't output out of range samples so
-                       // don't bother clipping them 
             portaudioCallback,
             (void *)this );  // pass self-pointer to callback function
         
--- a/game2/gameSource/sound/MusicPlayer.cpp
+++ b/game2/gameSource/sound/MusicPlayer.cpp
@@ -112,13 +112,14 @@
 
     // get parts and positions of gardeners
     int numParts = 0;
-    Vector3D **positions =
-        globalWorld->getAllGardenerPositions( &numParts );
-    MusicPart **musicParts =
-        globalWorld->getAllGardenerMusicParts( &numParts );
-    double *volumeModifiers =
-        globalWorld->getAllGardenerMusicVolumeModifiers( &numParts );
-
+    Vector3D **positions = NULL;
+    MusicPart **musicParts = NULL;
+    double *volumeModifiers = NULL;
+    if ( globalWorld ){
+        positions = globalWorld->getAllGardenerPositions( &numParts );
+        musicParts = globalWorld->getAllGardenerMusicParts( &numParts );
+        volumeModifiers = globalWorld->getAllGardenerMusicVolumeModifiers( &numParts );
+    }
     
     // get center position from current player position
     Vector3D *centerPosition = new Vector3D( &globalPlayerCurrentPosition );