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@0
|
15 double Rotate; //+/-180 degrees
|
martin@0
|
16 double Tilt; //+/-180 degrees
|
martin@0
|
17 double Tumble; //+/-180 degrees
|
martin@0
|
18 double Zoom; //+/-100
|
martin@0
|
19 int ZoomMethod; //4 positions
|
martin@0
|
20 double Width; //0-90 degrees
|
martin@0
|
21 double Pattern; //0-1 Omni amount
|
martin@0
|
22 int Mode; //0 or 1 for xy or ms
|
martin@0
|
23 double RearVerb; //0-24dB
|
martin@0
|
24 double HiVerb; //0-24dB
|
martin@0
|
25
|
martin@0
|
26 double temp; //temp for rotations
|
martin@0
|
27 double temp2[4]; //temp for zooming
|
martin@0
|
28
|
martin@0
|
29 double outputL; //Left output
|
martin@0
|
30 double outputR; //Right output
|
martin@0
|
31
|
martin@0
|
32 double outputC; //Centre output
|
martin@0
|
33 double outputS; //Subwoofer output
|
martin@0
|
34
|
martin@0
|
35 double outputSL; //Surround Left output
|
martin@0
|
36 double outputSR; //Surround Right output
|
martin@0
|
37
|
martin@0
|
38 int surMode; //Rear mics mode
|
martin@0
|
39 double surPattern; //Rear mics pattern
|
martin@0
|
40 double surWidth; //Rear mics width
|
martin@0
|
41 double surGain; //Rear mics gain
|
martin@0
|
42
|
martin@0
|
43 double centreOrder; //Centre mic order
|
martin@0
|
44 double centrePattern; //Centre mic pattern
|
martin@0
|
45 double centreGain; //Centre mic gain
|
martin@0
|
46
|
martin@0
|
47 double subGain; //Subwoofer gain
|
martin@0
|
48
|
martin@0
|
49 int decoderMode; //Decoder mode, set to same as number of outputs
|
martin@0
|
50
|
martin@0
|
51 //Filter Code
|
martin@0
|
52 int Fs;
|
martin@0
|
53 int Fc;
|
martin@0
|
54 double bLF[3];
|
martin@0
|
55 double bHF[3];
|
martin@0
|
56 double a[3];
|
martin@0
|
57 double prevIn[2];
|
martin@0
|
58 double prevOut[2];
|
martin@0
|
59 double prevInw[2];
|
martin@0
|
60 double prevOutw[2];
|
martin@0
|
61 double prevInx[2];
|
martin@0
|
62 double prevOutx[2];
|
martin@0
|
63 double prevIny[2];
|
martin@0
|
64 double prevOuty[2];
|
martin@0
|
65 double prevInz[2];
|
martin@0
|
66 double prevOutz[2];
|
martin@0
|
67
|
martin@0
|
68 void clearFilter(); //Clears the previous filter values
|
martin@0
|
69
|
martin@0
|
70
|
martin@0
|
71 //Overall Function
|
martin@0
|
72 void monoDecoder(double &w, double &x, double &y, double &z); //Decode to mono
|
martin@0
|
73 void stereoDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
|
martin@0
|
74 void twoOneDecoder(double &w, double &x, double &y, double &z); //Decode to stereo
|
martin@0
|
75 void lrcsDecoder(double &w, double &x, double &y, double &z); //Decode to LRCS
|
martin@0
|
76 void fiveDecoder(double &w, double &x, double &y, double &z); //Decode to 5.0
|
martin@0
|
77 void fiveOneDecoder(double &w, double &x, double &y, double &z); //Decode to 5.1
|
martin@0
|
78
|
martin@0
|
79
|
martin@0
|
80 //private:
|
martin@0
|
81 double degRad(double angle); //Convert degreesto radians
|
martin@0
|
82 double radDeg(double angle); //Convert radians to degrees
|
martin@0
|
83
|
martin@0
|
84 //SoundField Rotations
|
martin@0
|
85 void rotateField(double &x, double &y);
|
martin@0
|
86 void tiltField(double &x, double &y);
|
martin@0
|
87 void tumbleField(double &x, double &y);
|
martin@0
|
88
|
martin@0
|
89 //Zoom Methods
|
martin@0
|
90 void dominanceZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
91 void pressZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
92 void pushZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
93 void focusZoom(double &w, double &x, double &y, double &z);
|
martin@0
|
94
|
martin@0
|
95 //Stereo Decoders
|
martin@0
|
96 void xyDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
97 void msDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
98
|
martin@0
|
99 //Reverbs
|
martin@0
|
100 void rearVerb(double &w, double &x, double &y, double &z);
|
martin@0
|
101 void hiVerb(double &w, double &x, double &y, double &z);
|
martin@0
|
102
|
martin@0
|
103 //Surround
|
martin@0
|
104 void centreMic(double &w, double &x);
|
martin@0
|
105 void xySurDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
106 void msSurDecode(double &w, double &x, double &y, double &z);
|
martin@0
|
107
|
martin@0
|
108 //Subwoofer
|
martin@0
|
109 void subSignal(double &w);
|
martin@0
|
110
|
martin@0
|
111 //Filter Code
|
martin@0
|
112 void filterCoefs();
|
martin@0
|
113 void filterLF();
|
martin@0
|
114 void filterHF(double &w, double &x, double &y, double &z);
|
martin@0
|
115 }; |