Changeset 5871 in josm for trunk/src/org/openstreetmap/josm/tools
- Timestamp:
- 2013-04-15T23:12:33+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/tools
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r3264 r5871 20 20 * 21 21 * @author David Earl <david@frankieandshadow.com> 22 * 22 * @since 547 23 23 */ 24 24 public class AudioPlayer extends Thread { … … 104 104 * start at the beginning of the stream 105 105 * @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 format106 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 107 107 */ 108 108 public static void play(URL url) throws Exception { … … 114 114 * @param url The resource to play, which must be a WAV file or stream 115 115 * @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 format116 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 117 117 */ 118 118 public static void play(URL url, double seconds) throws Exception { … … 125 125 * @param seconds The number of seconds into the audio to start playing 126 126 * @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 format127 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 128 128 */ 129 129 public static void play(URL url, double seconds, double speed) throws Exception { … … 133 133 /** 134 134 * Pauses the currently playing audio stream. Does nothing if nothing playing. 135 * @throws audio fault exception, e.g. can't open stream, unhandleable audio format135 * @throws Exception audio fault exception, e.g. can't open stream, unhandleable audio format 136 136 */ 137 137 public static void pause() throws Exception { … … 194 194 } 195 195 196 /** 197 * Resets the audio player. 198 */ 196 199 public static void reset() { 197 200 if(audioPlayer != null) … … 208 211 command = new Execute(); 209 212 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 */); 212 215 start(); 213 216 while (state == State.INITIALIZING) { yield(); } … … 338 341 } 339 342 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 */ 340 347 public static void audioMalfunction(Exception ex) { 341 348 String msg = ex.getMessage(); -
trunk/src/org/openstreetmap/josm/tools/AudioUtil.java
r3083 r5871 12 12 13 13 /** 14 * Returns calibrated length of recording in seconds.14 * Utils functions for audio. 15 15 * 16 16 * @author David Earl <david@frankieandshadow.com> 17 * 17 * @since 1462 18 18 */ 19 19 public 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 */ 20 26 static public double getCalibratedDuration(File wavFile) { 21 27 try { … … 28 34 double naturalLength = filesize / bytesPerSecond; 29 35 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 */); 31 37 return naturalLength / calibration; 32 38 } catch (Exception e) {
Note:
See TracChangeset
for help on using the changeset viewer.