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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
|
void __fastcall TFEnvelope::OnPaintGraph(TObject *Sender)
{
PBGraph->Canvas->Brush->Color = clSilver;
PBGraph->Canvas->Rectangle(0, 0, PBGraph->Width, PBGraph->Height);
PBGraph->Canvas->Pen->Color = clBlack;
PBGraph->Canvas->PenPos = TPoint(4, 5);
PBGraph->Canvas->LineTo(PBGraph->Width - 5, 5);
PBGraph->Canvas->PenPos = TPoint(4, 5);
PBGraph->Canvas->LineTo(4, PBGraph->Height - 5);
PBGraph->Canvas->Pen->Color = clWhite;
PBGraph->Canvas->PenPos = TPoint(PBGraph->Width - 5, PBGraph->Height - 5);
PBGraph->Canvas->LineTo(PBGraph->Width - 5, 5);
PBGraph->Canvas->PenPos = TPoint(PBGraph->Width - 5, PBGraph->Height - 5);
PBGraph->Canvas->LineTo(4, PBGraph->Height - 5);
PBGraph->Canvas->Brush->Color = clBlack;
PBGraph->Canvas->Pen->Color = clNavy;
int iPosition = 0, iLastI;
float fValue = 0.0f, fLastValue;
float afValues[101];
for(int i = 0; i < 101; i++)
{
if((m_EnvelopeProfile.afPoints[i] == -999999.9f) && (i != 0) && (i != 100))
continue;
if(m_EnvelopeProfile.afPoints[i] == -999999.9f)
m_EnvelopeProfile.afPoints[i] = m_fDefault;
fLastValue = fValue;
if(m_EnvelopeProfile.bIsLinear)
fValue = -m_EnvelopeProfile.afPoints[i] + m_fMax;
else
fValue = m_EnvelopeProfile.afPoints[i] - m_fMin + 1.0f ;
if(m_EnvelopeProfile.bIsLinear)
{
if(i == 0)
PBGraph->Canvas->PenPos = TPoint(5, (int)(((float)(PBGraph->Height - 11)) / (m_fMax - m_fMin) * fValue + 5.0f));
else
PBGraph->Canvas->LineTo((int)(((float)(PBGraph->Width - 5)) / 100.0f * (float)(i)), (int)((float)((PBGraph->Height - 11)) / (m_fMax - m_fMin) * fValue + 5.0f));
}
else
{
if(i == 0)
PBGraph->Canvas->PenPos = TPoint(5, (int)(((float)(PBGraph->Height - 11)) / (m_fMax - m_fMin) * ((-fValue + m_fMax - m_fMin) + 1.0f) + 5.0f));
else
{
for(int j = iLastI; j <= i; j++)
afValues[j] = fLastValue * pow(fValue / fLastValue, (float)(j - iLastI) / (float)(i - iLastI));
PBGraph->Canvas->PenPos = TPoint((int)(((float)(PBGraph->Width - 5)) / 100.0f * (float)(i)), (int)(((float)(PBGraph->Height - 11)) / (m_fMax - m_fMin) * ((-fValue + m_fMax - m_fMin) + 1.0f) + 5.0f));
}
}
if(LBPoints->ItemIndex == iPosition)
PBGraph->Canvas->Brush->Color = clWhite;
else
PBGraph->Canvas->Brush->Color = clBlack;
PBGraph->Canvas->Rectangle(PBGraph->Canvas->PenPos.x - 3, PBGraph->Canvas->PenPos.y - 3, PBGraph->Canvas->PenPos.x + 3, PBGraph->Canvas->PenPos.y + 3);
iPosition++;
iLastI = i;
}
if(!m_EnvelopeProfile.bIsLinear)
{
for(int i = 0; i < 101; i++)
{
if(i == 0)
PBGraph->Canvas->PenPos = TPoint(5, (int)(((float)(PBGraph->Height - 11)) / (m_fMax - m_fMin) * ((-afValues[i] + m_fMax - m_fMin) + 1.0f) + 5.0f));
else
PBGraph->Canvas->LineTo((int)(((float)(PBGraph->Width - 5)) / 100.0f * (float)(i)), (int)(((float)(PBGraph->Height - 11)) / (m_fMax - m_fMin) * ((-afValues[i] + m_fMax - m_fMin) + 1.0f) + 5.0f));
}
}
PBGraph->Canvas->Brush->Color = clSilver;
PBGraph->Canvas->TextOutA(10, 6, m_fMax);
PBGraph->Canvas->TextOutA(10, PBGraph->Height - 20, m_fMin);
if(m_fMin < 0.0f)
PBGraph->Canvas->TextOutA(10, (int)(((float)(PBGraph->Height - 11)) / (m_fMax - m_fMin) * m_fMax), "0");
if(CBRelativeValues->Checked)
PBGraph->Canvas->TextOutA(PBGraph->Width - 78, PBGraph->Height - 20, "100% der Zeit");
else
{
char acBuffer[256];
sprintf(acBuffer, "%.2fs", FCreateSound->m_fDuration);
PBGraph->Canvas->TextOutA(PBGraph->Width - 50, PBGraph->Height - 20, acBuffer);
}
}
|