[Orxonox-commit 1384] r6102 - in code/branches/sound3: data/levels src/libraries/core src/orxonox/sound
rgrieder at orxonox.net
rgrieder at orxonox.net
Fri Nov 20 11:11:32 CET 2009
Author: rgrieder
Date: 2009-11-20 11:11:32 +0100 (Fri, 20 Nov 2009)
New Revision: 6102
Modified:
code/branches/sound3/data/levels/sound.oxw
code/branches/sound3/src/libraries/core/XMLPort.h
code/branches/sound3/src/orxonox/sound/AmbientSound.cc
code/branches/sound3/src/orxonox/sound/BaseSound.cc
code/branches/sound3/src/orxonox/sound/BaseSound.h
code/branches/sound3/src/orxonox/sound/WorldSound.cc
Log:
Changed "source" parameter of AmbientSound to "ambientSource" to restore consistency with the c++ methods.
Adjusted sound.oxw file.
Also moved XML ports form WorldSound/AmbientSound to BaseSound::XMLPortExtern.
To make that work, I had to insert a dynamic_cast into the XMLPortParamGeneric macro. Shouldn't be a problem though. Just don't use XMLPortParam inside a class that might not be a BaseObject (at least dynamically).
Modified: code/branches/sound3/data/levels/sound.oxw
===================================================================
--- code/branches/sound3/data/levels/sound.oxw 2009-11-20 00:02:09 UTC (rev 6101)
+++ code/branches/sound3/data/levels/sound.oxw 2009-11-20 10:11:32 UTC (rev 6102)
@@ -17,8 +17,8 @@
skybox = "Orxonox/Starbox"
>
- <AmbientSound source="Mars.ogg" loop="true" play="true" />
- <AmbientSound source="Asteroid_rocks.ogg" loop="true" play="false">
+ <AmbientSound ambientSource="Mars.ogg" loop="true" play="true" />
+ <AmbientSound ambientSource="Asteroid_rocks.ogg" loop="true" play="false">
<events>
<activity>
<DistanceTrigger position="300,100,0" distance=200 target="ControllableEntity">
Modified: code/branches/sound3/src/libraries/core/XMLPort.h
===================================================================
--- code/branches/sound3/src/libraries/core/XMLPort.h 2009-11-20 00:02:09 UTC (rev 6101)
+++ code/branches/sound3/src/libraries/core/XMLPort.h 2009-11-20 10:11:32 UTC (rev 6102)
@@ -183,7 +183,7 @@
containername = new orxonox::XMLPortClassParamContainer<objectclass>(std::string(paramname), ClassIdentifier<classname>::getIdentifier(), loadexecutor, saveexecutor); \
ClassIdentifier<classname>::getIdentifier()->addXMLPortParamContainer(paramname, containername); \
} \
- containername->port(static_cast<BaseObject*>(this), object, xmlelement, mode)
+ containername->port(dynamic_cast<BaseObject*>(this), object, xmlelement, mode)
// --------------------
// XMLPortObjectExtended
Modified: code/branches/sound3/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/AmbientSound.cc 2009-11-20 00:02:09 UTC (rev 6101)
+++ code/branches/sound3/src/orxonox/sound/AmbientSound.cc 2009-11-20 10:11:32 UTC (rev 6102)
@@ -56,10 +56,8 @@
void AmbientSound::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(AmbientSound, XMLPort, xmlelement, mode);
- XMLPortParamExtern(AmbientSound, BaseSound, this, "volume", setVolume, getVolume, xmlelement, mode);
- XMLPortParamExtern(AmbientSound, BaseSound, this, "loop", setLooping, getLooping, xmlelement, mode);
- XMLPortParamExtern(AmbientSound, BaseSound, this, "play", play, isPlaying, xmlelement, mode);
- XMLPortParam(AmbientSound, "source", setAmbientSource, getAmbientSource, xmlelement, mode);
+ BaseSound::XMLPortExtern(xmlelement, mode);
+ XMLPortParam(AmbientSound, "ambientsource", setAmbientSource, getAmbientSource, xmlelement, mode);
}
void AmbientSound::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
Modified: code/branches/sound3/src/orxonox/sound/BaseSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/BaseSound.cc 2009-11-20 00:02:09 UTC (rev 6101)
+++ code/branches/sound3/src/orxonox/sound/BaseSound.cc 2009-11-20 10:11:32 UTC (rev 6102)
@@ -36,6 +36,7 @@
#include "core/CoreIncludes.h"
#include "core/GameMode.h"
#include "core/Resource.h"
+#include "core/XMLPort.h"
namespace orxonox
{
@@ -61,6 +62,14 @@
alDeleteSources(1, &this->audioSource_);
}
+ void BaseSound::XMLPortExtern(Element& xmlelement, XMLPort::Mode mode)
+ {
+ XMLPortParam(BaseSound, "volume", setVolume, getVolume, xmlelement, mode);
+ XMLPortParam(BaseSound, "loop", setLooping, getLooping, xmlelement, mode);
+ XMLPortParam(BaseSound, "play", play, isPlaying, xmlelement, mode);
+ XMLPortParam(BaseSound, "source", setSource, getSource, xmlelement, mode);
+ }
+
void BaseSound::play()
{
if (!this->isPlaying() && GameMode::showsGraphics())
Modified: code/branches/sound3/src/orxonox/sound/BaseSound.h
===================================================================
--- code/branches/sound3/src/orxonox/sound/BaseSound.h 2009-11-20 00:02:09 UTC (rev 6101)
+++ code/branches/sound3/src/orxonox/sound/BaseSound.h 2009-11-20 10:11:32 UTC (rev 6102)
@@ -48,6 +48,8 @@
BaseSound();
virtual ~BaseSound();
+ void XMLPortExtern(Element& xmlelement, XMLPort::Mode mode);
+
virtual void play();
virtual void stop();
virtual void pause();
Modified: code/branches/sound3/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/WorldSound.cc 2009-11-20 00:02:09 UTC (rev 6101)
+++ code/branches/sound3/src/orxonox/sound/WorldSound.cc 2009-11-20 10:11:32 UTC (rev 6102)
@@ -52,10 +52,7 @@
void WorldSound::XMLPort(Element& xmlelement, XMLPort::Mode mode)
{
SUPER(WorldSound, XMLPort, xmlelement, mode);
- XMLPortParamExtern(WorldSound, BaseSound, this, "volume", setVolume, getVolume, xmlelement, mode);
- XMLPortParamExtern(WorldSound, BaseSound, this, "loop", setLooping, getLooping, xmlelement, mode);
- XMLPortParamExtern(WorldSound, BaseSound, this, "play", play, isPlaying, xmlelement, mode);
- XMLPortParamExtern(WorldSound, BaseSound, this, "source", setSource, getSource, xmlelement, mode);
+ BaseSound::XMLPortExtern(xmlelement, mode);
}
void WorldSound::XMLEventPort(Element& xmlelement, XMLPort::Mode mode)
More information about the Orxonox-commit
mailing list