- commit
- 78059cd39a70bfbe2226d173f88fd3fe744ea151
- parent
- 2ee17b61dcca8af236477cd62198c44af1bcdb33
- Author
- xi <tobias.bengfort@gmx.net>
- Date
- 2010-11-03 23:00
nicer looking shape init
Diffstat
| M | src/curve.cpp | 20 | ++++++++++++++++++++ |
| M | src/curve.h | 5 | ++++- |
| M | src/gui/xiRTMainFrame.cpp | 13 | +++++++++---- |
| M | src/gui/xiRTMainFrame.h | 1 | + |
| M | xiRetimer | 0 |
5 files changed, 34 insertions, 5 deletions
diff --git a/src/curve.cpp b/src/curve.cpp
@@ -23,6 +23,26 @@ float Curve::get(float nn) {
23 23 return sample->getOld(marker->new2old(marker->nnew2new(nn)));
24 24 }
25 25
-1 26 int MINMAXRES=15;
-1 27
-1 28 float Curve::getMin(float nn, float l) {
-1 29 float min=1;
-1 30 for (int i=0; i<MINMAXRES; ++i) {
-1 31 float g=get(nn+l*i/MINMAXRES);
-1 32 if (g<min) min=g;
-1 33 }
-1 34 return min;
-1 35 }
-1 36
-1 37 float Curve::getMax(float nn, float l) {
-1 38 float max=-1;
-1 39 for (int i=0; i<MINMAXRES; ++i) {
-1 40 float g=get(nn+l*i/MINMAXRES);
-1 41 if (g>max) max=g;
-1 42 }
-1 43 return max;
-1 44 }
-1 45
26 46 float Curve::getSeeker() {
27 47 return playback->getSeeker();
28 48 }
diff --git a/src/curve.h b/src/curve.h
@@ -12,9 +12,12 @@ class Curve {
12 12 public:
13 13 Curve(Marker* m, Sample* s, Playback* p);
14 14 ~Curve();
-1 15 // indirect access to playback
-1 16 float getSeeker();
15 17 // indirect access to sample
16 18 float get(float nn);
17 -1 float getSeeker();
-1 19 float getMin(float nn, float l); // nicer looking waveform
-1 20 float getMax(float nn, float l); // nicer looking waveform
18 21 // indirect access to marker
19 22 void addMarker();
20 23 void removeMarker();
diff --git a/src/gui/xiRTMainFrame.cpp b/src/gui/xiRTMainFrame.cpp
@@ -156,16 +156,21 @@ void xiRTMainFrame::paint() {
156 156 wxBufferedDC dc(&dc2,wxSize(width,height));
157 157 int h=height-BEAT;
158 158
159 -1 wxBrush brush(*wxBLACK); // red pen of width 1
-1 159 wxBrush brush(*wxBLACK);
160 160 dc.SetBackground(brush);
161 161 wxPen penCurve(*wxBLUE,1);
162 162 wxPen penSeeker(*wxWHITE,1);
163 163 wxPen penMarker(wxColor(255,255,0),1);
164 164 dc.SetPen(penCurve);
165 165 dc.Clear();
166 -1 // TODO nicer looking shape
167 -1 for (int i=0; i<width-1; ++i) {
-1 166 for (int i=0; i<width; ++i) {
168 167 dc.DrawLine(i,int(curve->get(i/(float)(width-1))*h+height)/2,i+1,int(curve->get((i+1)/(float)(width-1))*h+height)/2);
-1 168 // TODO nicer looking shape is too slow. Should be painted on an extra buffer
-1 169 /*
-1 170 float min=curve->getMin(i/(float)width, 1/(float)width);
-1 171 float max=curve->getMax(i/(float)width, 1/(float)width);
-1 172 dc.DrawLine(i,int(min*h+height)/2,i,int(max*h+height)/2);
-1 173 */
169 174 }
170 175 dc.SetPen(penMarker);
171 176 for (int i=0; i<curve->getMarkerLength(); ++i) {
@@ -182,7 +187,7 @@ void xiRTMainFrame::paint() {
182 187 }
183 188 // seeker
184 189 dc.SetPen(penSeeker);
185 -1 playback->setSeeker(curve->getSeeker()); // TODO mainloop stuff
-1 190 playback->setSeeker(curve->getSeeker());
186 191 int seek=int(curve->getSeeker()*(width-1));
187 192 dc.DrawLine(seek,0,seek,height);
188 193 //beats
diff --git a/src/gui/xiRTMainFrame.h b/src/gui/xiRTMainFrame.h
@@ -40,6 +40,7 @@ protected: 40 40 void OnUpdateUI( wxUpdateUIEvent& event ); 41 41 42 42 void paint(); -1 43 void paintSeeker(); 43 44 static const int MARKERWIDTH=15; 44 45 static const int BEAT=15; 45 46