100{
102 const auto &dBMax = parameters.
mdBMax;
103 const auto &dBMin = parameters.mdBMin;
104 const auto &M = parameters.mM;
105 const auto &drawMode = parameters.mDrawMode;
106 const auto &drawGrid = parameters.mDrawGrid;
107 const auto &loFreq = parameters.mLoFreq;
108 const auto &hiFreq = parameters.mHiFreq;
109 const auto &windowSize = parameters.mWindowSize;
110 const auto &filterFuncR = parameters.mFilterFuncR;
111 const auto &filterFuncI = parameters.mFilterFuncI;
112
113 wxPaintDC dc(this);
114 int width, height;
115 GetSize(&width, &height);
116
118 {
122 }
123
124 wxBrush bkgndBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
125
126 wxMemoryDC memDC;
128
129 wxRect bkgndRect;
130 bkgndRect.x = 0;
131 bkgndRect.y = 0;
134 memDC.SetBrush(bkgndBrush);
135 memDC.SetPen(*wxTRANSPARENT_PEN);
136 memDC.DrawRectangle(bkgndRect);
137
139 memDC.DrawRectangle(bkgndRect);
140
141 wxRect border;
142 border.x = 0;
143 border.y = 0;
146
147 memDC.SetBrush(*wxWHITE_BRUSH);
148 memDC.SetPen(*wxBLACK_PEN);
149 memDC.DrawRectangle(border);
150
153
154
155 memDC.SetPen(wxPen(
theTheme.
Colour( clrGraphLines ), 1, wxPENSTYLE_SOLID));
156 int center = (int) (
mEnvRect.height * dBMax/(dBMax - dBMin) + .5);
160
161
162 if( drawGrid )
163 {
166 }
167
168
169 memDC.SetPen(wxPen(
theTheme.
Colour(clrGraphLines), 3, wxPENSTYLE_SOLID));
170
171
172 int x, y, xlast = 0, ylast = 0;
173 {
175 parameters.ChooseEnvelopeToPaint()
177 bool off = false, off1 = false;
178 for (
int i = 0; i <
mEnvRect.width; i++)
179 {
183 {
185 off = true;
186 }
187 else
188 {
189 off = false;
190 off1 = false;
191 }
192 if ((i != 0) & (!off1))
193 {
196 }
197 off1 = off;
198 xlast = x;
200 }
201 }
202
203
204
205 memDC.SetPen(wxPen(
theTheme.
Colour( clrResponseLines ), 1, wxPENSTYLE_SOLID));
206 double scale = (double)
mEnvRect.height/(dBMax - dBMin);
207 double yF;
208 double delta = hiFreq / (((double)windowSize / 2.));
209
210 bool lin = parameters.IsLinear();
211
212 double loLog = log10(loFreq);
213 double step = lin ? hiFreq : (log10(hiFreq) - loLog);
214 step /= ((double)
mEnvRect.width-1.);
215 double freq;
216 int halfM = (M - 1) / 2;
217 int n;
219 {
221 freq = lin ? step*i : pow(10., loLog + i*step);
222 if( ( lin ? step : (pow(10., loLog + (i+1)*step)-freq) ) < delta)
223 {
224
225 double theta =
M_PI*freq/hiFreq;
226 double wtemp = sin(0.5 * theta);
227 double wpr = -2.0 * wtemp * wtemp;
228 double wpi = -1.0 * sin(theta);
229 double wr = cos(theta*halfM);
230 double wi = sin(theta*halfM);
231
232 yF = 0.;
233 for(int j=0;j<halfM;j++)
234 {
235 yF += 2. *
mOutr[j] * wr;
236
237 wr = (wtemp = wr) * wpr - wi * wpi + wr;
238 wi = wi * wpr + wtemp * wpi + wi;
239 }
241 yF = fabs(yF);
242 if(yF!=0.)
244 else
245 yF = dBMin;
246 }
247 else
248 {
249 n = (int)(freq/delta + .5);
250 if(pow(filterFuncR[n],2)+pow(filterFuncI[n],2)!=0.)
251 yF = 10.0*log10(pow(filterFuncR[n],2)+pow(filterFuncI[n],2));
252 else
253 yF = dBMin;
254 }
255 if(yF < dBMin)
256 yF = dBMin;
257 yF = center-scale*yF;
260 if(yF<0.)
261 yF=0.;
262 y = (int)(yF+.5);
263
264 if (i != 0)
265 {
267 }
268 xlast = x;
270 }
271
272 memDC.SetPen(*wxBLACK_PEN);
273 if( drawMode )
274 {
276
277
278
280
281 artist.pZoomInfo = &zoomInfo;
285 dBMin, dBMax, false);
286 }
287
289}
static void Line(wxDC &dc, wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2)
static void DrawPoints(const Envelope &env, TrackPanelDrawingContext &context, const wxRect &r, bool dB, double dBRange, float zoomMin, float zoomMax, bool mirrored, int origin=0)
void DrawGrid(wxDC &dc, int length, bool minor=true, bool major=true, int xOffset=0, int yOffset=0) const
wxColour & Colour(int iIndex)
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...