[Orxonox-commit 294] r2930 - in branches/sound/src: . sound
erwin at orxonox.net
erwin at orxonox.net
Mon Apr 27 13:18:13 CEST 2009
Author: erwin
Date: 2009-04-27 13:18:13 +0200 (Mon, 27 Apr 2009)
New Revision: 2930
Modified:
branches/sound/src/CMakeLists.txt
branches/sound/src/sound/SoundBase.h
branches/sound/src/sound/SoundManager.cc
branches/sound/src/sound/SoundManager.h
Log:
Sound: Added building things, corrected some typos
Modified: branches/sound/src/CMakeLists.txt
===================================================================
--- branches/sound/src/CMakeLists.txt 2009-04-23 11:50:52 UTC (rev 2929)
+++ branches/sound/src/CMakeLists.txt 2009-04-27 11:18:13 UTC (rev 2930)
@@ -140,7 +140,7 @@
# Orxonox code
ADD_SUBDIRECTORY(util)
ADD_SUBDIRECTORY(core)
-#ADD_SUBDIRECTORY(audio)
+ADD_SUBDIRECTORY(sound)
ADD_SUBDIRECTORY(network)
ADD_SUBDIRECTORY(orxonox)
Modified: branches/sound/src/sound/SoundBase.h
===================================================================
--- branches/sound/src/sound/SoundBase.h 2009-04-23 11:50:52 UTC (rev 2929)
+++ branches/sound/src/sound/SoundBase.h 2009-04-27 11:18:13 UTC (rev 2930)
@@ -25,6 +25,8 @@
* ...
*
*/
+#ifndef _SOUNDBASE_H__
+#define _SOUNDBASE_H__
#include <al.h>
#include <string>
@@ -63,3 +65,5 @@
static SoundManager* soundmanager_s;
}; // class SoundBase
} // namepsace orxonox
+
+#endif // _SOUNDBASE_H__
Modified: branches/sound/src/sound/SoundManager.cc
===================================================================
--- branches/sound/src/sound/SoundManager.cc 2009-04-23 11:50:52 UTC (rev 2929)
+++ branches/sound/src/sound/SoundManager.cc 2009-04-27 11:18:13 UTC (rev 2930)
@@ -29,6 +29,8 @@
#include <OgreSceneNode.h>
#include "orxonox/CameraManager.h"
+#include "orxonox/objects/worldentities/Camera.h"
+#include "util/Math.h"
#include "SoundManager.h"
namespace orxonox
@@ -60,7 +62,7 @@
this->context_ = alcCreateContext(this->device_, NULL);
alcMakeContextCurrent(this->context_);
- ALenum error = alcGetError();
+ ALenum error = alcGetError(this->device_);
if(error != ALC_NO_ERROR)
COUT(2) << "OpenAL: Could not create sound context." << std::endl;
@@ -111,10 +113,10 @@
// update listener orientation
Quaternion orient = camera->getOrientation();
Vector3 up = orient.xAxis(); // just a wild guess
- Vecotr3 at = orient.zAxis();
+ Vector3 at = orient.zAxis();
- float[3][2] orientation = { { at.x, at.y, at.z },
- { up.x, up.y, up.z } };
+ ALfloat* orientation = { at.x, at.y, at.z,
+ up.x, up.y, up.z };
alListenerfv(AL_POSITION, orientation);
error = alGetError();
@@ -126,4 +128,4 @@
(*i)->update();
}
-} // namespace orxonox
+}
Modified: branches/sound/src/sound/SoundManager.h
===================================================================
--- branches/sound/src/sound/SoundManager.h 2009-04-23 11:50:52 UTC (rev 2929)
+++ branches/sound/src/sound/SoundManager.h 2009-04-27 11:18:13 UTC (rev 2930)
@@ -24,23 +24,25 @@
* Co-authors:
* ...
*/
+#ifndef _SOUNDMANGER_H__
+#define _SOUNDMANGER_H__
#include <al.h>
#include <alc.h>
-#include <Tickable.h>
+#include <orxonox/objects/Tickable.h>
-class SoundBase;
+namespace orxonox
+{
+ class SoundBase;
-namespace Orxonox
-{
/**
* The SoundManager class manages the OpenAL device, context and listener
* position. It has a list of all SoundBase objects and calls their update
* function every tick. It is a singleton.
*
*/
- class SoundManager : public Tickable
+ class SoundManager : public Tickable
{
public:
static SoundManager* instance();
@@ -48,7 +50,7 @@
void addSound(SoundBase* sound);
void removeSound(SoundBase* sound);
- void tick(float dt);
+ virtual void tick(float dt);
private:
SoundManager(); // private constructor -> singleton
@@ -60,4 +62,6 @@
std::list<SoundBase*> soundlist_;
}; // class SoundManager
-} // namespace Orxonox
+} // namespace orxonox
+
+#endif // _SOUNDMANAGER_H__
More information about the Orxonox-commit
mailing list