annotate Source/Decoder.h @ 8:d967dd1eafe8

Code update for effect and editor.
author martinm_home <martin.morrell@eecs.qmul.ac.uk>
date Sun, 16 Sep 2012 23:25:54 +0100
parents e85bd6381a58
children 53f99cbc5dbd
rev   line source
martin@0 1 /*
martin@0 2 * Decoder.h
martin@0 3 * SoundField
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@1 15 //Transforms & Zoom
martin@0 16 double Rotate; //+/-180 degrees
martin@0 17 double Tilt; //+/-180 degrees
martin@0 18 double Tumble; //+/-180 degrees
martin@0 19 double Zoom; //+/-100
martin@0 20 int ZoomMethod; //4 positions
martin@1 21
martin@1 22 //Decoder Speaker Layout
martin@1 23 int decoderMode; //Decoder mode, set to same as number of outputs
martin@8 24 int channelOrder; //Natural or 5.1 ordering
martin@1 25
martin@1 26 //Front Stereo Speaker Decoding & Reverb
martin@0 27 double Width; //0-90 degrees
martin@0 28 double Pattern; //0-1 Omni amount
martin@0 29 int Mode; //0 or 1 for xy or ms
martin@0 30 double RearVerb; //0-24dB
martin@0 31 double HiVerb; //0-24dB
martin@0 32 double outputL; //Left output
martin@0 33 double outputR; //Right output
martin@0 34
martin@1 35 //Centre Speaker Decoding
martin@0 36 double outputC; //Centre output
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@0 41 double outputS; //Subwoofer output
martin@1 42 double subGain; //Subwoofer gain
martin@0 43
martin@1 44 //Surround Speaker Decoding
martin@0 45 double outputSL; //Surround Left output
martin@0 46 double outputSR; //Surround Right output
martin@0 47 int surMode; //Rear mics mode
martin@0 48 double surPattern; //Rear mics pattern
martin@0 49 double surWidth; //Rear mics width
martin@0 50 double surGain; //Rear mics gain
martin@8 51 double output[6]; //Final Output
martin@0 52
martin@1 53
martin@0 54
martin@0 55
martin@1 56 //Filter Code for subwoofer
martin@1 57 int Fs; //Sample Rate
martin@1 58 int Fc; //Crossover Frequency
martin@1 59 double bLF[3]; //b Coefficients for Lower Frequency Band
martin@1 60 double bHF[3]; //b Coefficients for Higher Frequency Band
martin@1 61 double a[3]; //a Coefficients
martin@1 62 double prevInS[2]; //Previous Input LF Samples
martin@1 63 double prevOutS[2]; //Previous Output LF Samples
martin@1 64 double prevInw[2]; //Previous Input w Samples
martin@1 65 double prevOutw[2]; //Previous Output w Samples
martin@1 66 double prevInx[2]; //Previous Input x Samples
martin@1 67 double prevOutx[2]; //Previous Output x Samples
martin@1 68 double prevIny[2]; //Previous Input y Samples
martin@1 69 double prevOuty[2]; //Previous Output y Samples
martin@1 70 double prevInz[2]; //Previous Input z Samples
martin@1 71 double prevOutz[2]; //Previous Output z Samples
martin@0 72
martin@0 73 void clearFilter(); //Clears the previous filter values
martin@0 74
martin@0 75
martin@1 76 //Overall Decoding Functions
martin@8 77 int processDecoder(double &w, double &x, double &y, double &z); //Called fucntion to do the decoding
martin@8 78
martin@0 79
martin@0 80
martin@0 81 //private:
martin@0 82 double degRad(double angle); //Convert degreesto radians
martin@0 83 double radDeg(double angle); //Convert radians to degrees
martin@0 84
martin@0 85 //SoundField Rotations
martin@0 86 void rotateField(double &x, double &y);
martin@0 87 void tiltField(double &x, double &y);
martin@0 88 void tumbleField(double &x, double &y);
martin@0 89
martin@0 90 //Zoom Methods
martin@0 91 void dominanceZoom(double &w, double &x, double &y, double &z);
martin@0 92 void pressZoom(double &w, double &x, double &y, double &z);
martin@0 93 void pushZoom(double &w, double &x, double &y, double &z);
martin@0 94 void focusZoom(double &w, double &x, double &y, double &z);
martin@0 95
martin@0 96 //Stereo Decoders
martin@0 97 void xyDecode(double &w, double &x, double &y, double &z);
martin@0 98 void msDecode(double &w, double &x, double &y, double &z);
martin@0 99
martin@0 100 //Reverbs
martin@0 101 void rearVerb(double &w, double &x, double &y, double &z);
martin@0 102 void hiVerb(double &w, double &x, double &y, double &z);
martin@0 103
martin@0 104 //Surround
martin@0 105 void centreMic(double &w, double &x);
martin@0 106 void xySurDecode(double &w, double &x, double &y, double &z);
martin@0 107 void msSurDecode(double &w, double &x, double &y, double &z);
martin@0 108
martin@0 109 //Subwoofer
martin@0 110 void subSignal(double &w);
martin@0 111
martin@0 112 //Filter Code
martin@0 113 void filterCoefs();
martin@0 114 void filterLF();
martin@0 115 void filterHF(double &w, double &x, double &y, double &z);
martin@8 116
martin@8 117 //Decoder Types
martin@8 118 void monoDecoder(double &w, double &x, double &y, double &z); //Decode to mono
martin@8 119 void stereoDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
martin@8 120 void twoOneDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
martin@8 121 void quadDecoder(double &w, double &x, double &y, double &z); //Decode to LRCS
martin@8 122 void fiveDecoder(double &w, double &x, double &y, double &z); //Decode to 5.0
martin@8 123 void fiveOneDecoder(double &w, double &x, double &y, double &z); //Decode to 5.1
martin@0 124 };