Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/blink/src/world_entities/sound_entity.cc @ 10649

Last change on this file since 10649 was 10404, checked in by patrick, 18 years ago

correct fading

File size: 1.8 KB
Line 
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
30ObjectListDefinition(SoundEntity);
31CREATE_FACTORY(SoundEntity);
32
33/**
34 *  standard constructor
35*/
36SoundEntity::SoundEntity (const TiXmlElement* root)
37{
38  this->registerObject(this, SoundEntity::_objectList);
39
40  this->toList(OM_COMMON);
41
42  this->soundSource.setSourceNode(this);
43
44  this->bInit = false;
45
46  if( root != NULL)
47    this->loadParams(root);
48
49}
50
51
52/**
53 *  standard deconstructor
54*/
55SoundEntity::~SoundEntity ()
56{
57}
58
59/**
60 * loading stuff
61 * @param root xml element
62 */
63void SoundEntity::loadParams(const TiXmlElement* root)
64{
65  LoadParam(root, "soundfile", this, SoundEntity, setSoundFile)
66      .describe("Sets the file of the sound source");
67
68  LoadParam(root, "frequency", this, SoundEntity, setSoundFile)
69      .describe("Sets the file of the sound source");
70}
71
72
73/**
74 * sets the sound file
75 * @param fileName name of the sound source
76 */
77void SoundEntity::setSoundFile(const std::string& fileName)
78{
79  this->soundBuffer = OrxSound::ResourceSoundBuffer(fileName);
80  this->bInit = true;
81}
82
83
84void SoundEntity::activate()
85{
86  this->soundSource.play();
87}
88
89
90void SoundEntity::deactivate()
91{
92
93}
94
95
96/**
97 *  signal tick, time dependent things will be handled here
98 * @param time since last tick
99*/
100void SoundEntity::tick (float dt)
101{
102
103}
104
105
106
Note: See TracBrowser for help on using the repository browser.