Changeset 354
- Timestamp:
- 10/09/08 23:00:37 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src_apollo/org/apollo/gui/WaveFormRenderProccessingUnit.java
r315 r354 113 113 private WaveFormRenderTask currentTask; 114 114 115 private final static float AMPLITUDES_PER_PIXEL = 0.5f; // resolution: how many amplitudes per pixel to render115 private final static float AMPLITUDES_PER_PIXEL = 1.0f; // resolution: how many amplitudes per pixel to render 116 116 private final static int FRAME_RENDER_RATE = 2000; // The approximate amount of frames to render per pass 117 117 … … 236 236 g.setColor(ApolloColorIndexedModels.WAVEFORM_COLOR); 237 237 238 for (float h : amps) { 239 240 int x = (int)(currentAmplitude * ((float)bufferWidth / (float)(totalAmplitudes - 1))); 241 int y = halfMaxHeight - (int)(h * halfMaxHeight); 242 243 if (currentAmplitude == 0) { // never draw line on first point 244 245 lastXPosition = 0; 246 lastYPosition = y; 247 248 } else { 249 250 g.drawLine( 251 lastXPosition, 252 lastYPosition, 253 x, 254 y); 255 256 lastXPosition = x; 257 lastYPosition = y; 258 238 if (aggregationSize == 1) { 239 240 for (float h : amps) { 241 242 int x = (int)(currentAmplitude * ((float)bufferWidth / (float)(totalAmplitudes - 1))); 243 int y = halfMaxHeight - (int)(h * halfMaxHeight); 244 245 if (currentAmplitude == 0) { // never draw line on first point 246 247 lastXPosition = 0; 248 lastYPosition = y; 249 250 } else { 251 252 g.drawLine( 253 lastXPosition, 254 lastYPosition, 255 x, 256 y); 257 258 lastXPosition = x; 259 lastYPosition = y; 260 261 } 262 263 currentAmplitude ++; 259 264 } 260 265 261 currentAmplitude ++; 266 } else { // dual version - looks nicer and conceptually easy to see audio 267 268 for (int i = 0; i < amps.length; i+=2) { 269 270 float peak = amps[i]; 271 float trough = amps[i + 1]; 272 273 int x = (int)(currentAmplitude * ((float)bufferWidth / (float)(totalAmplitudes - 1))); 274 int ypeak = halfMaxHeight - (int)(peak * halfMaxHeight); 275 int ytrough = halfMaxHeight - (int)(trough * halfMaxHeight); 276 277 if (currentAmplitude == 0) { // never draw line on first point 278 279 lastXPosition = lastYPosition = 0; 280 281 } else { 282 283 g.drawLine( 284 x, 285 ypeak, 286 x, 287 ytrough); 288 289 lastXPosition = x; 290 lastYPosition = 0; 291 292 } 293 294 currentAmplitude ++; 295 } 296 262 297 } 263 298 … … 335 370 this.frameLength = frameLength; 336 371 this.recommendInvalidations = recommendInvalidations; 337 renderer = new PeakTroughWaveFormRenderer(format);372 renderer = new DualPeakTroughWaveFormRenderer(format); 338 373 } 339 374
Note:
See TracChangeset
for help on using the changeset viewer.