DistanceSimulator.h

Go to the documentation of this file.
00001 //
00002 //  DistanceSimulator.h -- Specification of the DistanceSimulators
00003 //  See the copyright notice and acknowledgment of authors in the file COPYRIGHT
00004 //  Created by Jorge Castellanos on 6/23/06. Hacked 8/09 by STP.
00005 //
00006 
00007 #ifndef DISTANCE_SIMULATOR_H
00008 #define DISTANCE_SIMULATOR_H
00009 #include "SpatialSource.h"
00010 
00011 #include "CSL_Core.h"
00012 #include "CPoint.h"
00013 
00014 namespace csl {
00015 
00016 class IntensityAttenuationCue;
00017 class AirAbsorptionCue;
00018 
00023 
00024 class DistanceSimulator : public SpatialSource {
00025 public:
00026     DistanceSimulator(UnitGenerator &source); // A UGen without position information. In this case, the distance simulator is the spatial source.
00027     DistanceSimulator(SpatialSource &source);
00028     ~DistanceSimulator();
00029 
00030     virtual void nextBuffer(Buffer & outputBuffer, unsigned outBufNum) throw (CException);
00032     virtual bool positionChanged();
00033 
00034 protected:
00035                 // SoundSource ... it refers to its input UGen, but with the knowledge of its position within a space.
00036 //  SpatialSource *mSource;     // list of spatial inputs
00037     IntensityAttenuationCue *mIntensityCue;
00038     AirAbsorptionCue *mAirAbsorptionCue;
00039 
00040 }; 
00041 
00046 
00047 class DistanceCue {
00048 public:
00049     DistanceCue() { };
00050     virtual ~DistanceCue() { };
00051     
00052     virtual void compute(float distance) = 0;
00053     virtual void process(Buffer &inputBuffer) = 0;
00054 
00055 }; 
00056 
00059 
00060 class IntensityAttenuationCue : public DistanceCue {
00061 public:
00062     IntensityAttenuationCue() { };
00063     virtual ~IntensityAttenuationCue() { };
00064 
00065     virtual void compute(float distance);   
00066     virtual void process(Buffer &aBuffer);
00067     
00068 protected:  
00069     float mGain;
00070 
00071 };
00072 
00074 
00075 class AirAbsorptionCue : public DistanceCue {
00076 public:
00077     AirAbsorptionCue();
00078     virtual ~AirAbsorptionCue();
00079 
00080     virtual void compute(float distance); 
00081     virtual void process(Buffer &aBuffer); 
00082     
00083 protected:  
00084     float mBCoeff;
00085     float mACoeff[2];
00086     float mPrevOutput;
00087     float mPrevInput;
00088 
00089 };
00090 
00091 //class AirAbsorptionCue : public DistanceCue {
00092 //public:
00093 //  AirAbsorptionCue();
00094 //  virtual ~AirAbsorptionCue();
00095 //
00096 //  virtual void compute(float distance);   
00097 //  virtual void process(Buffer &aBuffer);
00098 //  
00099 //protected:    
00100 //  float mBCoeff[3];
00101 //  float mACoeff[3];
00102 //  float mPrevOutputs[3];
00103 //  float mPrevInputs[3];
00104 //
00105 //};
00106 
00107 }
00108 
00109 #endif

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