[Orxonox-commit 1788] r6506 - in code/branches/sound5: . src/orxonox/sound
scheusso at orxonox.net
scheusso at orxonox.net
Thu Mar 11 15:16:12 CET 2010
Author: scheusso
Date: 2010-03-11 15:16:12 +0100 (Thu, 11 Mar 2010)
New Revision: 6506
Added:
code/branches/sound5/src/orxonox/sound/SoundPrereqs.h
Modified:
code/branches/sound5/
code/branches/sound5/src/orxonox/sound/AmbientSound.cc
code/branches/sound5/src/orxonox/sound/AmbientSound.h
code/branches/sound5/src/orxonox/sound/BaseSound.cc
code/branches/sound5/src/orxonox/sound/BaseSound.h
code/branches/sound5/src/orxonox/sound/SoundBuffer.h
code/branches/sound5/src/orxonox/sound/SoundManager.cc
code/branches/sound5/src/orxonox/sound/SoundManager.h
code/branches/sound5/src/orxonox/sound/SoundStreamer.cc
code/branches/sound5/src/orxonox/sound/SoundStreamer.h
code/branches/sound5/src/orxonox/sound/WorldSound.h
Log:
merged sound4 into sound5
Property changes on: code/branches/sound5
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/console:5941-6104
/code/branches/core5:5768-5928,6009
/code/branches/ingamemenu:6000-6023
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/menu:5941-6146,6148
/code/branches/particles2:6050-6106,6109
/code/branches/presentation2:6106-6416
/code/branches/resource2:3372-5694
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
+ /code/branches/console:5941-6104
/code/branches/core5:5768-5928,6009
/code/branches/ingamemenu:6000-6023
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/menu:5941-6146,6148
/code/branches/particles2:6050-6106,6109
/code/branches/presentation2:6106-6416
/code/branches/resource2:3372-5694
/code/branches/sound3:5941-6102
/code/branches/sound4:6435-6504
/code/branches/steering:5949-6091
code/branches/buildsystem:1874-2276,2278-2400
code/branches/buildsystem2:2506-2658
code/branches/buildsystem3:2662-2708
code/branches/ceguilua:1802-1808
code/branches/core3:1572-1739
code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
code/branches/gametypes:2826-3031
code/branches/gcc43:1580
code/branches/gui:1635-1723,2795-2894
code/branches/input:1629-1636
code/branches/lodfinal:2372-2411
code/branches/map:2801-3086,3089
code/branches/miniprojects:2754-2824
code/branches/netp2:2835-2988
code/branches/netp3:2988-3082
code/branches/netp6:3214-3302
code/branches/network:2356
code/branches/network64:2210-2355
code/branches/objecthierarchy:1911-2085,2100,2110-2169
code/branches/objecthierarchy2:2171-2479
code/branches/overlay:2117-2385
code/branches/particles:2829-3085
code/branches/pch:3113-3194
code/branches/physics:1912-2055,2107-2439
code/branches/physics_merge:2436-2457
code/branches/pickups:1926-2086,2127,2827-2915
code/branches/pickups2:2107-2497,2915-3071
code/branches/presentation:2369-2652,2654-2660
code/branches/questsystem:1894-2088
code/branches/questsystem2:2107-2259
code/branches/questsystem5:2776-2905
code/branches/resource:3327-3366
code/branches/script_trigger:1295-1953,1955
code/branches/sound:2829-3010
code/branches/weapon:1925-2094
code/branches/weapon2:2107-2488
code/branches/weapons:2897-3051
code/branches/weaponsystem:2742-2890
Modified: code/branches/sound5/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/sound5/src/orxonox/sound/AmbientSound.cc 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/AmbientSound.cc 2010-03-11 14:16:12 UTC (rev 6506)
@@ -34,6 +34,7 @@
#include "core/Resource.h"
#include "core/XMLPort.h"
#include "SoundManager.h"
+#include "SoundStreamer.h"
namespace orxonox
{
@@ -119,7 +120,7 @@
const std::string& path = "ambient/" + MoodManager::getInstance().getMood() + '/' + this->ambientSource_;
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;
}
@@ -140,4 +141,42 @@
else
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();
+ }
}
Modified: code/branches/sound5/src/orxonox/sound/AmbientSound.h
===================================================================
--- code/branches/sound5/src/orxonox/sound/AmbientSound.h 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/AmbientSound.h 2010-03-11 14:16:12 UTC (rev 6506)
@@ -30,8 +30,10 @@
#ifndef _AmbientSound_H__
#define _AmbientSound_H__
-#include "OrxonoxPrereqs.h"
+#include <boost/thread.hpp>
+#include "sound/SoundPrereqs.h"
+
#include "core/BaseObject.h"
#include "network/synchronisable/Synchronisable.h"
#include "BaseSound.h"
@@ -70,6 +72,9 @@
protected:
~AmbientSound() { }
+ void doPlay();
+ void doStop();
+
private:
void preDestroy();
void registerVariables();
@@ -82,6 +87,9 @@
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);
};
}
Modified: code/branches/sound5/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/sound5/src/orxonox/sound/BaseSound.cc 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/BaseSound.cc 2010-03-11 14:16:12 UTC (rev 6506)
@@ -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,19 +140,18 @@
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)
{
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();
}
@@ -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;
}
}
@@ -179,7 +177,7 @@
{
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;
}
@@ -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/sound5/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/sound5/src/orxonox/sound/BaseSound.h 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/BaseSound.h 2010-03-11 14:16:12 UTC (rev 6506)
@@ -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/sound5/src/orxonox/sound/SoundBuffer.h
===================================================================
--- code/branches/sound5/src/orxonox/sound/SoundBuffer.h 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/SoundBuffer.h 2010-03-11 14:16:12 UTC (rev 6506)
@@ -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/sound5/src/orxonox/sound/SoundManager.cc
===================================================================
--- code/branches/sound5/src/orxonox/sound/SoundManager.cc 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/SoundManager.cc 2010-03-11 14:16:12 UTC (rev 6506)
@@ -42,7 +42,7 @@
#include "core/GameMode.h"
#include "core/ScopedSingletonManager.h"
#include "core/Resource.h"
-#include "SoundBuffer.h"
+#include "SoundBuffer.h":
#include "BaseSound.h"
#include "AmbientSound.h"
#include "WorldSound.h"
@@ -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)
{
@@ -77,7 +78,7 @@
ThrowException(InitialisationAborted, "Sound: Not loading at all");
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);
/*
@@ -109,17 +110,17 @@
#ifdef ORXONOX_PLATFORM_WINDOWS
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_);
// Create sound context and make it the currently used one
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);
Loki::ScopeGuard resetPlaysSoundGuard = Loki::MakeGuard(&GameMode::setPlaysSound, false);
@@ -132,7 +133,7 @@
if (const char* types = alutGetMIMETypes(ALUT_LOADER_BUFFER))
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;
this->mute_[SoundType::Music] = 1.0f;
@@ -146,7 +147,7 @@
if (!alGetError() && alIsSource(source))
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);
@@ -167,14 +168,14 @@
// 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();
this->soundBuffers_.clear();
// 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())
{
alDeleteSources(1, &this->availableSoundSources_.back());
@@ -185,23 +186,23 @@
// 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;
}
void SoundManager::setConfigValues()
@@ -247,7 +248,7 @@
{
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_);
}
}
@@ -256,7 +257,7 @@
{
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);
}
@@ -348,7 +349,7 @@
{
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;
}
}
@@ -616,7 +617,7 @@
{
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();
}
}
Modified: code/branches/sound5/src/orxonox/sound/SoundManager.h
===================================================================
--- code/branches/sound5/src/orxonox/sound/SoundManager.h 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/SoundManager.h 2010-03-11 14:16:12 UTC (rev 6506)
@@ -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/sound5/src/orxonox/sound/SoundPrereqs.h (from rev 6504, code/branches/sound4/src/orxonox/sound/SoundPrereqs.h)
===================================================================
--- code/branches/sound5/src/orxonox/sound/SoundPrereqs.h (rev 0)
+++ code/branches/sound5/src/orxonox/sound/SoundPrereqs.h 2010-03-11 14:16:12 UTC (rev 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:
+ * ...
+ *
+ */
+
+/**
+ 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/sound5/src/orxonox/sound/SoundStreamer.cc
===================================================================
--- code/branches/sound5/src/orxonox/sound/SoundStreamer.cc 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/SoundStreamer.cc 2010-03-11 14:16:12 UTC (rev 6506)
@@ -29,6 +29,7 @@
#include <al.h>
#include <vorbis/vorbisfile.h>
#include "SoundManager.h"
+#include "util/Sleep.h"
namespace orxonox
{
@@ -90,16 +91,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,9 +119,9 @@
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
}
}
}
Modified: code/branches/sound5/src/orxonox/sound/SoundStreamer.h
===================================================================
--- code/branches/sound5/src/orxonox/sound/SoundStreamer.h 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/SoundStreamer.h 2010-03-11 14:16:12 UTC (rev 6506)
@@ -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/sound5/src/orxonox/sound/WorldSound.h
===================================================================
--- code/branches/sound5/src/orxonox/sound/WorldSound.h 2010-03-11 14:13:23 UTC (rev 6505)
+++ code/branches/sound5/src/orxonox/sound/WorldSound.h 2010-03-11 14:16:12 UTC (rev 6506)
@@ -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