annotate Source/Decoder.h @ 13:989865d55c73 tip

Commit.
author martinm_home <martin.morrell@eecs.qmul.ac.uk>
date Thu, 27 Sep 2012 23:30:29 +0100
parents 87dc3d84c120
children
rev   line source
martin@0 1 /*
martin@0 2 * Decoder.h
martin@12 3 * ClassicAmbiDec
martin@0 4 *
martin@0 5 * Created by Martin Morrell on 14/06/2012.
martin@0 6 * Copyright 2012 Queen Mary University of London. All rights reserved.
martin@0 7 *
martin@0 8 */
martin@0 9
martin@0 10
martin@0 11 class Decoder
martin@0 12 {
martin@0 13 friend class MyEditor;
martin@0 14 public:
martin@12 15 Decoder();
martin@12 16
martin@1 17 //Transforms & Zoom
martin@0 18 double Rotate; //+/-180 degrees
martin@0 19 double Tilt; //+/-180 degrees
martin@0 20 double Tumble; //+/-180 degrees
martin@0 21 double Zoom; //+/-100
martin@0 22 int ZoomMethod; //4 positions
martin@1 23
martin@1 24 //Decoder Speaker Layout
martin@9 25 int decoderMode; //Decoder mode
martin@8 26 int channelOrder; //Natural or 5.1 ordering
martin@9 27 int mode5x; //Hidden mode for 5.x decoders accessed by programs
martin@1 28
martin@1 29 //Front Stereo Speaker Decoding & Reverb
martin@0 30 double Width; //0-90 degrees
martin@0 31 double Pattern; //0-1 Omni amount
martin@0 32 int Mode; //0 or 1 for xy or ms
martin@0 33 double RearVerb; //0-24dB
martin@0 34 double HiVerb; //0-24dB
martin@0 35
martin@1 36 //Centre Speaker Decoding
martin@1 37 double centrePattern; //Centre mic pattern
martin@1 38 double centreGain; //Centre mic gain
martin@1 39
martin@1 40 //Subwoofer Signal
martin@1 41 double subGain; //Subwoofer gain
martin@0 42
martin@1 43 //Surround Speaker Decoding
martin@0 44 int surMode; //Rear mics mode
martin@0 45 double surPattern; //Rear mics pattern
martin@0 46 double surWidth; //Rear mics width
martin@0 47 double surGain; //Rear mics gain
martin@0 48
martin@12 49 //Filter Code
martin@1 50 int Fs; //Sample Rate
martin@1 51 int Fc; //Crossover Frequency
martin@0 52 void clearFilter(); //Clears the previous filter values
martin@12 53 void filterCoefs(); //Calculates the filter coefficients
martin@0 54
martin@1 55 //Overall Decoding Functions
martin@12 56 double output[6]; //Final Output
martin@8 57 int processDecoder(double &w, double &x, double &y, double &z); //Called fucntion to do the decoding
martin@8 58
martin@0 59
martin@0 60
martin@12 61 private:
martin@12 62 //Conversion Functions
martin@0 63 double degRad(double angle); //Convert degreesto radians
martin@0 64 double radDeg(double angle); //Convert radians to degrees
martin@0 65
martin@12 66 //Sound Field Rotations
martin@0 67 void rotateField(double &x, double &y);
martin@0 68 void tiltField(double &x, double &y);
martin@0 69 void tumbleField(double &x, double &y);
martin@0 70
martin@0 71 //Zoom Methods
martin@0 72 void dominanceZoom(double &w, double &x, double &y, double &z);
martin@0 73 void pressZoom(double &w, double &x, double &y, double &z);
martin@0 74 void pushZoom(double &w, double &x, double &y, double &z);
martin@0 75 void focusZoom(double &w, double &x, double &y, double &z);
martin@0 76
martin@0 77 //Stereo Decoders
martin@0 78 void xyDecode(double &w, double &x, double &y, double &z);
martin@0 79 void msDecode(double &w, double &x, double &y, double &z);
martin@0 80
martin@0 81 //Reverbs
martin@0 82 void rearVerb(double &w, double &x, double &y, double &z);
martin@0 83 void hiVerb(double &w, double &x, double &y, double &z);
martin@0 84
martin@0 85 //Surround
martin@0 86 void centreMic(double &w, double &x);
martin@0 87 void xySurDecode(double &w, double &x, double &y, double &z);
martin@0 88 void msSurDecode(double &w, double &x, double &y, double &z);
martin@0 89
martin@0 90 //Filter Code
martin@11 91 void filterLF(double &w);
martin@0 92 void filterHF(double &w, double &x, double &y, double &z);
martin@12 93 double bLF[3]; //b Coefficients for Lower Frequency Band
martin@12 94 double bHF[3]; //b Coefficients for Higher Frequency Band
martin@12 95 double a[3]; //a Coefficients
martin@12 96 double prevInS[2]; //Previous Input LF Samples
martin@12 97 double prevOutS[2]; //Previous Output LF Samples
martin@12 98 double prevInw[2]; //Previous Input w Samples
martin@12 99 double prevOutw[2]; //Previous Output w Samples
martin@12 100 double prevInx[2]; //Previous Input x Samples
martin@12 101 double prevOutx[2]; //Previous Output x Samples
martin@12 102 double prevIny[2]; //Previous Input y Samples
martin@12 103 double prevOuty[2]; //Previous Output y Samples
martin@12 104 double prevInz[2]; //Previous Input z Samples
martin@12 105 double prevOutz[2]; //Previous Output z Samples
martin@8 106
martin@8 107 //Decoder Types
martin@12 108 void monoDecoder(double &w, double &x, double &y, double &z); //Decode to mono, implemented but not used
martin@8 109 void stereoDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
martin@8 110 void twoOneDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
martin@8 111 void quadDecoder(double &w, double &x, double &y, double &z); //Decode to LRCS
martin@8 112 void fiveDecoder(double &w, double &x, double &y, double &z); //Decode to 5.0
martin@8 113 void fiveOneDecoder(double &w, double &x, double &y, double &z); //Decode to 5.1
martin@9 114 void heller1(double &w, double &x, double &y, double &z);
martin@9 115 void heller2(double &w, double &x, double &y, double &z);
martin@12 116 double outputL; //Left output
martin@12 117 double outputR; //Right output
martin@12 118 double outputC; //Centre output
martin@12 119 double outputS; //Subwoofer output
martin@12 120 double outputSL; //Surround Left output
martin@12 121 double outputSR; //Surround Right output
martin@0 122 };