-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathADSRVisualizationControl.h
38 lines (33 loc) · 1.03 KB
/
ADSRVisualizationControl.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include <vector>
#include "IControl.h"
class IPoint {
public:
double x;
double y;
bool operator < (const IPoint& point) const { return (this->x < point.x); };
bool operator >(const IPoint& point) const { return (this->x > point.x); };
};
class ADSRVisualizationControl : public IControl {
private:
IColor lineColor;
void initPoints();
float attack, sustain, decay, release;
IPoint startPoint, attackPoint, retainPoint, endPoint; //names should be changed.
void updatePointPosition();
protected:
double convertToGraphicX(double value);
double convertToPercentX(double value);
double convertToGraphicY(double value);
double convertToPercentY(double value);
public:
ADSRVisualizationControl(IPlugBase *pPlug, IRECT pR) : IControl(pPlug, pR),
lineColor(100, 0, 255, 0) {
initPoints();
};
~ADSRVisualizationControl() {};
void setColor(IColor color) { lineColor = color; };
void setADSR(float att, float dec, float sus, float rel);
//bool IsDirty() { return true; }; // Don't need this.
bool Draw(IGraphics *pGraphics);
};