Ignore:
Timestamp:
2013-04-15T23:12:33+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #8611 (audio slower broken) + update all audio javadoc

Location:
trunk/src/org/openstreetmap/josm/tools
Files:
2 edited

Legend:

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

    r3264 r5871  
    2020 *
    2121 * @author David Earl <david@frankieandshadow.com>
    22  *
     22 * @since 547
    2323 */
    2424public class AudioPlayer extends Thread {
     
    104104     * start at the beginning of the stream
    105105     * @param url The resource to play, which must be a WAV file or stream
    106      * @throws audio fault exception, e.g. can't open stream,  unhandleable audio format
     106     * @throws Exception audio fault exception, e.g. can't open stream,  unhandleable audio format
    107107     */
    108108    public static void play(URL url) throws Exception {
     
    114114     * @param url The resource to play, which must be a WAV file or stream
    115115     * @param seconds The number of seconds into the audio to start playing
    116      * @throws audio fault exception, e.g. can't open stream,  unhandleable audio format
     116     * @throws Exception audio fault exception, e.g. can't open stream,  unhandleable audio format
    117117     */
    118118    public static void play(URL url, double seconds) throws Exception {
     
    125125     * @param seconds The number of seconds into the audio to start playing
    126126     * @param speed Rate at which audio playes (1.0 = real time, > 1 is faster)
    127      * @throws audio fault exception, e.g. can't open stream,  unhandleable audio format
     127     * @throws Exception audio fault exception, e.g. can't open stream,  unhandleable audio format
    128128     */
    129129    public static void play(URL url, double seconds, double speed) throws Exception {
     
    133133    /**
    134134     * Pauses the currently playing audio stream. Does nothing if nothing playing.
    135      * @throws audio fault exception, e.g. can't open stream,  unhandleable audio format
     135     * @throws Exception audio fault exception, e.g. can't open stream,  unhandleable audio format
    136136     */
    137137    public static void pause() throws Exception {
     
    194194    }
    195195
     196    /**
     197     * Resets the audio player.
     198     */
    196199    public static void reset() {
    197200        if(audioPlayer != null)
     
    208211        command = new Execute();
    209212        playingUrl = null;
    210         leadIn = Main.pref.getDouble("audio.leadin", "1.0" /* default, seconds */);
    211         calibration = Main.pref.getDouble("audio.calibration", "1.0" /* default, ratio */);
     213        leadIn = Main.pref.getDouble("audio.leadin", 1.0 /* default, seconds */);
     214        calibration = Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */);
    212215        start();
    213216        while (state == State.INITIALIZING) { yield(); }
     
    338341    }
    339342
     343    /**
     344     * Shows a popup audio error message for the given exception.
     345     * @param ex The exception used as error reason. Cannot be {@code null}.
     346     */
    340347    public static void audioMalfunction(Exception ex) {
    341348        String msg = ex.getMessage();
  • trunk/src/org/openstreetmap/josm/tools/AudioUtil.java

    r3083 r5871  
    1212
    1313/**
    14  * Returns calibrated length of recording in seconds.
     14 * Utils functions for audio.
    1515 *
    1616 * @author David Earl <david@frankieandshadow.com>
    17  *
     17 * @since 1462
    1818 */
    1919public class AudioUtil {
     20   
     21    /**
     22     * Returns calibrated length of recording in seconds.
     23     * @param wavFile the recording file (WAV format)
     24     * @return the calibrated length of recording in seconds.
     25     */
    2026    static public double getCalibratedDuration(File wavFile) {
    2127        try {
     
    2834            double naturalLength = filesize / bytesPerSecond;
    2935            audioInputStream.close();
    30             double calibration = Main.pref.getDouble("audio.calibration", "1.0" /* default, ratio */);
     36            double calibration = Main.pref.getDouble("audio.calibration", 1.0 /* default, ratio */);
    3137            return naturalLength / calibration;
    3238        } catch (Exception e) {
Note: See TracChangeset for help on using the changeset viewer.