Robot Simulator of the Robotics Group for Self-Organization of Control  0.8.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
sound.h
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2005-2011 LpzRobots development team *
3  * Georg Martius <georg dot martius at web dot de> *
4  * Frank Guettler <guettler at informatik dot uni-leipzig dot de *
5  * Frank Hesse <frank at nld dot ds dot mpg dot de> *
6  * Ralf Der <ralfder at mis dot mpg dot de> *
7  * *
8  * This program is free software; you can redistribute it and/or modify *
9  * it under the terms of the GNU General Public License as published by *
10  * the Free Software Foundation; either version 2 of the License, or *
11  * (at your option) any later version. *
12  * *
13  * This program is distributed in the hope that it will be useful, *
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16  * GNU General Public License for more details. *
17  * *
18  * You should have received a copy of the GNU General Public License *
19  * along with this program; if not, write to the *
20  * Free Software Foundation, Inc., *
21  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22  * *
23  ***************************************************************************/
24 
25 #ifndef SOUND_H_
26 #define SOUND_H_
27 
28 #include "pos.h"
29 
30 namespace lpzrobots {
31 
32  class GlobalData;
33 
34  /// Object that represents a sound signal in the simulator
35  class Sound {
36  public:
37  Sound(double time, const Pos& pos, float intensity, float frequency, void* sender);
38 
39  ~Sound();
40 
41  void createVisual(GlobalData& globalData, double visualSize, Pos visualOffset) const;
42 
43  /// nice predicate function for finding old sound signals
44  struct older_than : public std::unary_function<const Sound&, bool> {
45  older_than(double time) : time(time) {}
46  double time;
47  bool operator()(const Sound& s) { return s.time < time; }
48  };
49 
50  double time;
51  Pos pos; ///< emission position
52  float intensity; ///< intensity 0..1
53  float frequency; ///< frequency -1..1
54  void* sender; ///< pointer to the sender (can be used for self
55  ///detection)
56 
57  };
58 
59 } // end namespace
60 
61 #endif /* !SOUND_H_ */
double time
Definition: sound.h:46
Sound(double time, const Pos &pos, float intensity, float frequency, void *sender)
Definition: sound.cpp:34
Definition: pos.h:36
void * sender
pointer to the sender (can be used for self detection)
Definition: sound.h:54
float intensity
intensity 0..1
Definition: sound.h:52
float frequency
frequency -1..1
Definition: sound.h:53
void createVisual(GlobalData &globalData, double visualSize, Pos visualOffset) const
Definition: sound.cpp:43
double time
Definition: sound.h:50
bool operator()(const Sound &s)
Definition: sound.h:47
~Sound()
Definition: sound.cpp:40
Data structure holding all essential global information.
Definition: globaldata.h:57
Object that represents a sound signal in the simulator.
Definition: sound.h:35
Pos pos
emission position
Definition: sound.h:51
older_than(double time)
Definition: sound.h:45
nice predicate function for finding old sound signals
Definition: sound.h:44