= Sound = Presented to you by [wiki:ErwinHerrsche Erwin Herrsche] (everything works only for the sound branch) == User Guide == === Configuring available sounds === Configuration of soundfiles is done in the XML files. You just have to add the specific attribut to your class tag. The value has to be the filepath relative to the [mediapath]/audio directory. Current possible sounds: || '''Class''' || '''Soundattribute(s)''' || '''Looped?''' || || Level || ambientsound || Yes || || Engine || sound || Yes|| === Make more soundattributes available === Here are some instructions: * Look at the implementaion of the above classes. You should be able to copy a most of the things. * Add a new XMLPort macro to the XMLPort function of the class the sound belongs to(most likely XMLPortLoadOnly), name the function loadFooSound or something similar * Implement the load function, for some examples look at the above classes * Add the needed members to the class (at least one SoundBase pointer) * Add the calls to SondBase::play(bool loop) where you want to have the sound being played * Add the class/sound to the above list and that's it == Development == Sound uses the [http://openal.org OpenAL library]. === Classes === SoundManager: <- Tickable * manages the OpenAL device and context * manages the listener position * updates all registred sounds every tick SoundBase: * base class for all sounds * manages OpenAL buffer and source * has to be attached to a WorldEntity * can load a sound sample form a file (via alut, all alut supported sound formats; via fallback handler, ogg vorbis files) === Future projects === * implement sound device configuration * implement a fallback ogg loader * implement fallback loaders for other file types * implement streaming abilites for large files * implement context handling for multiple Levels/SoundManagers