Ignore:
Timestamp:
2008-03-06T13:50:13+01:00 (18 years ago)
Author:
david
Message:

when dragging play head (a) fix bug re extraneous rubber band rectangle (b) fix small calibration bug, (c) jump to interpolated point on track, not nearest track point.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java

    r572 r577  
    3737        private double position; // seconds
    3838        private double bytesPerSecond;
    39         private static long chunk = 8000; /* bytes */
     39        private static long chunk = 4000; /* bytes */
    4040        private double speed = 1.0;
    4141
     
    238238                                        break;
    239239                                case PLAYING:
     240                                        command.possiblyInterrupt();
    240241                                        for(;;) {
    241242                                                int nBytesRead = 0;
     
    280281                                                        long nBytesRead = 0;
    281282                                                        position = 0.0;
    282                                                         double adjustedOffset = (offset - leadIn) * calibration;
     283                                                        offset -= leadIn;
     284                                                        double calibratedOffset = offset * calibration;
    283285                                                        bytesPerSecond = audioFormat.getFrameRate() /* frames per second */
    284286                                                                * audioFormat.getFrameSize() /* bytes per frame */;
    285287                                                        if (speed * bytesPerSecond > 256000.0)
    286288                                                                speed = 256000 / bytesPerSecond;
    287                                                         if (offset != 0.0 && adjustedOffset > 0.0) {
     289                                                        if (calibratedOffset > 0.0) {
    288290                                                                long bytesToSkip = (long)(
    289                                                                         adjustedOffset /* seconds (double) */ * bytesPerSecond);
     291                                                                                calibratedOffset /* seconds (double) */ * bytesPerSecond);
    290292                                                                /* skip doesn't seem to want to skip big chunks, so
    291293                                                                 * reduce it to smaller ones
     
    300302                                                                if (bytesToSkip > 0)
    301303                                                                        audioInputStream.skip(bytesToSkip);
    302                                                                 position = adjustedOffset;
     304                                                                position = offset;
    303305                                                        }
    304306                                                        if (audioOutputLine != null)
Note: See TracChangeset for help on using the changeset viewer.