[Orxonox-commit 1382] r6100 - in code/branches/sound3: data/levels data/levels/templates src/orxonox/sound
rgrieder at orxonox.net
rgrieder at orxonox.net
Thu Nov 19 21:01:16 CET 2009
Author: rgrieder
Date: 2009-11-19 21:01:16 +0100 (Thu, 19 Nov 2009)
New Revision: 6100
Modified:
code/branches/sound3/data/levels/sound.oxw
code/branches/sound3/data/levels/templates/spaceship_assff.oxt
code/branches/sound3/src/orxonox/sound/AmbientSound.cc
code/branches/sound3/src/orxonox/sound/WorldSound.cc
code/branches/sound3/src/orxonox/sound/WorldSound.h
Log:
Added a sound for the engine (forward active mode) by overloading changedActivity in WorldSound.
Modified: code/branches/sound3/data/levels/sound.oxw
===================================================================
--- code/branches/sound3/data/levels/sound.oxw 2009-11-18 16:23:33 UTC (rev 6099)
+++ code/branches/sound3/data/levels/sound.oxw 2009-11-19 20:01:16 UTC (rev 6100)
@@ -16,8 +16,9 @@
ambientlight = "0.8, 0.8, 0.8"
skybox = "Orxonox/Starbox"
>
- <AmbientSound source="Mars.ogg" loop="true" playOnLoad="true" />
- <AmbientSound source="Asteroid_rocks.ogg" loop="true" playOnLoad="false">
+
+ <AmbientSound source="Mars.ogg" loop="true" play="true" />
+ <AmbientSound source="Asteroid_rocks.ogg" loop="true" play="false">
<events>
<activity>
<DistanceTrigger position="300,100,0" distance=200 target="ControllableEntity">
@@ -28,7 +29,8 @@
</activity>
</events>
</AmbientSound>
- <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
- <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshippirate />
+
+ <Light type=directional position="0,0,0" direction="0.253, 0.593, -0.765" diffuse="1.0, 0.9, 0.9, 1.0" specular="1.0, 0.9, 0.9, 1.0" />
+ <SpawnPoint position="0,0,0" spawnclass=SpaceShip pawndesign=spaceshipassff />
</Scene>
</Level>
Modified: code/branches/sound3/data/levels/templates/spaceship_assff.oxt
===================================================================
--- code/branches/sound3/data/levels/templates/spaceship_assff.oxt 2009-11-18 16:23:33 UTC (rev 6099)
+++ code/branches/sound3/data/levels/templates/spaceship_assff.oxt 2009-11-19 20:01:16 UTC (rev 6100)
@@ -75,14 +75,17 @@
<Light mainstate=visibility position=" 8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
<Light mainstate=visibility position="-8, 0, 8" diffuse="0.3, 0.6, 1.0" specular="0.3, 0.6, 1.0" attenuation="600, 1.0, 0.007, 0.0002" type=point />
-->
+ <!--WorldSound mainstate=activity source="sounds/Engine_low.ogg" oop=1 /-->
</active>
<forward>
<Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
<Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.2, 0.65, 1.0, 1.0" width=15 length=1500 lifetime=2 elements=50 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Flares/ThrusterFlare1" />
+ <WorldSound mainstate=activity source="sounds/Engine_low.ogg" oop=1 />
</forward>
<boost>
<Backlight mainstate=activity active=false scale=0.4 name=bltest position=" 7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
<Backlight mainstate=activity active=false scale=0.4 name=bltest position="-7.6, 0, 6" colour="0.6, 0.75, 0.8, 0.7" width=40 length=1000 lifetime=1 elements=30 trailmaterial="Trail/backlighttrail" turnontime=1 turnofftime=1 material="Examples/Flare" />
+ <!--WorldSound mainstate=activity source="sounds/Engine_high.ogg" oop=1 /-->
</boost>
<brake>
<FadingBillboard mainstate=activity active=false scale=0.3 position=" 8, 0, 6" colour="0.5, 0.0, 0.0, 0.3" material="Examples/Flare" turnontime=0.5 turnofftime=0.5 />
Modified: code/branches/sound3/src/orxonox/sound/AmbientSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/AmbientSound.cc 2009-11-18 16:23:33 UTC (rev 6099)
+++ code/branches/sound3/src/orxonox/sound/AmbientSound.cc 2009-11-19 20:01:16 UTC (rev 6100)
@@ -124,15 +124,10 @@
void AmbientSound::changedActivity()
{
- COUT(3) << "Sound: " << this->getSource() << ": ChangedActivity: " << this->isActive() << std::endl;
- this->BaseObject::changedActivity();
+ SUPER(AmbientSound, changedActivity);
if (this->isActive())
- {
this->play();
- }
else
- {
this->stop();
- }
}
}
Modified: code/branches/sound3/src/orxonox/sound/WorldSound.cc
===================================================================
--- code/branches/sound3/src/orxonox/sound/WorldSound.cc 2009-11-18 16:23:33 UTC (rev 6099)
+++ code/branches/sound3/src/orxonox/sound/WorldSound.cc 2009-11-19 20:01:16 UTC (rev 6100)
@@ -88,4 +88,13 @@
COUT(2) << "Sound: OpenAL: Invalid sound direction" << std::endl;
}
}
+
+ void WorldSound::changedActivity()
+ {
+ SUPER(WorldSound, changedActivity);
+ if (this->isActive())
+ this->play();
+ else
+ this->stop();
+ }
}
Modified: code/branches/sound3/src/orxonox/sound/WorldSound.h
===================================================================
--- code/branches/sound3/src/orxonox/sound/WorldSound.h 2009-11-18 16:23:33 UTC (rev 6099)
+++ code/branches/sound3/src/orxonox/sound/WorldSound.h 2009-11-19 20:01:16 UTC (rev 6100)
@@ -49,6 +49,7 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode);
+ virtual void changedActivity();
virtual void tick(float dt);
More information about the Orxonox-commit
mailing list