[Orxonox-commit 357] r2967 - in branches/sound/src: . orxonox orxonox/sound
erwin at orxonox.net
erwin at orxonox.net
Mon May 11 15:29:23 CEST 2009
Author: erwin
Date: 2009-05-11 15:29:23 +0200 (Mon, 11 May 2009)
New Revision: 2967
Modified:
branches/sound/src/CMakeLists.txt
branches/sound/src/orxonox/CMakeLists.txt
branches/sound/src/orxonox/sound/SoundBase.cc
branches/sound/src/orxonox/sound/SoundBase.h
Log:
SoundBase now loads files relative to the mediapath
Modified: branches/sound/src/CMakeLists.txt
===================================================================
--- branches/sound/src/CMakeLists.txt 2009-05-11 12:30:54 UTC (rev 2966)
+++ branches/sound/src/CMakeLists.txt 2009-05-11 13:29:23 UTC (rev 2967)
@@ -140,7 +140,6 @@
# Orxonox code
ADD_SUBDIRECTORY(util)
ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(sound)
ADD_SUBDIRECTORY(network)
ADD_SUBDIRECTORY(orxonox)
Modified: branches/sound/src/orxonox/CMakeLists.txt
===================================================================
--- branches/sound/src/orxonox/CMakeLists.txt 2009-05-11 12:30:54 UTC (rev 2966)
+++ branches/sound/src/orxonox/CMakeLists.txt 2009-05-11 13:29:23 UTC (rev 2967)
@@ -53,9 +53,9 @@
${Boost_SYSTEM_LIBRARY}
${OPENAL_LIBRARY}
${ALUT_LIBRARY}
- #${VORBISFILE_LIBRARY}
- #${VORBIS_LIBRARY}
- #${OGG_LIBRARY}
+ ${VORBISFILE_LIBRARY}
+ ${VORBIS_LIBRARY}
+ ${OGG_LIBRARY}
ogreceguirenderer_orxonox
tinyxml++_orxonox
tolua++_orxonox
Modified: branches/sound/src/orxonox/sound/SoundBase.cc
===================================================================
--- branches/sound/src/orxonox/sound/SoundBase.cc 2009-05-11 12:30:54 UTC (rev 2966)
+++ branches/sound/src/orxonox/sound/SoundBase.cc 2009-05-11 13:29:23 UTC (rev 2967)
@@ -25,6 +25,8 @@
* ...
*
*/
+#include <AL/alut.h>
+#include <vorbis/vorbisfile.h>
#include "orxonox/objects/worldentities/WorldEntity.h"
#include "util/Math.h"
@@ -127,11 +129,18 @@
}
bool SoundBase::loadFile(std::string filename) {
+ filename = Core::getMediaPathString() + "/audio/" + filename;
COUT(3) << "OpenAL ALUT: loading file " << filename << std::endl;
this->buffer_ = alutCreateBufferFromFile(filename.c_str());
if(this->buffer_ == AL_NONE) {
COUT(2) << "OpenAL ALUT: " << alutGetErrorString(alutGetError()) << std::endl;
- return false;
+ if(filename.find("ogg", 0) != string::npos)
+ {
+ this->buffer_ = loadOggFile(filename);
+ }
+
+ if(this->buffer_ == AL_NONE)
+ return false;
}
alGenSources(1, &this->source_);
@@ -148,4 +157,10 @@
alGetSourcei(this->source_, AL_SOURCE_STATE, &state);
return state;
}
+
+ ALuint SoundBase::loadOggFile(std::string filename)
+ {
+ // just a dummy
+ return AL_NONE;
+ }
} // namespace: orxonox
Modified: branches/sound/src/orxonox/sound/SoundBase.h
===================================================================
--- branches/sound/src/orxonox/sound/SoundBase.h 2009-05-11 12:30:54 UTC (rev 2966)
+++ branches/sound/src/orxonox/sound/SoundBase.h 2009-05-11 13:29:23 UTC (rev 2967)
@@ -29,7 +29,6 @@
#define _SOUNDBASE_H__
#include <AL/al.h>
-#include <AL/alut.h>
#include <string>
namespace orxonox
@@ -61,6 +60,7 @@
bool loadFile(std::string filename);
private:
+ ALuint loadOggFile(std::string filename);
ALuint source_;
ALuint buffer_;
WorldEntity* entity_;
More information about the Orxonox-commit
mailing list