7 #include "Properties.h"
13 extern bool globReportFlag;
15 int MicArray::AziAngle[Properties::MAXNUMCHANNELS][Properties::MAXNUMCHANNELS] = {
16 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
17 {-30,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
18 {-30,0,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
19 {-135,-45,45,135,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
20 {-110,-30,0,30,110,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
21 {-110,-30,0,30,110,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
22 {-110,-30,0,30,110,180,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
23 {0,45,90,135,180,-135,-90,-45,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
24 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
25 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
26 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
27 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
28 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
29 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
30 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
32 {0,22,45,67,90,112,135,157,180,-157,-135,-112,-90,-67,-45,-22,0,0,0,0,0,0,0,0},
34 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
35 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
36 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
38 {-157,-135,-112,-90,-67,-45,-22,0,22,45,67,90,112,135,157,180,-135,-45,45,135,0,0,0,0},
39 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
40 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
41 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
42 {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
52 if (initNumChannels <= Properties::MAXNUMCHANNELS && initNumChannels > 0)
53 numChannels_ = initNumChannels;
57 for (
int i = 0; i < numChannels_; i++)
58 mics.push_back(
Mic(0.0, 0.0, 0.0, AziAngle[numChannels_ - 1][i], 0.0));
66 centerLR_ = newCenterLR;
72 centerFB_ = newCenterFB;
78 centerUD_ = newCenterUD;
84 centerDistance_ = newCenterDistance;
91 for (
int m = 0; m < numChannels_; m++)
103 mics[m].xPos(centerLR_ + sin((
double) temp) * centerDistance_);
104 mics[m].yPos(centerFB_ + cos((
double) temp) * centerDistance_);
105 mics[m].zPos(centerUD_);
106 mics[m].azi(AziAngle[numChannels_ - 1][m]);
113 assert(index >= 0 && index < numChannels_);
120 assert(index >= 0 && index < numChannels_);
125 {
double rad2deg_ = 180.0/
kTTPi;
126 post(
"Number of Channels: %d", numChannels_);
127 post(
"Mic Array Center: %f, %f, %f, Distance: %f", centerLR_, centerFB_, centerUD_, centerDistance_);
129 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++, m++)
131 post(
"Mic %d: Pos: %f, %f, %f ::::: Orientation: %f azimuth, %f elevation", m + 1, iter->xPos(), iter->yPos(), iter->zPos(), iter->azi()*rad2deg_, iter->ele()*rad2deg_);
132 post(
"Directivitiy: %f, DirPow: %f, DisPow: %f", iter->dirGainA(), iter->dirPow(), -1.0*iter->distPow());
138 if (b > 0 && b <= numChannels_)
146 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
147 iter->distPow(newDistPow);
153 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
154 iter->dbUnit(newDbUnit);
160 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
161 iter->dirGainA(newDirGain);
167 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
174 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
175 iter->dirPow(newDirPow);
181 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
188 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
195 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
202 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
209 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
226 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
228 if (!iter->checkWidth(newWidth))
236 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
238 if (!iter->checkDepth(newDepth))
246 for (std::vector<Mic>::iterator iter = mics.begin(); iter != mics.end(); iter++)
248 if (!iter->checkHeight(newHeight))
~MicArray()
Class destructor.
void distPow(double pow)
Sets all of the MicArray's mics' distance powers.
static const double PI_X_180
Constant to convert degrees to radians.
void dirPow(double pow)
Sets all of the MicArray's mics' directivity powers.
void centerUD(double newCenterUD)
Set center in z.
void dirGain(double gain)
Sets all of the MicArray's mics' directivity gains.
short numChannels() const
Returns the size of the mic array.
void azi(double azi)
Sets all of the MicArray's mics' azimuth angles.
void ele(double ele)
Sets all of the MicArray's mics' elevation angles.
void xPos(double x)
Sets all of the MicArray's mics' x positions to x.
bool flag() const
Returns true if the mic array has changed, false otherwise.
bool checkDepth(double newDepth)
Checks that new room depth will not exclude any mics.
MicArray(short numMics)
Class constructor.
bool validChannel(short channelNum=8)
True if the channel num >= 0 and < the total number of channels.
bool checkHeight(double newHeight)
Checks that new room height will not exclude any mics.
Jamoma's lowest-level base class and related infrastructure.
void centerDistance(double rad)
Set mic array's radius.
void gain(double gain)
Sets all of the MicArray's mics' gain.
void renderMics()
Updates all mics.
void renderMic(int mic)
Updates the specified mic.
Mic & operator[](const int idx)
Returns the mic at the given index.
void zPos(double z)
Sets all of the MicArray's mics' z positions to z.
void centerFB(double newCenterFB)
Set center in y.
void centerLR(double newCenterLR)
Set center in x.
void yPos(double y)
Sets all of the MicArray's mics' y positions to y.
TTFOUNDATION_EXPORT const TTFloat64 kTTPi
[doxygenAppendixC_constExample]
bool checkWidth(double newWidth)
Checks that new room width will not exclude any mics.
void dbUnit(double dbUnit)
Sets all of the MicArray's mics' dB unit.
void print()
Prints information about all of the mics.