GeConVerb.h

Go to the documentation of this file.
00001 //
00002 //  GeConvVerb.h --   CSL Geometry-based Convolving Reverberator Class
00003 //  See the copyright notice and acknowledgment of authors in the file COPYRIGHT
00004 //
00005 // This uses Brent Lehman's Auralizer classes (Geometer, Spatializer, LateReverb, and Convolver) 
00006 // to build a spatialized CSL FrameStream with a room model and source/listener positions.
00007 //
00008 #ifndef GeConvVerb_H
00009 #define GeConvVerb_H
00010 
00011 #include "CSL_Core.h"
00012 #include "Convolver.h"
00013 #include "Geometer.h"
00014 #include "LateReverb.h"
00015 #include "Spatializer.h"
00016 
00017 namespace csl {
00018 
00019 class GeConvVerb : public FrameStream, public Processor {
00020 
00021 protected:
00022     char * mRoomFileName, * hrtfDirName;
00023     float A, delta, rho, mix;
00024     Geometer * mGeometer;
00025     Spatializer * mSpatializerL;  // One spatializer for each ear
00026     Spatializer * mSpatializerR;
00027     LateReverb * mLateReverb;
00028     Convolver * mConvolverL;    // One convolver for each ear
00029     Convolver * mConvolverR;
00030     FanOut * mFanout;           // fan out on the input
00031     Joiner * mJoiner;
00032     Buffer * mLateIR;           // multichannel IR buffers
00033     Buffer * mFullIR;
00034     
00035 public:
00036     void load_room();
00037                             // change src/list positions; these zero-out the stored IR
00038     void set_source(float x, float y, float z);
00039     void set_ear(float x, float y, float z, float direction);
00040 
00041     void recompute_reverberator();      // work-horse method
00042     void start();
00043     void stop();
00044     
00045     status next_buffer(Buffer & inputBuffer, Buffer & outputBuffer);
00046 
00047 
00048 /* new flow
00049 
00050 // constructor
00051         <soundfile> <roomfile> <kemarpath> <absorption> <transfer> <density> <earlylatemix> <blocksize>
00052     delta = atof(argv[5]);
00053     rho = atof(argv[6]);
00054     mix = atof(argv[7]);
00055 
00056     geometer = new Geometer();
00057     printf("Parsing VRML file.\n");
00058     geometer->set_everything_using_VRML(argv[2]);
00059     if (!geometer->fileIsValid) {
00060         printf("Problem in file %s\n", argv[2]);
00061         exit(1);
00062     }
00063     latereverb = new LateReverb();
00064     latereverb->set_attributes(A, delta, rho, i/(float)CGestalt::sample_rate());
00065     late_ir = latereverb->get_IR();
00066     late_ir_length = latereverb->get_length();
00067     delete latereverb;
00068     latereverb = new LateReverb();
00069     latereverb->set_attributes(A, delta, rho, i/(float)CGestalt::sample_rate());
00070     late_ir2 = latereverb->get_IR();
00071     late_ir_length2 = latereverb->get_length();
00072 
00073 
00074 Processor::set_input() 
00075     FanOut fanout( * input, 2);     // fan out on the snd-file reader
00076 
00077 
00078 // work-horse method
00079 
00080 void recompute_reverberator();      
00081     Buffer * lEarlyIR;  // multichannel IR buffers
00082 
00083     spatializer->spatialize_reflections(soundrays, numrays, A);
00084 
00085     lEarlyIR.monoBuffers[0] = mSpatializerL->get_IR();
00086     lEarlyIR._numFrames = mSpatializerL->get_length();
00087 
00088     // Mixdown
00089     printf("Mixing early and late reverb.\n");
00090     mix newly computed early with cached late into member buffers
00091     Buffer * mLateIR;           // multichannel IR buffers
00092     Buffer * mFullIR;
00093 
00094 
00095 // Note, these have to flush the IR buffers so they'll get recomputed at the next request
00096 
00097 void set_source(float x, float y, float z);
00098 void set_ear(float x, float y, float z, float direction);
00099 
00100 
00101 start/stop messages
00102 
00103 // Instantiate the Convolver and give it the IR
00104     convolver = new Convolver(blocksize, ir_samples, full_ir_length, fanout);
00105     convolver2 = new Convolver(blocksize, ir_samples2, full_ir_length2, fanout);
00106 
00107     joiner = new Joiner(*convolver, *convolver2);
00108     convolver->init_and_start();
00109 e
00110 
00111 // next_buffer
00112 
00113 just call the input and the convolver
00114 
00115 
00116 */
00117 
00118 };
00119 
00120 }
00121 
00122 #endif
00123 

Generated on Fri Apr 6 20:18:13 2007 for CSL by  doxygen 1.4.5-20051010