[Orxonox-commit 1717] r6435 - code/branches/sound4/src/orxonox/sound

rgrieder at orxonox.net rgrieder at orxonox.net
Fri Jan 1 18:43:54 CET 2010


Author: rgrieder
Date: 2010-01-01 18:43:54 +0100 (Fri, 01 Jan 2010)
New Revision: 6435

Added:
   code/branches/sound4/src/orxonox/sound/SoundPrereqs.h
Modified:
   code/branches/sound4/src/orxonox/sound/AmbientSound.h
   code/branches/sound4/src/orxonox/sound/BaseSound.cc
   code/branches/sound4/src/orxonox/sound/BaseSound.h
   code/branches/sound4/src/orxonox/sound/SoundBuffer.h
   code/branches/sound4/src/orxonox/sound/SoundManager.cc
   code/branches/sound4/src/orxonox/sound/SoundManager.h
   code/branches/sound4/src/orxonox/sound/SoundStreamer.cc
   code/branches/sound4/src/orxonox/sound/SoundStreamer.h
   code/branches/sound4/src/orxonox/sound/WorldSound.h
Log:
Moved getALErrorString function from SoundManager.h to newly created SoundPrereqs.h file.
Also moved forward declarations to that file (from OrxonoxPrereqs.h).

Modified: code/branches/sound4/src/orxonox/sound/AmbientSound.h
===================================================================
--- code/branches/sound4/src/orxonox/sound/AmbientSound.h	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/AmbientSound.h	2010-01-01 17:43:54 UTC (rev 6435)
@@ -30,7 +30,7 @@
 #ifndef _AmbientSound_H__
 #define _AmbientSound_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include "core/BaseObject.h"
 #include "network/synchronisable/Synchronisable.h"

Modified: code/branches/sound4/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/sound4/src/orxonox/sound/BaseSound.cc	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/BaseSound.cc	2010-01-01 17:43:54 UTC (rev 6435)
@@ -90,7 +90,7 @@
 
             alSourcePlay(this->audioSource_);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error playing sound: " << SoundManager::getALErrorString(error) << std::endl;
+                COUT(2) << "Sound: Error playing sound: " << getALErrorString(error) << std::endl;
         }
     }
 
@@ -140,12 +140,11 @@
         alSource3f(this->audioSource_, AL_VELOCITY,  0, 0, 0);
         alSource3f(this->audioSource_, AL_DIRECTION, 0, 0, 0);
         if (ALint error = alGetError())
-            COUT(2) << "Sound Warning: Setting source parameters to 0 failed: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+            COUT(2) << "Sound Warning: Setting source parameters to 0 failed: " << getALErrorString(error) << std::endl;
         assert(this->soundBuffer_ != NULL);
         alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
         if (ALuint error = alGetError())
-            COUT(1) << "Sound Error: Could not set buffer \"" << this->source_ << "\": " << SoundManager::getALErrorString(error) << std::endl;
+            COUT(1) << "Sound Error: Could not set buffer \"" << this->source_ << "\": " << getALErrorString(error) << std::endl;
     }
 
     void BaseSound::setVolume(float vol)
@@ -163,8 +162,7 @@
             float volume = this->volume_ * this->getRealVolume();
             alSourcef(this->audioSource_, AL_GAIN, volume);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error setting volume to " << volume
-                        << ": " << SoundManager::getALErrorString(error) << std::endl;
+                COUT(2) << "Sound: Error setting volume to " << volume << ": " << getALErrorString(error) << std::endl;
         }
     }
 
@@ -188,7 +186,7 @@
         {
             alSourcef(this->audioSource_, AL_PITCH, pitch);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error setting pitch: " << SoundManager::getALErrorString(error) << std::endl;
+                COUT(2) << "Sound: Error setting pitch: " << getALErrorString(error) << std::endl;
         }
     }
 
@@ -233,7 +231,7 @@
             alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer());
             if (ALuint error = alGetError())
             {
-                COUT(1) << "Sound Error: Could not set buffer \"" << source << "\": " << SoundManager::getALErrorString(error) << std::endl;
+                COUT(1) << "Sound Error: Could not set buffer \"" << source << "\": " << getALErrorString(error) << std::endl;
                 return;
             }
 
@@ -241,7 +239,7 @@
             assert(this->isPlaying() || this->isPaused());
             alSourcePlay(this->audioSource_);
             if (int error = alGetError())
-                COUT(2) << "Sound: Error playing sound: " << SoundManager::getALErrorString(error) << std::endl;
+                COUT(2) << "Sound: Error playing sound: " << getALErrorString(error) << std::endl;
             if (this->isPaused())
                 alSourcePause(this->audioSource_);
         }

Modified: code/branches/sound4/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/sound4/src/orxonox/sound/BaseSound.h	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/BaseSound.h	2010-01-01 17:43:54 UTC (rev 6435)
@@ -29,7 +29,7 @@
 #ifndef _BaseSound_H__
 #define _BaseSound_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <string>
 #include <boost/shared_ptr.hpp>

Modified: code/branches/sound4/src/orxonox/sound/SoundBuffer.h
===================================================================
--- code/branches/sound4/src/orxonox/sound/SoundBuffer.h	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/SoundBuffer.h	2010-01-01 17:43:54 UTC (rev 6435)
@@ -29,7 +29,7 @@
 #ifndef _SoundBuffer_H__
 #define _SoundBuffer_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <list>
 #include <boost/shared_ptr.hpp>

Modified: code/branches/sound4/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/sound4/src/orxonox/sound/SoundManager.cc	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/SoundManager.cc	2010-01-01 17:43:54 UTC (rev 6435)
@@ -51,7 +51,8 @@
 {
     ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
 
-    std::string SoundManager::getALErrorString(ALenum code)
+    // From SoundPrereqs.h
+    std::string getALErrorString(ALenum code)
     {
         switch (code)
         {

Modified: code/branches/sound4/src/orxonox/sound/SoundManager.h
===================================================================
--- code/branches/sound4/src/orxonox/sound/SoundManager.h	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/SoundManager.h	2010-01-01 17:43:54 UTC (rev 6435)
@@ -30,7 +30,7 @@
 #ifndef _SoundManager_H__
 #define _SoundManager_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <list>
 #include <map>
@@ -98,8 +98,6 @@
         ALuint getSoundSource(BaseSound* object);
         void releaseSoundSource(ALuint source);
 
-        static std::string getALErrorString(ALenum error);
-
     private:
         void processCrossFading(float dt);
         void fadeIn(const SmartPtr<AmbientSound>& sound);

Copied: code/branches/sound4/src/orxonox/sound/SoundPrereqs.h (from rev 6434, code/branches/sound4/src/orxonox/OrxonoxPrereqs.h)
===================================================================
--- code/branches/sound4/src/orxonox/sound/SoundPrereqs.h	                        (rev 0)
+++ code/branches/sound4/src/orxonox/sound/SoundPrereqs.h	2010-01-01 17:43:54 UTC (rev 6435)
@@ -0,0 +1,70 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Reto Grieder
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+ at file
+ at brief
+    Enums, constants, functions and forward declarations for the sound files.
+*/
+
+#ifndef _SoundPrereqs_H__
+#define _SoundPrereqs_H__
+
+#include "OrxonoxPrereqs.h"
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    class AmbientSound;
+    class BaseSound;
+    class SoundBuffer;
+    class SoundManager;
+    class SoundStreamer;
+    class WorldSound;
+}
+
+typedef struct ALCcontext_struct ALCcontext;
+typedef struct ALCdevice_struct ALCdevice;
+typedef unsigned int ALuint;
+typedef int ALint;
+typedef int ALenum;
+
+//-----------------------------------------------------------------------
+// Helper functions
+//-----------------------------------------------------------------------
+
+namespace orxonox
+{
+    //! Returns an error string for an AL error code
+    _OrxonoxExport std::string getALErrorString(ALenum error);
+}
+
+#endif /* _SoundPrereqs_H__ */

Modified: code/branches/sound4/src/orxonox/sound/SoundStreamer.cc
===================================================================
--- code/branches/sound4/src/orxonox/sound/SoundStreamer.cc	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/SoundStreamer.cc	2010-01-01 17:43:54 UTC (rev 6435)
@@ -90,16 +90,14 @@
             int processed;
             alGetSourcei(audioSource, AL_BUFFERS_PROCESSED, &processed);
             if (ALint error = alGetError())
-            COUT(2) << "Sound Warning: Couldn't get number of processed buffers: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+            COUT(2) << "Sound Warning: Couldn't get number of processed buffers: " << getALErrorString(error) << std::endl;
 
             if(processed > 0)
             {
                 ALuint* buffers = new ALuint[processed];
                 alSourceUnqueueBuffers(audioSource, processed, buffers);
                 if (ALint error = alGetError())
-                    COUT(2) << "Sound Warning: Couldn't unqueue buffers: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+                    COUT(2) << "Sound Warning: Couldn't unqueue buffers: " << getALErrorString(error) << std::endl;
 
                 for(int i = 0; i < processed; i++)
                 {
@@ -120,8 +118,7 @@
 
                 alSourceQueueBuffers(audioSource, processed, buffers);
                 if (ALint error = alGetError())
-                    COUT(2) << "Sound Warning: Couldn't queue buffers: "
-                    << SoundManager::getALErrorString(error) << std::endl;
+                    COUT(2) << "Sound Warning: Couldn't queue buffers: " << getALErrorString(error) << std::endl;
             }
         }
     }

Modified: code/branches/sound4/src/orxonox/sound/SoundStreamer.h
===================================================================
--- code/branches/sound4/src/orxonox/sound/SoundStreamer.h	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/SoundStreamer.h	2010-01-01 17:43:54 UTC (rev 6435)
@@ -28,7 +28,7 @@
 #ifndef _SoundStreamer_H__
 #define _SoundStreamer_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <string>
 #include <OgreDataStream.h>

Modified: code/branches/sound4/src/orxonox/sound/WorldSound.h
===================================================================
--- code/branches/sound4/src/orxonox/sound/WorldSound.h	2010-01-01 17:28:42 UTC (rev 6434)
+++ code/branches/sound4/src/orxonox/sound/WorldSound.h	2010-01-01 17:43:54 UTC (rev 6435)
@@ -29,7 +29,7 @@
 #ifndef _WorldSound_H__
 #define _WorldSound_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include "tools/interfaces/Tickable.h"
 #include "sound/BaseSound.h"




More information about the Orxonox-commit mailing list