ShoeBox.h

Go to the documentation of this file.
00001 //
00002 //  ShoeBox.h
00003 //  ShoeBox
00004 //
00005 //  Created by Jorge Castellanos & Will Wolcott on 4/29/05.
00006 //  Copyright 2005 Jorge Castellanos & Will Wolcott. All rights reserved.
00007 //
00008 
00009 
00010 #ifndef SHOEBOX_H
00011 #define SHOEBOX_H
00012 
00013 #include "CPoint.h"
00014 
00015 namespace csl {
00016 
00017 enum {
00018     kMarble = 0,        
00019     kConcrete,
00020     kBrick, 
00021     kGlass,
00022     kWood
00023 };
00024 
00025 //  This class calculates the reflection time and amplitude of a sound 
00026 //  assuming the space is rectangulsr, in other words, a shoe box.
00027 
00028 class ShoeBox {
00029 public:
00030     // Defaults to a listener positioned at the center of the room.
00031     ShoeBox();
00032     ~ShoeBox();
00033     
00034     void setSourceLocation(float x, float y, float z);
00035     void setListenerLocation(float x, float y, float z);
00036     void setRoomSize(float x, float y, float z);
00037     CPoint roomSize() { return mRoomSize; };
00038     CPoint source() { return mSource; };
00039     CPoint listener() { return mListenerPosition; };
00040     void setWallMaterialsDamp(int dampX, int dampY, int dampZ);
00041     void setDuration(int ms);
00042     void getReflections(float *ref, float *gains, float *angles, int num);
00043     void calculateReflections();
00044     void findNumReflectionsFromTime();  
00045     
00046 private:
00047     
00048     CPoint mRoomSize, mSource, mListenerPosition;
00049     float mDampX, mDampY,mDampZ;
00050     float *mReflectionsArray, *mGainsArray, *mAnglesArray;
00051     int mDuration, mNumReflections, mMaxBouncesX, mMaxBouncesY, mMaxBouncesZ;   // The miliseconds that will be calculated reflections.
00052 
00053     void shellSort();
00054     bool checkPositionValues();
00055 
00056 };
00057 
00058 
00059 }
00060 
00061 #endif

Generated on Thu Sep 17 23:14:16 2009 for CSL by  doxygen 1.5.8