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