21 #include "Properties.h"
26 extern bool globWarningFlag;
27 extern bool globReportFlag;
29 Room::Room(
double newWidth,
double newDepth,
double newHeight,
short numChannels,
short numSources,
short newReflOrder) :
33 numMics_(numChannels),
34 reflOrder_(newReflOrder),
36 filtersPerMic_(reflOrder_ *
Properties::NUMWALLS),
45 if (reflOrder_ < 0 || reflOrder_ > 3)
47 post(
"Invalid reflection order, defaulting to 2.");
50 numRefls = Properties::REFLECTIONS_PER_REFLECTION_ORDER[reflOrder_];
55 for (
int i = 0; i < numRefls; i++)
57 if (i == Properties::DIRECT)
59 else if (i <= Properties::NUMWALLS)
67 filtersPerMic_ = (reflOrder_ * Properties::NUMWALLS);
77 for (
int i = 0; i < numMics_; i++)
91 for (
int n = 0; n < numMics_; n++)
109 void Room::printWalls()
111 for (
int m = 0; m < numMics_; m++)
113 for (
int n = 0; n < filtersPerMic_; n++)
115 post(
"Mic[%d], wall[%d]: ", m, n);
123 post(
"Width: %f, Depth %f, Height %f", width_, depth_, height_);
136 if (newWidth <= Properties::MAX_ROOM_DIM &&
sources[0].checkWidth(newWidth) &&
mics.
checkWidth(newWidth))
143 post(
"/RoomWidth= %f", width_);
145 else if (globWarningFlag)
146 post(
"bad value for Room Width: %f", newWidth);
151 if (newHeight <= Properties::MAX_ROOM_DIM &&
sources[0].checkHeight(newHeight) &&
mics.
checkHeight(newHeight))
158 post(
"/RoomHeight = %f", width_);
160 else if (globWarningFlag)
161 post(
"bad value for Room height: %f", newHeight);
166 if (newDepth <= Properties::MAX_ROOM_DIM &&
sources[0].checkDepth(newDepth) &&
mics.
checkDepth(newDepth))
173 post(
"/RoomDepth = %f", depth_);
175 else if (globWarningFlag)
176 post(
"bad value for Room depth: %f", newDepth);
206 return height_ * 0.5;
MicArray mics
Collection of mics.
virtual void print() const
Prints information about this filter.
Source * sources
Sound source.
short reflOrder() const
Get reflection order (either 0, 1 or 2).
void sourceChanged()
Allows source to notify mirror that it has changed.
void print()
Print information about this room and its contents.
LowPass * xfadeAir
Filters which simulate air absorption for XFADE_LITE mode.
double depth() const
Get depth.
double xPos() const
Get x position.
bool flag() const
Returns true if the mic array has changed, false otherwise.
double halfWidth() const
Get half width.
bool checkDepth(double newDepth)
Checks that new room depth will not exclude any mics.
bool checkHeight(double newHeight)
Checks that new room height will not exclude any mics.
double width() const
Get width.
bool flag() const
True if object has moved.
LowPass ** air
Filters which simulate air absorption.
double zPos() const
Get z position.
Room(double newWidth, double newDepth, double newHeight, short numChannels, short numSources, short reflOrder)
Class constructor.
double height() const
Get height.
double halfDepth() const
Get half depth.
short order() const
Get order.
bool mirrorFlag() const
Returns true if mirrors have changed.
Mirror * mirrors
Sound mirrors.
bool checkWidth(double newWidth)
Checks that new room width will not exclude any mics.
double yPos() const
Get y position.
double halfHeight() const
Get half height.
HiMidLow ** walls
Filters which simulate room damping.
HiMidLow ** xfadeWalls
Filters which simulate room damping for XFADE_LITE mode.
void renderMirrors()
Update mirrors.