Jamoma API  0.6.0.a19
Source.h
1 // Source.h
2 /***************************************************/
3 /*! \class Source
4  \brief Sound source class
5
6  This class implements a sound source, which consists
7  of a 1d signal and its own
8  directivity pattern and 3-d position properties.
9
10  by Tristan Matthews and Nils Peters, 2007-2008.
11  */
12 /***************************************************/
13
14 #ifndef _SOURCE_H_
15 #define _SOURCE_H_
16
17 #include "Moveable.h"
18 #include "Properties.h"
19
20 #include <vector>
21
22 class Room;
23 class Mirror;
24
25 class Source : public Moveable {
26  private:
27  long aziAngle_;
28  bool directivityFlag_;
29  Room &owner_;
30  Mirror *mirrors_;
31  std::vector<double> directivityTbl_;
32  void notifyRoom();
33  void init();
34  public:
35  //! Class constructor, taking the Room to which the source belongs, as well as a pointer to the acoustic mirrors for the room/source.
36  Source(Room &room, Mirror *mirrors);
37
38  //! Set directivity table to values obtained from the Max patch.
39  void updateDirectivity(long **tbl);
40
41  //! Retrieve directivity gain for a given angle.
42  double directivityAt(long angle) const;
43
44  //! Set x position in meters.
45  void xPosAbs(double xPos);
46
47  //! Set y position in meters.
48  void yPosAbs(double yPos);
49
50  //! Set z position in meters.
51  void zPosAbs(double zPos);
52
53  //! Set x position relative to room width (0.0 to 1.0).
54  void xPosRel(double xPos);
55
56  //! Set y position relative to room depth (0.0 to 1.0).
57  void yPosRel(double yPos);
58
59  //! Set z position relative to room height (0.0 to 1.0).
60  void zPosRel(double zPos);
61
62
63  //! True if the source's directivity is to be taken into account, false otherwise.
64  bool directivityFlag() const;
65
66  //! True if the source's directivity is to be taken into account, false otherwise.
67  void directivityFlag(bool flag);
68
69  //! Change azimuth angle, and those of all the mirrors.
70  void aziAngle(long angle);
71
72  //! Get azimuth angle.
73  long aziAngle() const;
74
75  //! Post xyz position.
76  virtual void printPos() const;
77
78  //! Class destructor.
79  virtual ~Source() {}
80 };
81
82 #endif
83 // vim:sw=4:et:cindent:
void updateDirectivity(long **tbl)
Set directivity table to values obtained from the Max patch.
Definition: Source.cpp:40
long aziAngle() const
Get azimuth angle.
Definition: Source.cpp:109
bool directivityFlag() const
True if the source's directivity is to be taken into account, false otherwise.
Definition: Source.cpp:192
virtual void printPos() const
Post xyz position.
Definition: Source.cpp:114
double xPos() const
Get x position.
Definition: Moveable.cpp:26
void yPosAbs(double yPos)
Set y position in meters.
Definition: Source.cpp:130
Source(Room &room, Mirror *mirrors)
Class constructor, taking the Room to which the source belongs, as well as a pointer to the acoustic ...
Definition: Source.cpp:26
virtual ~Source()
Class destructor.
Definition: Source.h:79
bool flag() const
True if object has moved.
Definition: Moveable.cpp:65
double directivityAt(long angle) const
Retrieve directivity gain for a given angle.
Definition: Source.cpp:53
void xPosAbs(double xPos)
Set x position in meters.
Definition: Source.cpp:119
double zPos() const
Get z position.
Definition: Moveable.cpp:52
void yPosRel(double yPos)
Set y position relative to room depth (0.0 to 1.0).
Definition: Source.cpp:163
Moveable class.
Definition: Moveable.h:18
void zPosRel(double zPos)
Set z position relative to room height (0.0 to 1.0).
Definition: Source.cpp:174
Sound mirror class.
Definition: Mirror.h:19
Sound source class.
Definition: Source.h:25
double yPos() const
Get y position.
Definition: Moveable.cpp:39
void zPosAbs(double zPos)
Set z position in meters.
Definition: Source.cpp:141
Room class.
Definition: Room.h:25
void xPosRel(double xPos)
Set x position relative to room width (0.0 to 1.0).
Definition: Source.cpp:152