1 /*
2  * Project: VizKit
3  * Version: 2.3
4 
5  * Date: 20090823
6  * File: ProcessMonitor.cpp
7  *
8  */
9 
10 /***************************************************************************
11 
12 Copyright (c) 2004-2009 Heiko Wichmann (http://www.imagomat.de/vizkit)
13 
14 
15 This software is provided 'as-is', without any expressed or implied warranty.
16 In no event will the authors be held liable for any damages
17 arising from the use of this software.
18 
19 Permission is granted to anyone to use this software for any purpose,
20 including commercial applications, and to alter it and redistribute it
21 freely, subject to the following restrictions:
22 
23 1. The origin of this software must not be misrepresented;
24    you must not claim that you wrote the original software.
25    If you use this software in a product, an acknowledgment
26    in the product documentation would be appreciated
27    but is not required.
28 
29 2. Altered source versions must be plainly marked as such,
30    and must not be misrepresented as being the original software.
31 
32 3. This notice may not be removed or altered from any source distribution.
33 
34  ***************************************************************************/
35 
36 #include "ProcessMonitor.h"
37 #include "VisualErrorHandling.h"
38 #include "VisualActorGraphics.h"
39 #include "VisualAudioLab.h"
40 #include "VisualGraphicTypes.h"
41 #include "VisualVertex.h"
42 #include "VisualAsset.h"
43 #include "VisualCamera.h"
44 
45 using namespace VizKit;
46 
47 
ProcessMonitor()48 ProcessMonitor::ProcessMonitor() {
49 	processMonitorAsset = new VisualAsset;
50 	setupProgressMeterVertices();
51 }
52 
53 
~ProcessMonitor()54 ProcessMonitor::~ProcessMonitor() {
55     cleanupProgressMeterVertices();
56 	delete processMonitorAsset;
57 }
58 
59 
prepareProcessMonitorShow()60 void ProcessMonitor::prepareProcessMonitorShow() {
61 	VisualCamera aCamera;
62 	aCamera.setOrthographicProjection();
63 	processMonitorAsset->setCamera(aCamera);
64 	RGBAColor theColor;
65 	theColor.r = 0.0;
66 	theColor.g = 1.0;
67 	theColor.b = 0.0;
68 	theColor.a = 1.0;
69 	VisualActorGraphics::prepareProcessMonitorShow(theColor);
70 }
71 
72 
showInfoStrings()73 void ProcessMonitor::showInfoStrings() {
74 
75 	ProcessInfoMapIterator it;
76 
77     char finalTextString[255];
78     double yNum;
79     double xNum;
80 	uint8 charCountMax = 0; // in one line per column
81 	double rowHeight, characterWidth;
82 
83 	VisualCamera aCamera;
84 	aCamera.setOrthographicProjection();
85 	CoordSize3D size = aCamera.getSize();
86 	rowHeight = size.height * (15.0f / VisualActorGraphics::getCanvasPixelHeight());
87 	characterWidth = size.width * (9.0f / VisualActorGraphics::getCanvasPixelWidth());
88 
89 	xNum = aCamera.getMaxLeftCoord() + characterWidth;
90 	yNum = aCamera.getMaxTopCoord();
91 
92 	Coord coord;
93 
94 	for (it = this->processInfoMap.begin(); it != this->processInfoMap.end(); it++) {
95 
96 		yNum = yNum - rowHeight;
97 		if ((yNum - rowHeight) < aCamera.getMaxBottomCoord()) {
98 			// we reached the bottom -> go to next column to the right
99 			yNum = aCamera.getMaxTopCoord() - rowHeight;
100 			xNum = xNum + characterWidth + (charCountMax * characterWidth);
101 			charCountMax = 0;
102 		}
103 		strcpy (finalTextString, (*it).first.c_str());
104 		strcat (finalTextString, ": ");
105 		strcat (finalTextString, (*it).second.c_str());
106 		if (strlen(finalTextString) > charCountMax) {
107 			charCountMax = strlen(finalTextString);
108 		}
109 		coord.x = xNum;
110 		coord.y = yNum;
111 		coord.z = 0.0;
112 		VisualActorGraphics::showProcessInfoRow(coord, finalTextString); // constant height of font
113 
114     }
115 
116 	VisualActorGraphics::showProcessInfoNote();
117 
118 }
119 
120 
showAudioInfo(const uint32 elapsedAudioTime,const uint32 remainingAudioTime)121 void ProcessMonitor::showAudioInfo(const uint32 elapsedAudioTime, const uint32 remainingAudioTime) {
122 
123 	VisualAudioLab* theVisualAudioLab;
124 
125 	uint16 numberOfAudioDataChannels;
126 	uint32 numberOfSpectrumEntries;
127 	uint16 maxNumberOfMusicDataHistories;
128 
129 	const sint16** waveformDataMonoArray;
130 	sint16 currMusicDataHistory;
131 	uint16 prevMusicDataHistory;
132 	uint32 numberOfWaveformEntries;
133 
134 	const uint8*** spectrumDataArray;
135 	//const uint32* beatHistogram;
136 
137 	theVisualAudioLab = VisualAudioLab::getInstance();
138 
139 	currMusicDataHistory = theVisualAudioLab->getCurrMusicDataHistory();
140 	prevMusicDataHistory = theVisualAudioLab->getPrevMusicDataHistory();
141 	numberOfWaveformEntries = theVisualAudioLab->getNumberOfWaveformEntries();
142 	maxNumberOfMusicDataHistories = theVisualAudioLab->getMaxNumberOfMusicDataHistories();
143 	waveformDataMonoArray = theVisualAudioLab->getWaveformDataMonoArray();
144 
145 	numberOfAudioDataChannels = theVisualAudioLab->getNumberOfDataChannels();
146 	numberOfSpectrumEntries = theVisualAudioLab->getNumberOfSpectrumEntries();
147 	spectrumDataArray = theVisualAudioLab->getSpectrumDataArray();
148 
149     VisualActorGraphics::drawWaveform(currMusicDataHistory, maxNumberOfMusicDataHistories, numberOfWaveformEntries, waveformDataMonoArray, processMonitorAsset->getCamera());
150 	VisualActorGraphics::resetModelViewMatrix();
151 
152 	//theVisualGraphics->drawWaveform(currMusicDataHistory, 1, numberOfWaveformEntries, waveformDataMonoArray);
153 	VisualActorGraphics::drawSpectrumAnalyzer(currMusicDataHistory, maxNumberOfMusicDataHistories, numberOfSpectrumEntries, numberOfAudioDataChannels, spectrumDataArray, processMonitorAsset->getCamera());
154 	VisualActorGraphics::resetModelViewMatrix();
155 	VisualActorGraphics::drawSpectrogram(currMusicDataHistory, maxNumberOfMusicDataHistories, numberOfSpectrumEntries, numberOfAudioDataChannels, spectrumDataArray, processMonitorAsset->getCamera());
156     VisualActorGraphics::resetModelViewMatrix();
157 
158 	//theVisualGraphics->drawWaveformSpiral(currMusicDataHistory, numberOfWaveformEntries, waveformDataMonoArray);
159 	//beatHistogram = theVisualAudioLab->getBeatHistogram();
160 	//VisualActorGraphics::drawBeatHistogram(beatHistogram, processMonitorAsset->getCamera());
161 	//VisualActorGraphics::drawTrackProgressMeter(elapsedAudioTime, remainingAudioTime);
162 
163 	//this->updateProgressMeterVertices();
164 	this->calcTrackProgressMeterVertices(elapsedAudioTime, remainingAudioTime);
165 	VisualActorGraphics::drawTrackProgressMeter(&this->progressMeterBackgroundVertices, &this->progressMeterVertices, &this->progressMeterOutlineVertices);
166 
167 }
168 
169 
registerProcessMonitorInfoMap(const std::map<std::string,std::string> * const processMonitorInfoMap)170 void ProcessMonitor::registerProcessMonitorInfoMap(const std::map<std::string, std::string>* const processMonitorInfoMap) {
171 	this->processInfoMap = *processMonitorInfoMap;
172 }
173 
174 
finishProcessMonitorShow()175 void ProcessMonitor::finishProcessMonitorShow() {
176 	// null
177 }
178 
179 
updateProgressMeterVertices()180 void ProcessMonitor::updateProgressMeterVertices() {
181 
182 	double topPos, leftPos, bottomPos, rightPos, rightProgressPos;
183 
184 	VisualCamera aCamera;
185 	aCamera.setOrthographicProjection();
186 	topPos = aCamera.getMaxBottomCoord() + VisualActorGraphics::yPixelToCoord(10, aCamera);
187 	leftPos = aCamera.getMaxLeftCoord();
188 	bottomPos = aCamera.getMaxBottomCoord();
189 	rightPos = aCamera.getMaxRightCoord();
190 	rightProgressPos = aCamera.getMaxLeftCoord();
191 	RGBAColor backgroundColor = VisualActorGraphics::getBackgroundColor();
192 
193 	progressMeterBackgroundVertices[0]->vertexPosition.coord.x = leftPos;
194 	progressMeterBackgroundVertices[0]->vertexPosition.coord.y = bottomPos;
195 	progressMeterBackgroundVertices[0]->vertexPosition.coord.z = 0.0f;
196 	progressMeterBackgroundVertices[0]->vertexColor.r = backgroundColor.r;
197 	progressMeterBackgroundVertices[0]->vertexColor.g = backgroundColor.g;
198 	progressMeterBackgroundVertices[0]->vertexColor.b = backgroundColor.b;
199 	progressMeterBackgroundVertices[0]->vertexColor.a = backgroundColor.a;
200 
201 	progressMeterBackgroundVertices[1]->vertexPosition.coord.x = rightPos;
202 	progressMeterBackgroundVertices[1]->vertexPosition.coord.y = bottomPos;
203 	progressMeterBackgroundVertices[1]->vertexPosition.coord.z = 0.0f;
204 	progressMeterBackgroundVertices[1]->vertexColor.r = backgroundColor.r;
205 	progressMeterBackgroundVertices[1]->vertexColor.g = backgroundColor.g;
206 	progressMeterBackgroundVertices[1]->vertexColor.b = backgroundColor.b;
207 	progressMeterBackgroundVertices[1]->vertexColor.a = backgroundColor.a;
208 
209 	progressMeterBackgroundVertices[2]->vertexPosition.coord.x = rightPos;
210 	progressMeterBackgroundVertices[2]->vertexPosition.coord.y = topPos;
211 	progressMeterBackgroundVertices[2]->vertexPosition.coord.z = 0.0f;
212 	progressMeterBackgroundVertices[2]->vertexColor.r = backgroundColor.r;
213 	progressMeterBackgroundVertices[2]->vertexColor.g = backgroundColor.g;
214 	progressMeterBackgroundVertices[2]->vertexColor.b = backgroundColor.b;
215 	progressMeterBackgroundVertices[2]->vertexColor.a = backgroundColor.a;
216 
217 	progressMeterBackgroundVertices[3]->vertexPosition.coord.x = leftPos;
218 	progressMeterBackgroundVertices[3]->vertexPosition.coord.y = topPos;
219 	progressMeterBackgroundVertices[3]->vertexPosition.coord.z = 0.0f;
220 	progressMeterBackgroundVertices[3]->vertexColor.r = backgroundColor.r;
221 	progressMeterBackgroundVertices[3]->vertexColor.g = backgroundColor.g;
222 	progressMeterBackgroundVertices[3]->vertexColor.b = backgroundColor.b;
223 	progressMeterBackgroundVertices[3]->vertexColor.a = backgroundColor.a;
224 
225 	progressMeterVertices[0]->vertexPosition.coord.x = leftPos;
226 	progressMeterVertices[0]->vertexPosition.coord.y = bottomPos;
227 	progressMeterVertices[0]->vertexPosition.coord.z = 0.0f;
228 	progressMeterVertices[0]->vertexColor.r = 1.0f;
229 	progressMeterVertices[0]->vertexColor.g = 1.0f;
230 	progressMeterVertices[0]->vertexColor.b = 1.0f;
231 	progressMeterVertices[0]->vertexColor.a = 1.0f;
232 
233 	progressMeterVertices[1]->vertexPosition.coord.x = rightProgressPos;
234 	progressMeterVertices[1]->vertexPosition.coord.y = bottomPos;
235 	progressMeterVertices[1]->vertexPosition.coord.z = 0.0f;
236 	progressMeterVertices[1]->vertexColor.r = 1.0f;
237 	progressMeterVertices[1]->vertexColor.g = 1.0f;
238 	progressMeterVertices[1]->vertexColor.b = 1.0f;
239 	progressMeterVertices[1]->vertexColor.a = 1.0f;
240 
241 	progressMeterVertices[2]->vertexPosition.coord.x = rightProgressPos;
242 	progressMeterVertices[2]->vertexPosition.coord.y = topPos;
243 	progressMeterVertices[2]->vertexPosition.coord.z = 0.0f;
244 	progressMeterVertices[2]->vertexColor.r = 1.0f;
245 	progressMeterVertices[2]->vertexColor.g = 1.0f;
246 	progressMeterVertices[2]->vertexColor.b = 1.0f;
247 	progressMeterVertices[2]->vertexColor.a = 1.0f;
248 
249 	progressMeterVertices[3]->vertexPosition.coord.x = leftPos;
250 	progressMeterVertices[3]->vertexPosition.coord.y = topPos;
251 	progressMeterVertices[3]->vertexPosition.coord.z = 0.0f;
252 	progressMeterVertices[3]->vertexColor.r = 1.0f;
253 	progressMeterVertices[3]->vertexColor.g = 1.0f;
254 	progressMeterVertices[3]->vertexColor.b = 1.0f;
255 	progressMeterVertices[3]->vertexColor.a = 1.0f;
256 
257 	progressMeterOutlineVertices[0]->vertexPosition.coord.x = leftPos;
258 	progressMeterOutlineVertices[0]->vertexPosition.coord.y = bottomPos;
259 	progressMeterOutlineVertices[0]->vertexPosition.coord.z = 0.0f;
260 	/*
261 	progressMeterOutlineVertices[0]->vertexColor.r = 0.0f;
262 	progressMeterOutlineVertices[0]->vertexColor.g = 0.0f;
263 	progressMeterOutlineVertices[0]->vertexColor.b = 0.0f;
264 	progressMeterOutlineVertices[0]->vertexColor.a = 1.0f;
265 	*/
266 
267 
268 	progressMeterOutlineVertices[1]->vertexPosition.coord.x = rightPos;
269 	progressMeterOutlineVertices[1]->vertexPosition.coord.y = bottomPos;
270 	progressMeterOutlineVertices[1]->vertexPosition.coord.z = 0.0f;
271 	/*
272 	progressMeterOutlineVertices[1]->vertexColor.r = 0.0f;
273 	progressMeterOutlineVertices[1]->vertexColor.g = 0.0f;
274 	progressMeterOutlineVertices[1]->vertexColor.b = 0.0f;
275 	progressMeterOutlineVertices[1]->vertexColor.a = 1.0f;
276 	*/
277 
278 	progressMeterOutlineVertices[2]->vertexPosition.coord.x = rightPos;
279 	progressMeterOutlineVertices[2]->vertexPosition.coord.y = topPos;
280 	progressMeterOutlineVertices[2]->vertexPosition.coord.z = 0.0f;
281 	/*
282 	progressMeterOutlineVertices[2]->vertexColor.r = 0.0f;
283 	progressMeterOutlineVertices[2]->vertexColor.g = 0.0f;
284 	progressMeterOutlineVertices[2]->vertexColor.b = 0.0f;
285 	progressMeterOutlineVertices[2]->vertexColor.a = 1.0f;
286 	*/
287 
288 	progressMeterOutlineVertices[3]->vertexPosition.coord.x = leftPos;
289 	progressMeterOutlineVertices[3]->vertexPosition.coord.y = topPos;
290 	progressMeterOutlineVertices[3]->vertexPosition.coord.z = 0.0f;
291 	/*
292 	progressMeterOutlineVertices[3]->vertexColor.r = 0.0f;
293 	progressMeterOutlineVertices[3]->vertexColor.g = 0.0f;
294 	progressMeterOutlineVertices[3]->vertexColor.b = 0.0f;
295 	progressMeterOutlineVertices[3]->vertexColor.a = 1.0f;
296 	*/
297 }
298 
299 
setupProgressMeterVertices()300 void ProcessMonitor::setupProgressMeterVertices() {
301 
302 	VisualVertex* aVertex;
303 	double topPos;
304 	double leftPos;
305 	double bottomPos;
306 	double rightPos;
307 	double rightProgressPos;
308 	RGBAColor backgroundColor;
309 
310 	VisualCamera aCamera;
311 	aCamera.setOrthographicProjection();
312 	topPos = aCamera.getMaxBottomCoord() + VisualActorGraphics::yPixelToCoord(10, aCamera);
313 	leftPos = aCamera.getMaxLeftCoord();
314 	bottomPos = aCamera.getMaxBottomCoord();
315 	rightPos = aCamera.getMaxRightCoord();
316 	rightProgressPos = aCamera.getMaxLeftCoord();
317 	backgroundColor = VisualActorGraphics::getBackgroundColor();
318 
319 	Coord coordPoint;
320 	coordPoint.x = leftPos;
321 	coordPoint.y = bottomPos;
322 	coordPoint.z = 0.0;
323 	//aVertex = new VisualVertex(leftPos, bottomPos, 0.0, backgroundColor);
324 	aVertex = new VisualVertex(coordPoint, backgroundColor);
325 	/*
326 	aVertex->vertexPosition.coord.x = leftPos;
327 	aVertex->vertexPosition.coord.y = bottomPos;
328 	aVertex->vertexPosition.coord.z = 0.0f;
329 	aVertex->vertexColor.r = backgroundColor.r;
330 	aVertex->vertexColor.g = backgroundColor.g;
331 	aVertex->vertexColor.b = backgroundColor.b;
332 	aVertex->vertexColor.a = backgroundColor.a;
333 	*/
334 	progressMeterBackgroundVertices.push_back(aVertex);
335 
336 	coordPoint.x = rightPos;
337 	coordPoint.y = bottomPos;
338 	coordPoint.z = 0.0;
339 	//aVertex = new VisualVertex(rightPos, bottomPos, 0.0, backgroundColor);
340 	aVertex = new VisualVertex(coordPoint, backgroundColor);
341 	/*
342 	aVertex->vertexPosition.coord.x = rightPos;
343 	aVertex->vertexPosition.coord.y = bottomPos;
344 	aVertex->vertexPosition.coord.z = 0.0f;
345 	aVertex->vertexColor.r = backgroundColor.r;
346 	aVertex->vertexColor.g = backgroundColor.g;
347 	aVertex->vertexColor.b = backgroundColor.b;
348 	aVertex->vertexColor.a = backgroundColor.a;
349 	*/
350 	progressMeterBackgroundVertices.push_back(aVertex);
351 
352 	coordPoint.x = rightPos;
353 	coordPoint.y = topPos;
354 	coordPoint.z = 0.0;
355 	//aVertex = new VisualVertex(rightPos, topPos, 0.0, backgroundColor);
356 	aVertex = new VisualVertex(coordPoint, backgroundColor);
357 	/*
358 	aVertex->vertexPosition.coord.x = rightPos;
359 	aVertex->vertexPosition.coord.y = topPos;
360 	aVertex->vertexPosition.coord.z = 0.0f;
361 	aVertex->vertexColor.r = backgroundColor.r;
362 	aVertex->vertexColor.g = backgroundColor.g;
363 	aVertex->vertexColor.b = backgroundColor.b;
364 	aVertex->vertexColor.a = backgroundColor.a;
365 	*/
366 	progressMeterBackgroundVertices.push_back(aVertex);
367 
368 	coordPoint.x = leftPos;
369 	coordPoint.y = topPos;
370 	coordPoint.z = 0.0;
371 	//aVertex = new VisualVertex(leftPos, topPos, 0.0, backgroundColor);
372 	aVertex = new VisualVertex(coordPoint, backgroundColor);
373 	/*
374 	aVertex->vertexPosition.coord.x = leftPos;
375 	aVertex->vertexPosition.coord.y = topPos;
376 	aVertex->vertexPosition.coord.z = 0.0f;
377 	aVertex->vertexColor.r = backgroundColor.r;
378 	aVertex->vertexColor.g = backgroundColor.g;
379 	aVertex->vertexColor.b = backgroundColor.b;
380 	aVertex->vertexColor.a = backgroundColor.a;
381 	*/
382 	progressMeterBackgroundVertices.push_back(aVertex);
383 
384 	coordPoint.x = leftPos;
385 	coordPoint.y = bottomPos;
386 	coordPoint.z = 0.0;
387 	//aVertex = new VisualVertex(leftPos, bottomPos, 0.0, white);
388 	aVertex = new VisualVertex(coordPoint, white);
389 	/*
390 	aVertex->vertexPosition.coord.x = leftPos;
391 	aVertex->vertexPosition.coord.y = bottomPos;
392 	aVertex->vertexPosition.coord.z = 0.0f;
393 	aVertex->vertexColor.r = 1.0f;
394 	aVertex->vertexColor.g = 1.0f;
395 	aVertex->vertexColor.b = 1.0f;
396 	aVertex->vertexColor.a = 1.0f;
397 	*/
398 	progressMeterVertices.push_back(aVertex);
399 
400 	coordPoint.x = rightProgressPos;
401 	coordPoint.y = bottomPos;
402 	coordPoint.z = 0.0;
403 	//aVertex = new VisualVertex(rightProgressPos, bottomPos, 0.0, white);
404 	aVertex = new VisualVertex(coordPoint, white);
405 	/*
406 	aVertex->vertexPosition.coord.x = rightProgressPos;
407 	aVertex->vertexPosition.coord.y = bottomPos;
408 	aVertex->vertexPosition.coord.z = 0.0f;
409 	aVertex->vertexColor.r = 1.0f;
410 	aVertex->vertexColor.g = 1.0f;
411 	aVertex->vertexColor.b = 1.0f;
412 	aVertex->vertexColor.a = 1.0f;
413 	*/
414 	progressMeterVertices.push_back(aVertex);
415 
416 	coordPoint.x = rightProgressPos;
417 	coordPoint.y = topPos;
418 	coordPoint.z = 0.0;
419 	//aVertex = new VisualVertex(rightProgressPos, topPos, 0.0, white);
420 	aVertex = new VisualVertex(coordPoint, white);
421 	/*
422 	aVertex->vertexPosition.coord.x = rightProgressPos;
423 	aVertex->vertexPosition.coord.y = topPos;
424 	aVertex->vertexPosition.coord.z = 0.0f;
425 	aVertex->vertexColor.r = 1.0f;
426 	aVertex->vertexColor.g = 1.0f;
427 	aVertex->vertexColor.b = 1.0f;
428 	aVertex->vertexColor.a = 1.0f;
429 	*/
430 	progressMeterVertices.push_back(aVertex);
431 
432 	coordPoint.x = rightProgressPos;
433 	coordPoint.y = topPos;
434 	coordPoint.z = 0.0;
435 	//aVertex = new VisualVertex(leftPos, topPos, 0.0, white);
436 	aVertex = new VisualVertex(coordPoint, white);
437 	/*
438 	aVertex->vertexPosition.coord.x = leftPos;
439 	aVertex->vertexPosition.coord.y = topPos;
440 	aVertex->vertexPosition.coord.z = 0.0f;
441 	aVertex->vertexColor.r = 1.0f;
442 	aVertex->vertexColor.g = 1.0f;
443 	aVertex->vertexColor.b = 1.0f;
444 	aVertex->vertexColor.a = 1.0f;
445 	*/
446 	progressMeterVertices.push_back(aVertex);
447 
448 	coordPoint.x = leftPos;
449 	coordPoint.y = bottomPos;
450 	coordPoint.z = 0.0;
451 	//aVertex = new VisualVertex(leftPos, bottomPos, 0.0, black);
452 	//aVertex = new VisualVertex(coordPoint, black);
453 	aVertex = new VisualVertex(coordPoint);
454 	/*
455 	aVertex->vertexPosition.coord.x = leftPos;
456 	aVertex->vertexPosition.coord.y = bottomPos;
457 	aVertex->vertexPosition.coord.z = 0.0f;
458 	aVertex->vertexColor.r = 0.0f;
459 	aVertex->vertexColor.g = 0.0f;
460 	aVertex->vertexColor.b = 0.0f;
461 	aVertex->vertexColor.a = 1.0f;
462 	*/
463 	progressMeterOutlineVertices.push_back(aVertex);
464 
465 	coordPoint.x = rightPos;
466 	coordPoint.y = bottomPos;
467 	coordPoint.z = 0.0;
468 	//aVertex = new VisualVertex(rightPos, bottomPos, 0.0, black);
469 	//aVertex = new VisualVertex(coordPoint, black);
470 	aVertex = new VisualVertex(coordPoint);
471 	/*
472 	aVertex->vertexPosition.coord.x = rightPos;
473 	aVertex->vertexPosition.coord.y = bottomPos;
474 	aVertex->vertexPosition.coord.z = 0.0f;
475 	aVertex->vertexColor.r = 0.0f;
476 	aVertex->vertexColor.g = 0.0f;
477 	aVertex->vertexColor.b = 0.0f;
478 	aVertex->vertexColor.a = 1.0f;
479 	*/
480 	progressMeterOutlineVertices.push_back(aVertex);
481 
482 	coordPoint.x = rightPos;
483 	coordPoint.y = topPos;
484 	coordPoint.z = 0.0;
485 	//aVertex = new VisualVertex(rightPos, topPos, 0.0, black);
486 	//aVertex = new VisualVertex(coordPoint, black);
487 	aVertex = new VisualVertex(coordPoint);
488 	/*
489 	aVertex->vertexPosition.coord.x = rightPos;
490 	aVertex->vertexPosition.coord.y = topPos;
491 	aVertex->vertexPosition.coord.z = 0.0f;
492 	aVertex->vertexColor.r = 0.0f;
493 	aVertex->vertexColor.g = 0.0f;
494 	aVertex->vertexColor.b = 0.0f;
495 	aVertex->vertexColor.a = 1.0f;
496 	*/
497 	progressMeterOutlineVertices.push_back(aVertex);
498 
499 	coordPoint.x = leftPos;
500 	coordPoint.y = topPos;
501 	coordPoint.z = 0.0;
502 	//aVertex = new VisualVertex(leftPos, topPos, 0.0, black);
503 	//aVertex = new VisualVertex(coordPoint, black);
504 	aVertex = new VisualVertex(coordPoint);
505 	/*
506 	aVertex->vertexPosition.coord.x = leftPos;
507 	aVertex->vertexPosition.coord.y = topPos;
508 	aVertex->vertexPosition.coord.z = 0.0f;
509 	aVertex->vertexColor.r = 0.0f;
510 	aVertex->vertexColor.g = 0.0f;
511 	aVertex->vertexColor.b = 0.0f;
512 	aVertex->vertexColor.a = 1.0f;
513 	*/
514 	progressMeterOutlineVertices.push_back(aVertex);
515 
516 }
517 
518 
calcTrackProgressMeterVertices(const uint32 elapsedAudioTime,const uint32 remainingAudioTime)519 void ProcessMonitor::calcTrackProgressMeterVertices(const uint32 elapsedAudioTime, const uint32 remainingAudioTime) {
520 	double rightProgressPos;
521 
522 	VisualCamera aCamera;
523 	aCamera.setOrthographicProjection();
524 	rightProgressPos = aCamera.getMaxLeftCoord() + ((aCamera.getMaxRightCoord() - aCamera.getMaxLeftCoord()) * ((float)elapsedAudioTime / (float)(remainingAudioTime + elapsedAudioTime)));
525 
526 	this->progressMeterVertices[1]->vertexPosition.coord.x = rightProgressPos;
527 	this->progressMeterVertices[2]->vertexPosition.coord.x = rightProgressPos;
528 
529 }
530 
531 
cleanupProgressMeterVertices()532 void ProcessMonitor::cleanupProgressMeterVertices() {
533 	VertexChainIterator it;
534 	for (it = progressMeterBackgroundVertices.begin(); it != progressMeterBackgroundVertices.end(); it++) {
535 		delete *it;
536 		*it = NULL;
537 	}
538 	progressMeterBackgroundVertices.clear();
539 
540 	for (it = progressMeterVertices.begin(); it != progressMeterVertices.end(); it++) {
541 		delete *it;
542 		*it = NULL;
543 	}
544 	progressMeterVertices.clear();
545 
546 	for (it = progressMeterOutlineVertices.begin(); it != progressMeterOutlineVertices.end(); it++) {
547 		delete *it;
548 		*it = NULL;
549 	}
550 	progressMeterOutlineVertices.clear();
551 }
552