Enki  1.9
ActiveSoundSource.h
Go to the documentation of this file.
1 /*
2  Enki - a fast 2D robot simulator
3  Copyright (C) 1999-2016 Stephane Magnenat <stephane at magnenat dot net>
4  Copyright (C) 2004-2005 Markus Waibel <markus dot waibel at epfl dot ch>
5  Copyright (c) 2004-2005 Antoine Beyeler <abeyeler at ab-ware dot com>
6  Copyright (C) 2005-2006 Laboratory of Intelligent Systems, EPFL, Lausanne
7  Copyright (C) 2006-2008 Laboratory of Robotics Systems, EPFL, Lausanne
8  See AUTHORS for details
9 
10  This program is free software; the authors of any publication
11  arising from research using this software are asked to add the
12  following reference:
13  Enki - a fast 2D robot simulator
14  http://home.gna.org/enki
15  Stephane Magnenat <stephane at magnenat dot net>,
16  Markus Waibel <markus dot waibel at epfl dot ch>
17  Laboratory of Intelligent Systems, EPFL, Lausanne.
18 
19  You can redistribute this program and/or modify
20  it under the terms of the GNU General Public License as published by
21  the Free Software Foundation; either version 2 of the License, or
22  (at your option) any later version.
23 
24  This program is distributed in the hope that it will be useful,
25  but WITHOUT ANY WARRANTY; without even the implied warranty of
26  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27  GNU General Public License for more details.
28 
29  You should have received a copy of the GNU General Public License
30  along with this program; if not, write to the Free Software
31  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 */
33 
34 #ifndef __ENKI_ACTIVESOUNDOBJECT_H
35 #define __ENKI_ACTIVESOUNDOBJECT_H
36 
37 #include "../Interaction.h"
38 #include "../PhysicalEngine.h"
39 
43 namespace Enki
44 {
45 
47 
49  {
50  public:
52  unsigned noOfChannels;
53 
55  double *pitch;
56 
58  bool enableFlag;
60  double elapsedTime;
62  double activityTime;
63 
65  ActiveSoundSource(Robot *owner, double r, unsigned channels);
68  // Local interaction functions
69  virtual void init() {}
70  virtual void objectStep(double dt, PhysicalObject *po, World *w) {}
71 
73  void setSoundRange(double range);
75  double getSound(unsigned channel);
77  double getMaxSound(int* channel);
79  void setSound(unsigned channel, double signal);
81  void realisticSetSound(unsigned channel, double signal);
82  };
83 
85 
87  {
88  public:
91 
92  public:
94  ActiveSoundObject(Robot *owner, double actionRange, unsigned channels);
95  };
96 }
97 
98 #endif
99 
double getMaxSound(int *channel)
Get the maximum value, set channel to the channel where this maximum lies.
Definition: ActiveSoundSource.cpp:116
~ActiveSoundSource()
Destructor.
Definition: ActiveSoundSource.cpp:65
A situated object in the world with mass, geometry properties, physical properties, ...
Definition: PhysicalEngine.h:131
void setSoundRange(double range)
Set the range of this sound interraction.
Definition: ActiveSoundSource.cpp:70
unsigned noOfChannels
No of channels of this sound source.
Definition: ActiveSoundSource.h:52
Enki is the namespace of the Enki simulator. All Enki functions and classes excepted the math one are...
Definition: BluetoothBase.cpp:44
double * pitch
Produced sound: vector of different pitch as they were channels.
Definition: ActiveSoundSource.h:55
double r
Radius of the local interaction.
Definition: Interaction.h:57
Robot * owner
The physical object that owns the interaction.
Definition: Interaction.h:62
double elapsedTime
Elapsed time since last activation.
Definition: ActiveSoundSource.h:60
void setSound(unsigned channel, double signal)
Set the value of channel to signal using a simplified model.
Definition: ActiveSoundSource.cpp:75
ActiveSoundSource(Robot *owner, double r, unsigned channels)
Constructor.
Definition: ActiveSoundSource.cpp:46
double getSound(unsigned channel)
Get the value associated with channel.
Definition: ActiveSoundSource.cpp:107
The world is the container of all objects and robots.
Definition: PhysicalEngine.h:411
ActiveSoundObject can be inherited by any robot that want to emit sound.
Definition: ActiveSoundSource.h:86
ActiveSoundSource speaker
Speaker.
Definition: ActiveSoundSource.h:90
Time limited sound emitter.
Definition: ActiveSoundSource.h:48
Interacts with another object or wall only up to a certain distance.
Definition: Interaction.h:53
void realisticSetSound(unsigned channel, double signal)
Set the value of channel to signal using a more realistic model.
Definition: ActiveSoundSource.cpp:81
double activityTime
Activity time.
Definition: ActiveSoundSource.h:62
A robot is a PhysicalObject that has additional interactions and a controller.
Definition: PhysicalEngine.h:379
bool enableFlag
Sound activity.
Definition: ActiveSoundSource.h:58