Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6102


Ignore:
Timestamp:
Nov 20, 2009, 11:11:32 AM (15 years ago)
Author:
rgrieder
Message:

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).

Location:
code/branches/sound3
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • code/branches/sound3/data/levels/sound.oxw

    r6100 r6102  
    1818  >
    1919
    20   <AmbientSound source="Mars.ogg" loop="true" play="true" />
    21   <AmbientSound source="Asteroid_rocks.ogg" loop="true" play="false">
     20  <AmbientSound ambientSource="Mars.ogg" loop="true" play="true" />
     21  <AmbientSound ambientSource="Asteroid_rocks.ogg" loop="true" play="false">
    2222        <events>
    2323                <activity>
  • code/branches/sound3/src/libraries/core/XMLPort.h

    r5929 r6102  
    184184        ClassIdentifier<classname>::getIdentifier()->addXMLPortParamContainer(paramname, containername); \
    185185    } \
    186     containername->port(static_cast<BaseObject*>(this), object, xmlelement, mode)
     186    containername->port(dynamic_cast<BaseObject*>(this), object, xmlelement, mode)
    187187
    188188// --------------------
  • code/branches/sound3/src/orxonox/sound/AmbientSound.cc

    r6100 r6102  
    5757    {
    5858        SUPER(AmbientSound, XMLPort, xmlelement, mode);
    59         XMLPortParamExtern(AmbientSound, BaseSound, this, "volume", setVolume, getVolume, xmlelement, mode);
    60         XMLPortParamExtern(AmbientSound, BaseSound, this, "loop", setLooping, getLooping, xmlelement, mode);
    61         XMLPortParamExtern(AmbientSound, BaseSound, this, "play", play, isPlaying, xmlelement, mode);
    62         XMLPortParam(AmbientSound, "source", setAmbientSource, getAmbientSource, xmlelement, mode);
     59        BaseSound::XMLPortExtern(xmlelement, mode);
     60        XMLPortParam(AmbientSound, "ambientsource", setAmbientSource, getAmbientSource, xmlelement, mode);
    6361    }
    6462
  • code/branches/sound3/src/orxonox/sound/BaseSound.cc

    r6071 r6102  
    3737#include "core/GameMode.h"
    3838#include "core/Resource.h"
     39#include "core/XMLPort.h"
    3940
    4041namespace orxonox
     
    6061        if (GameMode::playsSound())
    6162            alDeleteSources(1, &this->audioSource_);
     63    }
     64
     65    void BaseSound::XMLPortExtern(Element& xmlelement, XMLPort::Mode mode)
     66    {
     67        XMLPortParam(BaseSound, "volume", setVolume,  getVolume,  xmlelement, mode);
     68        XMLPortParam(BaseSound, "loop",   setLooping, getLooping, xmlelement, mode);
     69        XMLPortParam(BaseSound, "play",   play,       isPlaying,  xmlelement, mode);
     70        XMLPortParam(BaseSound, "source", setSource,  getSource,  xmlelement, mode);
    6271    }
    6372
  • code/branches/sound3/src/orxonox/sound/BaseSound.h

    r6074 r6102  
    4949        virtual ~BaseSound();
    5050
     51        void XMLPortExtern(Element& xmlelement, XMLPort::Mode mode);
     52
    5153        virtual void play();
    5254        virtual void stop();
  • code/branches/sound3/src/orxonox/sound/WorldSound.cc

    r6100 r6102  
    5353    {
    5454        SUPER(WorldSound, XMLPort, xmlelement, mode);
    55         XMLPortParamExtern(WorldSound, BaseSound, this, "volume", setVolume, getVolume, xmlelement, mode);
    56         XMLPortParamExtern(WorldSound, BaseSound, this, "loop", setLooping, getLooping, xmlelement, mode);
    57         XMLPortParamExtern(WorldSound, BaseSound, this, "play", play, isPlaying, xmlelement, mode);
    58         XMLPortParamExtern(WorldSound, BaseSound, this, "source", setSource, getSource, xmlelement, mode);
     55        BaseSound::XMLPortExtern(xmlelement, mode);
    5956    }
    6057
Note: See TracChangeset for help on using the changeset viewer.