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@9
|
23 int decoderMode; //Decoder mode
|
martin@8
|
24 int channelOrder; //Natural or 5.1 ordering
|
martin@9
|
25 int mode5x; //Hidden mode for 5.x decoders accessed by programs
|
martin@1
|
26
|
martin@1
|
27 //Front Stereo Speaker Decoding & Reverb
|
martin@0
|
28 double Width; //0-90 degrees
|
martin@0
|
29 double Pattern; //0-1 Omni amount
|
martin@0
|
30 int Mode; //0 or 1 for xy or ms
|
martin@0
|
31 double RearVerb; //0-24dB
|
martin@0
|
32 double HiVerb; //0-24dB
|
martin@0
|
33 double outputL; //Left output
|
martin@0
|
34 double outputR; //Right output
|
martin@0
|
35
|
martin@1
|
36 //Centre Speaker Decoding
|
martin@0
|
37 double outputC; //Centre output
|
martin@1
|
38 double centrePattern; //Centre mic pattern
|
martin@1
|
39 double centreGain; //Centre mic gain
|
martin@1
|
40
|
martin@1
|
41 //Subwoofer Signal
|
martin@0
|
42 double outputS; //Subwoofer output
|
martin@1
|
43 double subGain; //Subwoofer gain
|
martin@0
|
44
|
martin@1
|
45 //Surround Speaker Decoding
|
martin@0
|
46 double outputSL; //Surround Left output
|
martin@0
|
47 double outputSR; //Surround Right output
|
martin@0
|
48 int surMode; //Rear mics mode
|
martin@0
|
49 double surPattern; //Rear mics pattern
|
martin@0
|
50 double surWidth; //Rear mics width
|
martin@0
|
51 double surGain; //Rear mics gain
|
martin@8
|
52 double output[6]; //Final Output
|
martin@0
|
53
|
martin@1
|
54
|
martin@0
|
55
|
martin@0
|
56
|
martin@1
|
57 //Filter Code for subwoofer
|
martin@1
|
58 int Fs; //Sample Rate
|
martin@1
|
59 int Fc; //Crossover Frequency
|
martin@1
|
60 double bLF[3]; //b Coefficients for Lower Frequency Band
|
martin@1
|
61 double bHF[3]; //b Coefficients for Higher Frequency Band
|
martin@1
|
62 double a[3]; //a Coefficients
|
martin@1
|
63 double prevInS[2]; //Previous Input LF Samples
|
martin@1
|
64 double prevOutS[2]; //Previous Output LF Samples
|
martin@1
|
65 double prevInw[2]; //Previous Input w Samples
|
martin@1
|
66 double prevOutw[2]; //Previous Output w Samples
|
martin@1
|
67 double prevInx[2]; //Previous Input x Samples
|
martin@1
|
68 double prevOutx[2]; //Previous Output x Samples
|
martin@1
|
69 double prevIny[2]; //Previous Input y Samples
|
martin@1
|
70 double prevOuty[2]; //Previous Output y Samples
|
martin@1
|
71 double prevInz[2]; //Previous Input z Samples
|
martin@1
|
72 double prevOutz[2]; //Previous Output z Samples
|
martin@0
|
73
|
martin@0
|
74 void clearFilter(); //Clears the previous filter values
|
martin@0
|
75
|
martin@0
|
76
|
martin@1
|
77 //Overall Decoding Functions
|
martin@8
|
78 int processDecoder(double &w, double &x, double &y, double &z); //Called fucntion to do the decoding
|
martin@8
|
79
|
martin@0
|
80
|
martin@0
|
81
|
martin@0
|
82 //private:
|
martin@0
|
83 double degRad(double angle); //Convert degreesto radians
|
martin@0
|
84 double radDeg(double angle); //Convert radians to degrees
|
martin@0
|
85
|
martin@0
|
86 //SoundField Rotations
|
martin@0
|
87 void rotateField(double &x, double &y);
|
martin@0
|
88 void tiltField(double &x, double &y);
|
martin@0
|
89 void tumbleField(double &x, double &y);
|
martin@0
|
90
|
martin@0
|
91 //Zoom Methods
|
martin@0
|
92 void dominanceZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
93 void pressZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
94 void pushZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
95 void focusZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
96
|
martin@0
|
97 //Stereo Decoders
|
martin@0
|
98 void xyDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
99 void msDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
100
|
martin@0
|
101 //Reverbs
|
martin@0
|
102 void rearVerb(double &w, double &x, double &y, double &z);
|
martin@0
|
103 void hiVerb(double &w, double &x, double &y, double &z);
|
martin@0
|
104
|
martin@0
|
105 //Surround
|
martin@0
|
106 void centreMic(double &w, double &x);
|
martin@0
|
107 void xySurDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
108 void msSurDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
109
|
martin@0
|
110 //Filter Code
|
martin@0
|
111 void filterCoefs();
|
martin@11
|
112 void filterLF(double &w);
|
martin@0
|
113 void filterHF(double &w, double &x, double &y, double &z);
|
martin@8
|
114
|
martin@8
|
115 //Decoder Types
|
martin@8
|
116 void monoDecoder(double &w, double &x, double &y, double &z); //Decode to mono
|
martin@8
|
117 void stereoDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
|
martin@8
|
118 void twoOneDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
|
martin@8
|
119 void quadDecoder(double &w, double &x, double &y, double &z); //Decode to LRCS
|
martin@8
|
120 void fiveDecoder(double &w, double &x, double &y, double &z); //Decode to 5.0
|
martin@8
|
121 void fiveOneDecoder(double &w, double &x, double &y, double &z); //Decode to 5.1
|
martin@9
|
122 void heller1(double &w, double &x, double &y, double &z);
|
martin@9
|
123 void heller2(double &w, double &x, double &y, double &z);
|
martin@9
|
124 void craven(double &w, double &x, double &y, double &z);
|
martin@0
|
125 }; |