25#include <wx/dcclient.h>
26#include <wx/dcmemory.h>
27#include <wx/settings.h>
30#include "../EnvelopeEditor.h"
33#include "../TrackArtist.h"
35#include "../widgets/RulerPanel.h"
54 , mCurvesList{ curvesList }
55 , mFreqRuler{ freqRuler }
58 auto ¶meters = mCurvesList.mParameters;
65 mLinEditor = std::make_unique<EnvelopeEditor>(
66 parameters.mLinEnvelope,
false);
67 mLogEditor = std::make_unique<EnvelopeEditor>(
68 parameters.mLogEnvelope,
false);
87 parameters.CalcFilter();
89 parameters.mFilterFuncR.get(),
90 parameters.mFilterFuncI.get(),
mOutr.get());
98#include "../TrackPanelDrawingContext.h"
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;
115 GetSize(&width, &height);
124 wxBrush bkgndBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
134 memDC.SetBrush(bkgndBrush);
135 memDC.SetPen(*wxTRANSPARENT_PEN);
136 memDC.DrawRectangle(bkgndRect);
139 memDC.DrawRectangle(bkgndRect);
147 memDC.SetBrush(*wxWHITE_BRUSH);
148 memDC.SetPen(*wxBLACK_PEN);
149 memDC.DrawRectangle(border);
155 memDC.SetPen(wxPen(
theTheme.
Colour( clrGraphLines ), 1, wxPENSTYLE_SOLID));
156 int center = (int) (
mEnvRect.height * dBMax/(dBMax - dBMin) + .5);
169 memDC.SetPen(wxPen(
theTheme.
Colour(clrGraphLines), 3, wxPENSTYLE_SOLID));
172 int x, y, xlast = 0, ylast = 0;
175 parameters.ChooseEnvelopeToPaint()
177 bool off =
false, off1 =
false;
178 for (
int i = 0; i <
mEnvRect.width; i++)
192 if ((i != 0) & (!off1))
205 memDC.SetPen(wxPen(
theTheme.
Colour( clrResponseLines ), 1, wxPENSTYLE_SOLID));
206 double scale = (double)
mEnvRect.height/(dBMax - dBMin);
208 double delta = hiFreq / (((double)windowSize / 2.));
210 bool lin = parameters.IsLinear();
212 double loLog = log10(loFreq);
213 double step = lin ? hiFreq : (log10(hiFreq) - loLog);
214 step /= ((double)
mEnvRect.width-1.);
216 int halfM = (M - 1) / 2;
221 freq = lin ? step*i : pow(10., loLog + i*step);
222 if( ( lin ? step : (pow(10., loLog + (i+1)*step)-freq) ) < delta)
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);
233 for(
int j=0;j<halfM;j++)
235 yF += 2. *
mOutr[j] * wr;
237 wr = (wtemp = wr) * wpr - wi * wpi + wr;
238 wi = wi * wpr + wtemp * wpi + wi;
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));
257 yF = center-scale*yF;
272 memDC.SetPen(*wxBLACK_PEN);
285 dBMin, dBMax,
false);
294 const auto &dBMax = parameters.
mdBMax;
295 const auto &dBMin = parameters.mdBMin;
296 const auto &drawMode = parameters.mDrawMode;
297 const auto &lin = parameters.mLin;
304 if (event.ButtonDown() && !HasCapture())
316 if (event.ButtonUp() && HasCapture())
void InverseRealFFT(size_t NumSamples, const float *RealIn, const float *ImagIn, float *RealOut)
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)
EqualizationPanel is used with EqualizationDialog and controls a graph for EffectEqualization....
void OnSize(wxSizeEvent &event)
EqualizationCurvesList & mCurvesList
void OnCaptureLost(wxMouseCaptureLostEvent &event)
void OnIdle(wxIdleEvent &event)
std::unique_ptr< wxBitmap > mBitmap
std::unique_ptr< EnvelopeEditor > mLinEditor
void OnMouseEvent(wxMouseEvent &event)
void OnPaint(wxPaintEvent &event)
std::unique_ptr< EnvelopeEditor > mLogEditor
void DrawGrid(wxDC &dc, int length, bool minor=true, bool major=true, int xOffset=0, int yOffset=0) const
RulerPanel class allows you to work with a Ruler like any other wxWindow.
wxColour & Colour(int iIndex)
This class handles the actual rendering of WaveTracks (both waveforms and spectra),...
Maintains a list of preset curves for Equalization effects.
EqualizationFilter & mParameters