Revision: 7674
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7674&view=rev
Author:   natepak
Date:     2009-05-15 19:43:14 +0000 (Fri, 15 May 2009)

Log Message:
-----------
Started to disable the openalapi files

Modified Paths:
--------------
    code/gazebo/trunk/server/World.cc
    code/gazebo/trunk/server/World.hh
    code/gazebo/trunk/server/audio_video/OpenAL.cc
    code/gazebo/trunk/server/audio_video/OpenAL.hh

Modified: code/gazebo/trunk/server/World.cc
===================================================================
--- code/gazebo/trunk/server/World.cc   2009-05-15 17:20:26 UTC (rev 7673)
+++ code/gazebo/trunk/server/World.cc   2009-05-15 19:43:14 UTC (rev 7674)
@@ -41,7 +41,7 @@
 #include "gazebo.h"
 #include "World.hh"
 
-#include "OpenALAPI.hh"
+#include "OpenAL.hh"
 
 #include "Geom.hh"
 
@@ -111,11 +111,6 @@
   {
     gzthrow(e);
   }
-
-  if (this->openAL)
-    delete this->openAL;
-  this->openAL = NULL;
-
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -152,7 +147,9 @@
   // Load OpenAL audio 
   if (rootNode->GetChild("openal","audio"))
   {
-    this->openAL = new OpenALAPI();
+    //this->openAL = new OpenALAPI();
+    //this->openAL->Load(rootNode->GetChild("openal", "audio"));
+    this->openAL = OpenAL::Instance();
     this->openAL->Load(rootNode->GetChild("openal", "audio"));
   }
 

Modified: code/gazebo/trunk/server/World.hh
===================================================================
--- code/gazebo/trunk/server/World.hh   2009-05-15 17:20:26 UTC (rev 7673)
+++ code/gazebo/trunk/server/World.hh   2009-05-15 19:43:14 UTC (rev 7674)
@@ -49,7 +49,7 @@
   class PhysicsEngine;
   class XMLConfigNode;
   class GraphicsIfaceHandler;
-  class OpenALAPI;
+  class OpenAL;
    
 /// \brief The World
 /*
@@ -226,7 +226,7 @@
   /// Length of time to run before receiving a "go" command
   private: double simPauseTime;
 
-  private: OpenALAPI *openAL;
+  private: OpenAL *openAL;
 
   private: friend class DestroyerT<World>;
   private: friend class SingletonT<World>;

Modified: code/gazebo/trunk/server/audio_video/OpenAL.cc
===================================================================
--- code/gazebo/trunk/server/audio_video/OpenAL.cc      2009-05-15 17:20:26 UTC 
(rev 7673)
+++ code/gazebo/trunk/server/audio_video/OpenAL.cc      2009-05-15 19:43:14 UTC 
(rev 7674)
@@ -26,16 +26,15 @@
 
 #include "config.h"
 
-#ifdef HAVE_OPENAL
-
 #include <stdio.h>
 #include <unistd.h>
 #include <iostream>
 
-
+#ifdef HAVE_OPENAL
 #include <AL/al.h>
 #include <AL/alc.h>
 #include <AL/alext.h>
+#endif
 
 #include "XMLConfig.hh"
 #include "GazeboError.hh"
@@ -53,8 +52,10 @@
 ///// Constructor
 OpenAL::OpenAL()
 {
+#ifdef HAVE_OPENAL
   this->context = NULL;
   this->audioDevice = NULL;
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -78,6 +79,7 @@
 /// Destructor
 void OpenAL::Load(XMLConfigNode *node)
 {
+#ifdef HAVE_OPENAL
   std::string deviceName = "default";
 
   // Get the audio device name
@@ -116,6 +118,7 @@
 
   // TODO: put in function to set distance model
   //alDistanceModel(AL_EXPONENT_DISTANCE);
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -128,6 +131,8 @@
 /// Finalize
 void OpenAL::Fini()
 {
+#ifdef HAVE_OPENAL
+
   if (this->audioDevice)
   {
     alcCloseDevice(this->audioDevice);
@@ -139,12 +144,14 @@
     alcMakeContextCurrent(NULL);
     alcDestroyContext(this->context);
   }
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Create an openal source from XML config node
 OpenALSource *OpenAL::CreateSource( XMLConfigNode *node )
 {
+#ifdef HAVE_OPENAL
   // Make sure the xml node is valid
   if (!node)
   {
@@ -167,6 +174,9 @@
 
   // Return a pointer to the source
   return source;
+#else
+  return NULL;
+#endif
 }
 
 
@@ -174,6 +184,7 @@
 /// Set the listener position
 void OpenAL::SetListenerPos( const Vector3 pos )
 {
+#ifdef HAVE_OPENAL
   ALenum error;
 
   // Make sure we have an audio device
@@ -192,12 +203,14 @@
   {
     gzerr(0) << " Error: [" << error << "]\n";
   }
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Set the listener velocity
 void OpenAL::SetListenerVel( const Vector3 vel )
 {
+#ifdef HAVE_OPENAL
   ALenum error;
 
   // Make sure we have an audio device
@@ -214,7 +227,7 @@
   {
     gzerr(0) << " Error: [" <<  error << "]\n";
   }
-
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
@@ -222,6 +235,7 @@
 void OpenAL::SetListenerOrient( float cx, float cy, float cz,
                                float ux, float uy, float uz )
 {
+#ifdef HAVE_OPENAL
   ALenum error;
   ALfloat orient[]={cx, cy, cz, ux, uy, uz};
 
@@ -240,7 +254,7 @@
   {
     gzerr(0) << " Error: [" << error << "]\n";
   }
-
+#endif
 }
 
 
@@ -255,25 +269,30 @@
 // Constructor
 OpenALSource::OpenALSource()
 {
+#ifdef HAVE_OPENAL
   //Create 1 source
   alGenSources(1, &this->alSource);
 
   // Create 1 buffer
   alGenBuffers(1, &this->alBuffer);
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Destructor
 OpenALSource::~OpenALSource()
 {
+#ifdef HAVE_OPENAL
   alDeleteSources(1, &this->alSource);
   alDeleteBuffers(1, &this->alBuffer);
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Load from xml node
 void OpenALSource::Load(XMLConfigNode *node)
 {
+#ifdef HAVE_OPENAL
   // Set the pitch of the source
   this->SetPitch( node->GetDouble("pitch",1.0,0) );
 
@@ -285,12 +304,14 @@
 
   if (node->GetChild("mp3") != NULL)
     this->FillBufferFromFile(node->GetString("mp3","",1));
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Set the position of the source
 int OpenALSource::SetPos(const Vector3 &pos)
 {
+#ifdef HAVE_OPENAL
   ALfloat p[3] = {pos.x, pos.y, pos.z};
   ALenum error;
 
@@ -304,6 +325,7 @@
     gzerr(0) << "Error: [" << error << "]\n";
     return -1;
   }
+#endif
 
   return 0;
 }
@@ -312,6 +334,7 @@
 // Set the position of the source
 int OpenALSource::SetVel(const Vector3 &vel)
 {
+#ifdef HAVE_OPENAL
   ALenum error;
   ALfloat v[3] = {vel.x, vel.y, vel.z};
 
@@ -325,7 +348,7 @@
     gzerr(0) << "Error: [" << error << "]\n";
     return -1;
   }
-
+#endif
   return 0;
 }
 
@@ -333,6 +356,7 @@
 // Set the pitch of the source
 int OpenALSource::SetPitch(float p)
 {
+#ifdef HAVE_OPENAL
   ALenum error;
 
   // clear error state
@@ -345,7 +369,7 @@
     gzerr(0) << " Error: [" << error << "]\n";
     return -1;
   }
-
+#endif
   return 0;
 }
 
@@ -353,6 +377,7 @@
 // Set the pitch of the source
 int OpenALSource::SetGain(float g)
 {
+#ifdef HAVE_OPENAL
 
   ALenum error;
 
@@ -366,7 +391,7 @@
     gzerr(0) << "Error: [" << error << "]\n";
     return -1;
   }
-
+#endif
   return 0;
 }
 
@@ -374,6 +399,7 @@
 // Set whether the source loops the audio 
 int OpenALSource::SetLoop(bool state)
 {
+#ifdef HAVE_OPENAL
   ALenum error;
 
   // clear error state
@@ -387,6 +413,7 @@
     gzerr(0) << " Error: [" << error << "]\n";
     return -1;
   }
+#endif
 
   return 0;
 }
@@ -395,6 +422,7 @@
 // Play the source
 void OpenALSource::Play()
 {
+#ifdef HAVE_OPENAL
   int sourceState;
   alGetSourcei(this->alSource, AL_SOURCE_STATE, &sourceState);
 
@@ -403,47 +431,58 @@
   {
     alSourcePlay( this->alSource );
   }
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Pause the source
 void OpenALSource::Pause()
 {
+#ifdef HAVE_OPENAL
   int sourceState;
   alGetSourcei(this->alSource, AL_SOURCE_STATE, &sourceState);
 
   // Pause the source if it playing
   if (sourceState == AL_PLAYING)
     alSourcePause( this->alSource );
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 // Stop the source
 void OpenALSource::Stop()
 {
+#ifdef HAVE_OPENAL
   int sourceState;
   alGetSourcei(this->alSource, AL_SOURCE_STATE, &sourceState);
 
   // Stop the source if it is not already stopped
   if (sourceState != AL_STOPPED)
     alSourcePause( this->alSource);
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Rewind the sound to the beginning
 void OpenALSource::Rewind()
 {
+#ifdef HAVE_OPENAL
   alSourceRewind(this->alSource);
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Is the audio playing
 bool OpenALSource::IsPlaying()
 {
+#ifdef HAVE_OPENAL
   int sourceState;
   alGetSourcei(this->alSource, AL_SOURCE_STATE, &sourceState);
 
   return sourceState == AL_PLAYING;
+#else
+  return false;
+#endif
 }
 
 
@@ -452,6 +491,7 @@
 void OpenALSource::FillBufferFromPCM(uint8_t *pcmData, unsigned int dataCount, 
                                      int sampleRate )
 {
+#ifdef HAVE_OPENAL
   // First detach the buffer
   alSourcei(this->alSource, AL_BUFFER, 0 );
 
@@ -468,12 +508,14 @@
   {
     gzthrow("Unable to copy data into openAL buffer\n");
   }
+#endif
 }
 
 
////////////////////////////////////////////////////////////////////////////////
 /// Fill the OpenAL audio buffer with data from a sound file
 void OpenALSource::FillBufferFromFile( const std::string &audioFile )
 {
+#ifdef HAVE_OPENAL
 
   std::string fullPathAudioFile = audioFile;
 
@@ -522,6 +564,6 @@
 
   if (dataBuffer)
     delete [] dataBuffer; 
-}
 
 #endif
+}

Modified: code/gazebo/trunk/server/audio_video/OpenAL.hh
===================================================================
--- code/gazebo/trunk/server/audio_video/OpenAL.hh      2009-05-15 17:20:26 UTC 
(rev 7673)
+++ code/gazebo/trunk/server/audio_video/OpenAL.hh      2009-05-15 19:43:14 UTC 
(rev 7674)
@@ -34,9 +34,9 @@
 #include "Vector3.hh"
 
 #ifdef HAVE_OPENAL
-
 struct ALCcontext_struct;
 struct ALCdevice_struct;
+#endif
 
 namespace gazebo
 {
@@ -80,8 +80,10 @@
     public: void SetListenerOrient(float cx, float cy, float cz,
                                         float ux, float uy, float uz);
 
+#ifdef HAVE_OPENAL
     private: ALCcontext_struct *context;
     private: ALCdevice_struct *audioDevice;
+#endif
   
     private: static OpenAL *myself;
   };
@@ -144,4 +146,3 @@
 }
 
 #endif
-#endif


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables 
unlimited royalty-free distribution of the report engine 
for externally facing server and web deployment. 
http://p.sf.net/sfu/businessobjects
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to