Changeset 559 in josm for trunk/src/org
- Timestamp:
- 2008-02-25T12:04:48+01:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/AudioPlayer.java
r557 r559 12 12 import javax.sound.sampled.DataLine; 13 13 import javax.sound.sampled.SourceDataLine; 14 import java.io.IOException; 14 15 import javax.swing.JOptionPane; 15 16 … … 196 197 playingUrl = null; 197 198 AudioInputStream audioInputStream = null; 198 int nBytesRead = 0;199 199 SourceDataLine audioOutputLine = null; 200 200 AudioFormat audioFormat = null; … … 214 214 case PLAYING: 215 215 for(;;) { 216 int nBytesRead = 0; 216 217 nBytesRead = audioInputStream.read(abData, 0, abData.length); 217 218 position += nBytesRead / bytesPerSecond; … … 252 253 audioFormat = audioInputStream.getFormat(); 253 254 DataLine.Info info = new DataLine.Info(SourceDataLine.class, audioFormat); 254 nBytesRead = 0; 255 long nBytesRead = 0; 255 256 position = 0.0; 256 257 double adjustedOffset = (offset - leadIn) * calibration; … … 265 266 // audioInputStream.skip(bytesToSkip); 266 267 while (bytesToSkip > chunk) { 267 bytesToSkip -= audioInputStream.skip(chunk); 268 nBytesRead = audioInputStream.skip(chunk); 269 if (nBytesRead <= 0) 270 throw new IOException(tr("This is after the end of the recording")); 271 bytesToSkip -= nBytesRead; 268 272 } 269 273 if (bytesToSkip > 0) … … 295 299 public static void audioMalfunction(Exception ex) { 296 300 JOptionPane.showMessageDialog(Main.parent, 297 "<html><b>" + 298 tr("There was an error while trying to play the sound file for this marker.") + 299 "</b><br>" + ex.getClass().getName() + ":<br><i>" + ex.getMessage() + "</i></html>", 301 "<html><p>" + ex.getMessage() + "</p></html>", 300 302 tr("Error playing sound"), JOptionPane.ERROR_MESSAGE); 301 303 }
Note:
See TracChangeset
for help on using the changeset viewer.