Ignore:
Timestamp:
2008-02-24T15:33:15+01:00 (19 years ago)
Author:
david
Message:

implement calibration function for audio player

File:
1 edited

Legend:

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

    r556 r557  
    3333    private URL playingUrl;
    3434    private double leadIn; // seconds
     35    private double calibration; // ratio of purported duration of samples to true duration
    3536        private double position; // seconds
    3637        private double bytesPerSecond;
    … …  
    176177                } catch (NumberFormatException e) {
    177178                        leadIn = 1.0; // failed to parse
     179                }
     180                try {
     181                        calibration = Double.parseDouble(Main.pref.get("audio.calibration", "1.0" /* default, ratio */));
     182                } catch (NumberFormatException e) {
     183                        calibration = 1.0; // failed to parse
    178184                }
    179185                start();
    … …  
    248254                                                        nBytesRead = 0;
    249255                                                        position = 0.0;
    250                                                         double adjustedOffset = offset - leadIn;
     256                                                        double adjustedOffset = (offset - leadIn) * calibration;
    251257                                                        bytesPerSecond = audioFormat.getFrameRate() /* frames per second */
    252258                                                                * audioFormat.getFrameSize() /* bytes per frame */;
Note: See TracChangeset for help on using the changeset viewer.