| [10321] | 1 | /* | 
|---|
 | 2 |    orxonox - the future of 3D-vertical-scrollers | 
|---|
 | 3 |  | 
|---|
 | 4 |    Copyright (C) 2004 orx | 
|---|
 | 5 |  | 
|---|
 | 6 |    This program is free software; you can redistribute it and/or modify | 
|---|
 | 7 |    it under the terms of the GNU General Public License as published by | 
|---|
 | 8 |    the Free Software Foundation; either version 2, or (at your option) | 
|---|
 | 9 |    any later version. | 
|---|
 | 10 |  | 
|---|
 | 11 |    ### File Specific | 
|---|
 | 12 |    main-programmer: Patrick Boenzli | 
|---|
 | 13 | */ | 
|---|
 | 14 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON | 
|---|
 | 15 |  | 
|---|
 | 16 |  | 
|---|
 | 17 | #include "sound_entity.h" | 
|---|
 | 18 |  | 
|---|
 | 19 | #include "util/loading/factory.h" | 
|---|
 | 20 | #include "material.h" | 
|---|
 | 21 |  | 
|---|
 | 22 | #include "sound/resource_sound_buffer.h" | 
|---|
 | 23 |  | 
|---|
 | 24 |  | 
|---|
 | 25 |  | 
|---|
 | 26 |  | 
|---|
 | 27 |  | 
|---|
 | 28 | ObjectListDefinition(SoundEntity); | 
|---|
 | 29 | CREATE_FACTORY(SoundEntity); | 
|---|
 | 30 |  | 
|---|
 | 31 | /** | 
|---|
 | 32 |  *  standard constructor | 
|---|
 | 33 | */ | 
|---|
 | 34 | SoundEntity::SoundEntity (const TiXmlElement* root) | 
|---|
 | 35 | { | 
|---|
 | 36 |   this->registerObject(this, SoundEntity::_objectList); | 
|---|
 | 37 |  | 
|---|
 | 38 |   this->toList(OM_COMMON); | 
|---|
 | 39 |  | 
|---|
 | 40 |   this->soundSource.setSourceNode(this); | 
|---|
 | 41 |  | 
|---|
| [10351] | 42 |   if( root != NULL) | 
|---|
 | 43 |     this->loadParams(root); | 
|---|
 | 44 |  | 
|---|
| [10321] | 45 |   this->thunderBuffer = OrxSound::ResourceSoundBuffer("sounds/atmosphere/thunder.wav"); | 
|---|
 | 46 | } | 
|---|
 | 47 |  | 
|---|
 | 48 |  | 
|---|
 | 49 | /** | 
|---|
 | 50 |  *  standard deconstructor | 
|---|
 | 51 | */ | 
|---|
 | 52 | SoundEntity::~SoundEntity () | 
|---|
 | 53 | { | 
|---|
 | 54 | } | 
|---|
 | 55 |  | 
|---|
| [10351] | 56 |  | 
|---|
 | 57 | /** | 
|---|
 | 58 |  * loading stuff | 
|---|
 | 59 |  * @param root xml element | 
|---|
 | 60 |  */ | 
|---|
 | 61 | void SoundEntity::loadParams(const TiXmlElement* root) | 
|---|
 | 62 | { | 
|---|
 | 63 |   LoadParam(root, "soundfile", this, SoundEntity, setSoundFile) | 
|---|
 | 64 |       .describe("Sets the file of the sound source"); | 
|---|
 | 65 |  | 
|---|
 | 66 |   LoadParam(root, "frequency", this, SoundEntity, setSoundFile) | 
|---|
 | 67 |       .describe("Sets the file of the sound source"); | 
|---|
 | 68 | } | 
|---|
 | 69 |  | 
|---|
 | 70 |  | 
|---|
 | 71 | /** | 
|---|
 | 72 |  * sets the sound file | 
|---|
 | 73 |  * @param fileName name of the sound source | 
|---|
 | 74 |  */ | 
|---|
 | 75 | void SoundEntity::setSoundFile(const std::string fileName) | 
|---|
 | 76 | { | 
|---|
 | 77 |   this->soundBuffer = OrxSound::ResourceSoundBuffer(fileName); | 
|---|
 | 78 | } | 
|---|
 | 79 |  | 
|---|
 | 80 |  | 
|---|
| [10321] | 81 | void SoundEntity::activate() | 
|---|
 | 82 | { | 
|---|
 | 83 | } | 
|---|
 | 84 |  | 
|---|
 | 85 |  | 
|---|
 | 86 | void SoundEntity::deactivate() | 
|---|
 | 87 | { | 
|---|
 | 88 |  | 
|---|
 | 89 | } | 
|---|
 | 90 |  | 
|---|
 | 91 |  | 
|---|
 | 92 | /** | 
|---|
 | 93 |  *  signal tick, time dependent things will be handled here | 
|---|
 | 94 |  * @param time since last tick | 
|---|
 | 95 | */ | 
|---|
 | 96 | void SoundEntity::tick (float dt) | 
|---|
 | 97 | { | 
|---|
 | 98 |  | 
|---|
 | 99 | } | 
|---|
 | 100 |  | 
|---|
 | 101 |  | 
|---|
 | 102 |  | 
|---|