00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #ifndef __ENKI_MICROPHONE_H
00035 #define __ENKI_MICROPHONE_H
00036
00037 #include <enki/PhysicalEngine.h>
00038 #include <enki/Interaction.h>
00039 #include "ActiveSoundSource.h"
00040
00041 #include <valarray>
00042
00047 namespace Enki
00048 {
00050 typedef double (*MicrophoneResponseModel)(double, double);
00051
00053
00054 class Microphone : public LocalInteraction
00055 {
00056 protected:
00058 PhysicalObject *owner;
00060 Vector micAbsPos;
00062 Vector micRelPos;
00064 MicrophoneResponseModel micModel;
00066 double range;
00068 unsigned noOfChannels;
00070 double* acquiredSound;
00071
00072 public:
00077 Microphone(Robot *owner, Vector micRelPos, double range,
00078 MicrophoneResponseModel micModel, unsigned channels);
00080 ~Microphone(void);
00082 void init();
00084 virtual void objectStep(double dt, PhysicalObject *po, World *w);
00086 void resetSound(void);
00088 double* getAcquiredSound(void);
00090 void getMaxChannel(double *intensity, int *channel);
00092 Vector getMicAbsPos();
00093 };
00094
00096
00097 class FourWayMic : public LocalInteraction
00098 {
00099 protected:
00101 PhysicalObject *owner;
00103 Vector allMicAbsPos[4];
00105 double micDist;
00107 MicrophoneResponseModel micModel;
00109 double range;
00111 unsigned noOfChannels;
00113 double* acquiredSound[4];
00114
00115 public:
00120 FourWayMic(Robot *owner, double micDist, double range,
00121 MicrophoneResponseModel micModel, unsigned channels);
00123 ~FourWayMic(void);
00125 void init();
00127 virtual void objectStep(double dt, PhysicalObject *po, World *w);
00129 void resetSound(void);
00131 double* getAcquiredSound(unsigned micNo);
00133 void getMaxChannel(unsigned micNo, double *intensity, int *channel);
00135 Vector getMicAbsPos(unsigned micNo);
00136 };
00137 }
00138
00139 #endif