00001 /* 00002 00003 HOA_AmbisonicEncoder.h -- Higher Order Ambisonic encoding class 00004 See the copyright notice and acknowledgment of authors in the file COPYRIGHT 00005 Higher Order Ambisonic classes written by Jorge Castellanos, Graham Wakefield, Florian Hollerweger, 2005 00006 00007 Higher Order Ambisonic class for positioning an arbitrary number of mono sound sources into an Ambisonic encoded soundfield. 00008 Multiple sound sources are fed to the encoder as a multichannel framestream. Their position information is fed to the 00009 encoder as two multichannel framestreams (azimuth and elevation). It is possible to specify either one uniform Ambisonic 00010 order or to define the horizontal and vertical order separately (hybrid order encoding). If no order(s) is/are specified, 00011 first order Ambisonic will be used (B-Format). 00012 00013 */ 00014 00015 #ifndef HOA_ENCODER_H 00016 #define HOA_ENCODER_H 00017 00018 #include "CSL_Core.h" 00019 #include "Variable.h" 00020 #include "CPoint.h" 00021 #include "HOA_Utilities.h" 00022 #include "HOA_AmbisonicFramestream.h" 00023 00024 namespace csl { 00025 00026 /* 00027 00028 CONVENTIONS USED IN THIS CODE: 00029 ------------------------------ 00030 00031 ***coordinate system*** 00032 Left oriented 00033 Azimuth = 0 on the x/z plane and increasing towards the positive y direction 00034 Elevation = 0 on x/y plane and increasing towards the positive z direction 00035 Internal angle representation: spherical radians 00036 00037 ***encoding convention*** 00038 following the Furse-Malham set (Ambisonic channel weighting for uniform energy distribution) 00039 00040 ***abbreviations used in code and comments*** 00041 M ... Ambisonic order (in uniform order system) 00042 M_h ... horizontal Ambisonic order (in hybrid order systems) 00043 M_v ... horizontal Ambisonic order (in hybrid order systems) 00044 N ... total number of Ambisonic encoded channels (horizontal and vertical) 00045 N_h ... number of horizontal Ambisonic channels (in hybrid order systems) 00046 N_v ... number of vertical Ambisonic channels (in hybrid order systems) 00047 L ... number of available loudspeakers 00048 00049 ***ordering and naming of Ambisonic channels = spherical harmonics*** 00050 These conventions follow the ones used in the thesis by Jerome Daniel. 00051 The 3rd order naming convention (which Daniel doesn't provide) follows the one used in the thesis of David Malham. 00052 Watch out for different conventions in other papers! 00053 index 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 00054 M (order) 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 00055 m (=M) 0 1 1 1 2 2 2 2 2 3 3 3 3 3 3 3 00056 n 0 1 1 0 2 2 1 1 0 3 3 2 2 1 1 0 00057 sigma '1' 1 -1 '1' 1 -1 1 -1 '1' 1 -1 1 -1 1 -1 '1' 00058 name W X Y Z U V S T R P Q N O L M K 00059 hor/vert/omni om h h v h h v v v h h v v v v v 00060 00061 */ 00062 00063 class HOA_Encoder : public FrameStream, public Processor, public HOA_AmbisonicFramestream { 00064 00065 private: 00066 00067 sample mAzimuth, mElevation; // the azimuth & elevation of the source to be encoded 00068 sample *mWeights; // encoding weights for each order (per source) 00069 unsigned mNumFrames; // blocksize 00070 sample *mInPtr; // pointer to input buffers (sound sources to be encoded) 00071 sample **mOutPtr; // pointer to Ambisonic encoded output buffers 00072 00073 protected: 00074 00075 Buffer *mInBuffer; // buffer for the input framestream (sound sources to be encoded) 00076 00077 public: 00078 00079 // Constructors & destructor: 00080 00081 // default constructor 00082 HOA_Encoder(); 00083 00084 // initialize with uniform Ambisonic order and static input sound sources 00085 HOA_Encoder(FrameStream &input, unsigned int order = 1, double azimuth = 0.f, double elevation = 0.f); 00086 00087 // initialize with hybrid Ambisonic order and static input sound sources 00088 HOA_Encoder(FrameStream &input, unsigned int horder, unsigned int vorder, double azimuth = 0.f, double elevation = 0.f); 00089 00090 // destructor 00091 ~HOA_Encoder(); 00092 00093 // setters for azimuth & elevation 00094 void setAzimuth(double azimuth) { mAzimuth = azimuth; }; 00095 void setElevation(double elevation) { mElevation = elevation; }; 00096 double azimuth() { return mAzimuth; }; 00097 double elevation() { return mElevation; }; 00098 00099 // initializing method called by constructors 00100 void initialize(FrameStream &input); 00101 00102 // Overriding Framestream::next_buffer(). Does the DSP processing for the Ambisonic Encoder. 00103 virtual status next_buffer(Buffer &inputBuffer, Buffer &outputBuffer); 00104 00105 }; 00106 00107 } 00108 00109 #endif
1.4.5-20051010