sound.h

Go to the documentation of this file.
00001 /*
00002 ** sound.h
00003 ** 
00004 ** Made by Georg Martius <georg@nld.ds.mpg.de>
00005 ** 
00006 ** Started on  Mon Oct 15 16:20:00 2007 Georg Martius
00007 ** Last update Mon Oct 15 16:20:00 2007 Georg Martius
00008 */
00009 
00010 #ifndef         SOUND_H_
00011 # define        SOUND_H_
00012 
00013 #include "pos.h"
00014 
00015 namespace lpzrobots {
00016 
00017   class OSGSphere;
00018   class OsgHandle;
00019   
00020   /// Object that represents a sound signal in the simulator
00021   class Sound {
00022   public:
00023     Sound(double time, const Pos& pos, float intensity, float frequency, void* sender)
00024       : time(time), pos(pos), 
00025       intensity(intensity), frequency(frequency), sender(sender),
00026       visual(0) {}
00027 
00028     ~Sound();
00029     
00030     /// nice predicate function for finding old sound signals
00031     struct older_than : public std::unary_function<const Sound&, bool> {
00032       older_than(double time) : time(time) {}
00033       double time;
00034       bool operator()(const Sound& s) { return s.time < time; }
00035     };
00036 
00037     void render(const OsgHandle& osgHandle);
00038 
00039     double time;
00040     Pos pos;    ///< emission position
00041     float intensity; ///< intensity -1..1
00042     float frequency; ///< frequency -1..1
00043     void* sender;    ///< pointer to the sender (can be used for self
00044                      ///detection)
00045     
00046   private:
00047     OSGSphere* visual;    
00048   };
00049 
00050 } // end namespace
00051 
00052 #endif      /* !SOUND_H_ */

Generated on Fri Oct 30 16:29:01 2009 for Robot Simulator of the Robotics Group for Self-Organization of Control by  doxygen 1.4.7