Index: /code/branches/sound5/src/orxonox/sound/AmbientSound.cc
===================================================================
--- /code/branches/sound5/src/orxonox/sound/AmbientSound.cc	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/AmbientSound.cc	(revision 6506)
@@ -35,4 +35,5 @@
 #include "core/XMLPort.h"
 #include "SoundManager.h"
+#include "SoundStreamer.h"
 
 namespace orxonox
@@ -120,5 +121,5 @@
             shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);
             if (fileInfo != NULL)
-                this->setSource(path);
+                this->setStreamSource(path);
             else
                 COUT(3) << "Sound: " << this->ambientSource_ << ": Not a valid name! Ambient sound will not change." << std::endl;
@@ -141,3 +142,41 @@
             this->stop();
     }
+
+    // hacky solution for file streaming
+    void AmbientSound::setStreamSource(const std::string& source)
+    {
+        this->audioSource_ = SoundManager::getInstance().getSoundSource(this);
+        if (this->source_ == source)
+        {
+            return;
+        }
+
+        this->source_ = source;
+        // Don't load ""
+        if (source_.empty())
+            return;
+
+        if (this->soundstreamthread_.get_id() != boost::thread::id())
+        {
+            this->soundstreamthread_.interrupt(); // unhandled interruptions lead to thread terminating ;-)
+        }
+        // Get resource info
+        shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(source);
+        if (fileInfo == NULL)
+        {
+            COUT(2) << "Sound: Warning: Sound file '" << source << "' not found" << std::endl;
+            return;
+        }
+        // Open data stream
+        DataStreamPtr dataStream = Resource::open(fileInfo);
+
+        this->soundstreamthread_ = boost::thread(SoundStreamer(), this->audioSource_, dataStream);
+        this->initialiseSource();
+    }
+
+    void AmbientSound::doStop()
+    {
+        SUPER(AmbientSound, doStop);
+        this->soundstreamthread_.interrupt();
+    }
 }
Index: /code/branches/sound5/src/orxonox/sound/AmbientSound.h
===================================================================
--- /code/branches/sound5/src/orxonox/sound/AmbientSound.h	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/AmbientSound.h	(revision 6506)
@@ -31,5 +31,7 @@
 #define _AmbientSound_H__
 
-#include "OrxonoxPrereqs.h"
+#include <boost/thread.hpp>
+
+#include "sound/SoundPrereqs.h"
 
 #include "core/BaseObject.h"
@@ -71,4 +73,7 @@
         ~AmbientSound() { }
 
+        void doPlay();
+        void doStop();
+
     private:
         void preDestroy();
@@ -83,4 +88,7 @@
         std::string ambientSource_; //!< Analogous to source_, but mood independent
         bool        bPlayOnLoad_;   //!< Play the sound immediately when loaded
+
+        boost::thread soundstreamthread_; // hacky solution for streaming
+        void setStreamSource(const std::string& source);
     };
 }
Index: /code/branches/sound5/src/orxonox/sound/BaseSound.cc
===================================================================
--- /code/branches/sound5/src/orxonox/sound/BaseSound.cc	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/BaseSound.cc	(revision 6506)
@@ -91,5 +91,5 @@
             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;
         }
     }
@@ -141,10 +141,9 @@
         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;
     }
 
@@ -153,5 +152,5 @@
         this->volume_ = clamp(vol, 0.0f, 1.0f);
         if (this->volume_ != vol)
-            COUT(2) << "Sound warning: volume out of range, clamping value." << std::endl;
+            COUT(2) << "Sound: Warning: volume out of range, clamping value." << std::endl;
         this->updateVolume();
     }
@@ -164,6 +163,5 @@
             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;
         }
     }
@@ -180,5 +178,5 @@
         if (pitch > 2 || pitch < 0.5f)
         {
-            COUT(2) << "Sound warning: pitch out of range, cropping value." << std::endl;
+            COUT(2) << "Sound: Warning: pitch out of range, cropping value." << std::endl;
             pitch = pitch > 2.0f ? 2.0f : pitch;
             pitch = pitch < 0.5f ? 0.5f : pitch;
@@ -189,5 +187,5 @@
             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;
         }
     }
@@ -234,5 +232,5 @@
             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;
             }
@@ -242,5 +240,5 @@
             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_);
Index: /code/branches/sound5/src/orxonox/sound/BaseSound.h
===================================================================
--- /code/branches/sound5/src/orxonox/sound/BaseSound.h	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/BaseSound.h	(revision 6506)
@@ -30,5 +30,5 @@
 #define _BaseSound_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <string>
Index: /code/branches/sound5/src/orxonox/sound/SoundBuffer.h
===================================================================
--- /code/branches/sound5/src/orxonox/sound/SoundBuffer.h	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/SoundBuffer.h	(revision 6506)
@@ -30,5 +30,5 @@
 #define _SoundBuffer_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <list>
Index: /code/branches/sound5/src/orxonox/sound/SoundManager.cc
===================================================================
--- /code/branches/sound5/src/orxonox/sound/SoundManager.cc	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/SoundManager.cc	(revision 6506)
@@ -43,5 +43,5 @@
 #include "core/ScopedSingletonManager.h"
 #include "core/Resource.h"
-#include "SoundBuffer.h"
+#include "SoundBuffer.h":
 #include "BaseSound.h"
 #include "AmbientSound.h"
@@ -52,5 +52,6 @@
     ManageScopedSingleton(SoundManager, ScopeID::Graphics, true);
 
-    std::string SoundManager::getALErrorString(ALenum code)
+    // From SoundPrereqs.h
+    std::string getALErrorString(ALenum code)
     {
         switch (code)
@@ -78,5 +79,5 @@
 
         if (!alutInitWithoutContext(NULL, NULL))
-            ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
+            ThrowException(InitialisationFailed, "Sound: Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError()));
         Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit);
 
@@ -110,5 +111,5 @@
             COUT(1) << "Sound: Just getting the DLL with the dependencies is not enough for Windows (esp. Windows 7)!" << std::endl;
 #endif
-            ThrowException(InitialisationFailed, "Sound Error: Could not open sound device.");
+            ThrowException(InitialisationFailed, "Sound: Error: Could not open sound device.");
         }
         Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_);
@@ -117,8 +118,8 @@
         this->context_ = alcCreateContext(this->device_, NULL);
         if (this->context_ == NULL)
-            ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context");
+            ThrowException(InitialisationFailed, "Sound: Error: Could not create ALC context");
         Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_);
         if (!alcMakeContextCurrent(this->context_))
-            ThrowException(InitialisationFailed, "Sound Error: Could not use ALC context");
+            ThrowException(InitialisationFailed, "Sound: Error: Could not use ALC context");
 
         GameMode::setPlaysSound(true);
@@ -133,5 +134,5 @@
             COUT(4) << "Sound: --- Supported MIME Types: " << types << std::endl;
         else
-            COUT(2) << "Sound Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;
+            COUT(2) << "Sound: Warning: MIME Type retrieval failed: " << alutGetErrorString(alutGetError()) << std::endl;
 
         this->mute_[SoundType::All]     = 1.0f;
@@ -147,5 +148,5 @@
             this->availableSoundSources_.push_back(source);
         else
-            ThrowException(InitialisationFailed, "Sound Error: Could not create even a single source");
+            ThrowException(InitialisationFailed, "Sound: Error: Could not create even a single source");
         // Create a few initial sources
         this->createSoundSources(this->minSources_ - 1);
@@ -168,5 +169,5 @@
         // If there are still used buffers around, well, that's just very bad...
         if (this->soundBuffers_.size() != this->effectsPool_.size())
-            COUT(1) << "Sound Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
+            COUT(1) << "Sound: Error: Some sound buffers are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
         // Empty buffer pool and buffer list
         this->effectsPool_.clear();
@@ -175,5 +176,5 @@
         // There should not be any sources in use anymore
         if (!this->usedSoundSources_.empty())
-            COUT(1) << "Sound Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
+            COUT(1) << "Sound: Error: Some sound sources are still in use but OpenAL is about to shut down. Fix this!" << std::endl;
         while (!this->availableSoundSources_.empty())
         {
@@ -186,21 +187,21 @@
         // Relieve context to destroy it
         if (!alcMakeContextCurrent(NULL))
-            COUT(1) << "Sound Error: Could not unset ALC context" << std::endl;
+            COUT(1) << "Sound: Error: Could not unset ALC context" << std::endl;
         alcDestroyContext(this->context_);
         if (ALCenum error = alcGetError(this->device_))
         {
             if (error == AL_INVALID_OPERATION)
-                COUT(1) << "Sound Error: Could not destroy ALC context because it is the current one" << std::endl;
+                COUT(1) << "Sound: Error: Could not destroy ALC context because it is the current one" << std::endl;
             else
-                COUT(1) << "Sound Error: Could not destroy ALC context because it is invalid" << std::endl;
+                COUT(1) << "Sound: Error: Could not destroy ALC context because it is invalid" << std::endl;
         }
 #ifdef AL_VERSION_1_1
         if (!alcCloseDevice(this->device_))
-            COUT(1) << "Sound Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;
+            COUT(1) << "Sound: Error: Could not destroy ALC device. This might be because there are still buffers in use!" << std::endl;
 #else
         alcCloseDevice(this->device_);
 #endif
         if (!alutExit())
-            COUT(1) << "Sound Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;
+            COUT(1) << "Sound: Error: Closing ALUT failed: " << alutGetErrorString(alutGetError()) << std::endl;
     }
 
@@ -248,5 +249,5 @@
         if (crossFadeStep_ <= 0.0 || crossFadeStep_ >= 1.0 )
         {
-            COUT(2) << "Sound warning: fade step out of range, ignoring change." << std::endl;
+            COUT(2) << "Sound: Warning: fade step out of range, ignoring change." << std::endl;
             ResetConfigValue(crossFadeStep_);
         }
@@ -257,5 +258,5 @@
         float clampedVolume = clamp(this->volume_[type], 0.0f, 1.0f);
         if (clampedVolume != this->volume_[type])
-            COUT(2) << "Sound warning: Volume setting (" << type << ") out of range, clamping." << std::endl;
+            COUT(2) << "Sound: Warning: Volume setting (" << type << ") out of range, clamping." << std::endl;
         this->updateVolume(type);
     }
@@ -349,5 +350,5 @@
                 if (it->first == newAmbient)
                 {
-                    COUT(2) << "Sound warning: Will not play an AmbientSound twice." << std::endl;
+                    COUT(2) << "Sound: Warning: Will not play an AmbientSound twice." << std::endl;
                     return;
                 }
@@ -617,5 +618,5 @@
             alDeleteSources(1, &this->availableSoundSources_.back());
             if (alGetError())
-                COUT(1) << "Sound Error: Failed to delete a source --> lost forever" << std::endl;
+                COUT(1) << "Sound: Error: Failed to delete a source --> lost forever" << std::endl;
             this->availableSoundSources_.pop_back();
         }
Index: /code/branches/sound5/src/orxonox/sound/SoundManager.h
===================================================================
--- /code/branches/sound5/src/orxonox/sound/SoundManager.h	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/SoundManager.h	(revision 6506)
@@ -31,5 +31,5 @@
 #define _SoundManager_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <list>
@@ -99,6 +99,4 @@
         void releaseSoundSource(ALuint source);
 
-        static std::string getALErrorString(ALenum error);
-
     private:
         void processCrossFading(float dt);
Index: /code/branches/sound5/src/orxonox/sound/SoundPrereqs.h
===================================================================
--- /code/branches/sound5/src/orxonox/sound/SoundPrereqs.h	(revision 6506)
+++ /code/branches/sound5/src/orxonox/sound/SoundPrereqs.h	(revision 6506)
@@ -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:
+ *      ...
+ *
+ */
+
+/**
+@file
+@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__ */
Index: /code/branches/sound5/src/orxonox/sound/SoundStreamer.cc
===================================================================
--- /code/branches/sound5/src/orxonox/sound/SoundStreamer.cc	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/SoundStreamer.cc	(revision 6506)
@@ -30,4 +30,5 @@
 #include <vorbis/vorbisfile.h>
 #include "SoundManager.h"
+#include "util/Sleep.h"
 
 namespace orxonox
@@ -91,6 +92,5 @@
             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)
@@ -99,6 +99,5 @@
                 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++)
@@ -121,7 +120,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;
             }
+            msleep(250); // perhaps another value here is better
         }
     }
Index: /code/branches/sound5/src/orxonox/sound/SoundStreamer.h
===================================================================
--- /code/branches/sound5/src/orxonox/sound/SoundStreamer.h	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/SoundStreamer.h	(revision 6506)
@@ -29,5 +29,5 @@
 #define _SoundStreamer_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include <string>
Index: /code/branches/sound5/src/orxonox/sound/WorldSound.h
===================================================================
--- /code/branches/sound5/src/orxonox/sound/WorldSound.h	(revision 6505)
+++ /code/branches/sound5/src/orxonox/sound/WorldSound.h	(revision 6506)
@@ -30,5 +30,5 @@
 #define _WorldSound_H__
 
-#include "OrxonoxPrereqs.h"
+#include "sound/SoundPrereqs.h"
 
 #include "tools/interfaces/Tickable.h"
