martin@0: /* martin@0: * Decoder.h martin@12: * ClassicAmbiDec martin@0: * martin@0: * Created by Martin Morrell on 14/06/2012. martin@0: * Copyright 2012 Queen Mary University of London. All rights reserved. martin@0: * martin@0: */ martin@0: martin@0: martin@0: class Decoder martin@0: { martin@0: friend class MyEditor; martin@0: public: martin@12: Decoder(); martin@12: martin@1: //Transforms & Zoom martin@0: double Rotate; //+/-180 degrees martin@0: double Tilt; //+/-180 degrees martin@0: double Tumble; //+/-180 degrees martin@0: double Zoom; //+/-100 martin@0: int ZoomMethod; //4 positions martin@1: martin@1: //Decoder Speaker Layout martin@9: int decoderMode; //Decoder mode martin@8: int channelOrder; //Natural or 5.1 ordering martin@9: int mode5x; //Hidden mode for 5.x decoders accessed by programs martin@1: martin@1: //Front Stereo Speaker Decoding & Reverb martin@0: double Width; //0-90 degrees martin@0: double Pattern; //0-1 Omni amount martin@0: int Mode; //0 or 1 for xy or ms martin@0: double RearVerb; //0-24dB martin@0: double HiVerb; //0-24dB martin@0: martin@1: //Centre Speaker Decoding martin@1: double centrePattern; //Centre mic pattern martin@1: double centreGain; //Centre mic gain martin@1: martin@1: //Subwoofer Signal martin@1: double subGain; //Subwoofer gain martin@0: martin@1: //Surround Speaker Decoding martin@0: int surMode; //Rear mics mode martin@0: double surPattern; //Rear mics pattern martin@0: double surWidth; //Rear mics width martin@0: double surGain; //Rear mics gain martin@0: martin@12: //Filter Code martin@1: int Fs; //Sample Rate martin@1: int Fc; //Crossover Frequency martin@0: void clearFilter(); //Clears the previous filter values martin@12: void filterCoefs(); //Calculates the filter coefficients martin@0: martin@1: //Overall Decoding Functions martin@12: double output[6]; //Final Output martin@8: int processDecoder(double &w, double &x, double &y, double &z); //Called fucntion to do the decoding martin@8: martin@0: martin@0: martin@12: private: martin@12: //Conversion Functions martin@0: double degRad(double angle); //Convert degreesto radians martin@0: double radDeg(double angle); //Convert radians to degrees martin@0: martin@12: //Sound Field Rotations martin@0: void rotateField(double &x, double &y); martin@0: void tiltField(double &x, double &y); martin@0: void tumbleField(double &x, double &y); martin@0: martin@0: //Zoom Methods martin@0: void dominanceZoom(double &w, double &x, double &y, double &z); martin@0: void pressZoom(double &w, double &x, double &y, double &z); martin@0: void pushZoom(double &w, double &x, double &y, double &z); martin@0: void focusZoom(double &w, double &x, double &y, double &z); martin@0: martin@0: //Stereo Decoders martin@0: void xyDecode(double &w, double &x, double &y, double &z); martin@0: void msDecode(double &w, double &x, double &y, double &z); martin@0: martin@0: //Reverbs martin@0: void rearVerb(double &w, double &x, double &y, double &z); martin@0: void hiVerb(double &w, double &x, double &y, double &z); martin@0: martin@0: //Surround martin@0: void centreMic(double &w, double &x); martin@0: void xySurDecode(double &w, double &x, double &y, double &z); martin@0: void msSurDecode(double &w, double &x, double &y, double &z); martin@0: martin@0: //Filter Code martin@11: void filterLF(double &w); martin@0: void filterHF(double &w, double &x, double &y, double &z); martin@12: double bLF[3]; //b Coefficients for Lower Frequency Band martin@12: double bHF[3]; //b Coefficients for Higher Frequency Band martin@12: double a[3]; //a Coefficients martin@12: double prevInS[2]; //Previous Input LF Samples martin@12: double prevOutS[2]; //Previous Output LF Samples martin@12: double prevInw[2]; //Previous Input w Samples martin@12: double prevOutw[2]; //Previous Output w Samples martin@12: double prevInx[2]; //Previous Input x Samples martin@12: double prevOutx[2]; //Previous Output x Samples martin@12: double prevIny[2]; //Previous Input y Samples martin@12: double prevOuty[2]; //Previous Output y Samples martin@12: double prevInz[2]; //Previous Input z Samples martin@12: double prevOutz[2]; //Previous Output z Samples martin@8: martin@8: //Decoder Types martin@12: void monoDecoder(double &w, double &x, double &y, double &z); //Decode to mono, implemented but not used martin@8: void stereoDecoder(double &w, double &x, double &y, double &z); //Decode to stereo martin@8: void twoOneDecoder(double &w, double &x, double &y, double &z); //Decode to stereo martin@8: void quadDecoder(double &w, double &x, double &y, double &z); //Decode to LRCS martin@8: void fiveDecoder(double &w, double &x, double &y, double &z); //Decode to 5.0 martin@8: void fiveOneDecoder(double &w, double &x, double &y, double &z); //Decode to 5.1 martin@9: void heller1(double &w, double &x, double &y, double &z); martin@9: void heller2(double &w, double &x, double &y, double &z); martin@12: double outputL; //Left output martin@12: double outputR; //Right output martin@12: double outputC; //Centre output martin@12: double outputS; //Subwoofer output martin@12: double outputSL; //Surround Left output martin@12: double outputSR; //Surround Right output martin@0: };