| 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/load_param.h" | 
|---|
| 20 | #include "util/loading/factory.h" | 
|---|
| 21 | #include "material.h" | 
|---|
| 22 |  | 
|---|
| 23 | #include "sound/resource_sound_buffer.h" | 
|---|
| 24 |  | 
|---|
| 25 |  | 
|---|
| 26 |  | 
|---|
| 27 |  | 
|---|
| 28 |  | 
|---|
| 29 | ObjectListDefinition(SoundEntity); | 
|---|
| 30 | CREATE_FACTORY(SoundEntity); | 
|---|
| 31 |  | 
|---|
| 32 | /** | 
|---|
| 33 |  *  standard constructor | 
|---|
| 34 | */ | 
|---|
| 35 | SoundEntity::SoundEntity (const TiXmlElement* root) | 
|---|
| 36 | { | 
|---|
| 37 |   this->registerObject(this, SoundEntity::_objectList); | 
|---|
| 38 |  | 
|---|
| 39 |   this->toList(OM_COMMON); | 
|---|
| 40 |  | 
|---|
| 41 |   this->soundSource.setSourceNode(this); | 
|---|
| 42 |  | 
|---|
| 43 |   if( root != NULL) | 
|---|
| 44 |     this->loadParams(root); | 
|---|
| 45 |  | 
|---|
| 46 | } | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 | /** | 
|---|
| 50 |  *  standard deconstructor | 
|---|
| 51 | */ | 
|---|
| 52 | SoundEntity::~SoundEntity () | 
|---|
| 53 | { | 
|---|
| 54 | } | 
|---|
| 55 |  | 
|---|
| 56 | /** | 
|---|
| 57 |  * loading stuff | 
|---|
| 58 |  * @param root xml element | 
|---|
| 59 |  */ | 
|---|
| 60 | void SoundEntity::loadParams(const TiXmlElement* root) | 
|---|
| 61 | { | 
|---|
| 62 |   LoadParam(root, "soundfile", this, SoundEntity, setSoundFile) | 
|---|
| 63 |       .describe("Sets the file of the sound source"); | 
|---|
| 64 |  | 
|---|
| 65 |   LoadParam(root, "frequency", this, SoundEntity, setSoundFile) | 
|---|
| 66 |       .describe("Sets the file of the sound source"); | 
|---|
| 67 | } | 
|---|
| 68 |  | 
|---|
| 69 |  | 
|---|
| 70 | /** | 
|---|
| 71 |  * sets the sound file | 
|---|
| 72 |  * @param fileName name of the sound source | 
|---|
| 73 |  */ | 
|---|
| 74 | void SoundEntity::setSoundFile(const std::string& fileName) | 
|---|
| 75 | { | 
|---|
| 76 |   this->soundBuffer = OrxSound::ResourceSoundBuffer(fileName); | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 |  | 
|---|
| 80 | void SoundEntity::activate() | 
|---|
| 81 | { | 
|---|
| 82 | } | 
|---|
| 83 |  | 
|---|
| 84 |  | 
|---|
| 85 | void SoundEntity::deactivate() | 
|---|
| 86 | { | 
|---|
| 87 |  | 
|---|
| 88 | } | 
|---|
| 89 |  | 
|---|
| 90 |  | 
|---|
| 91 | /** | 
|---|
| 92 |  *  signal tick, time dependent things will be handled here | 
|---|
| 93 |  * @param time since last tick | 
|---|
| 94 | */ | 
|---|
| 95 | void SoundEntity::tick (float dt) | 
|---|
| 96 | { | 
|---|
| 97 |  | 
|---|
| 98 | } | 
|---|
| 99 |  | 
|---|
| 100 |  | 
|---|
| 101 |  | 
|---|