Changeset 577 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2008-03-06T13:50:13+01:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r572 r577 37 37 private double position; // seconds 38 38 private double bytesPerSecond; 39 private static long chunk = 8000; /* bytes */39 private static long chunk = 4000; /* bytes */ 40 40 private double speed = 1.0; 41 41 … … 238 238 break; 239 239 case PLAYING: 240 command.possiblyInterrupt(); 240 241 for(;;) { 241 242 int nBytesRead = 0; … … 280 281 long nBytesRead = 0; 281 282 position = 0.0; 282 double adjustedOffset = (offset - leadIn) * calibration; 283 offset -= leadIn; 284 double calibratedOffset = offset * calibration; 283 285 bytesPerSecond = audioFormat.getFrameRate() /* frames per second */ 284 286 * audioFormat.getFrameSize() /* bytes per frame */; 285 287 if (speed * bytesPerSecond > 256000.0) 286 288 speed = 256000 / bytesPerSecond; 287 if ( offset != 0.0 && adjustedOffset > 0.0) {289 if (calibratedOffset > 0.0) { 288 290 long bytesToSkip = (long)( 289 adjustedOffset /* seconds (double) */ * bytesPerSecond);291 calibratedOffset /* seconds (double) */ * bytesPerSecond); 290 292 /* skip doesn't seem to want to skip big chunks, so 291 293 * reduce it to smaller ones … … 300 302 if (bytesToSkip > 0) 301 303 audioInputStream.skip(bytesToSkip); 302 position = adjustedOffset;304 position = offset; 303 305 } 304 306 if (audioOutputLine != null)
Note:
See TracChangeset
for help on using the changeset viewer.
