Changeset 12328 in josm for trunk/src/org/openstreetmap/josm/gui/layer
- Timestamp:
- 2017-06-07T21:41:26+02:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/layer
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/layer/gpx/ImportAudioAction.java
r12326 r12328 41 41 private final transient GpxLayer layer; 42 42 43 static final class AudioFileFilter extends FileFilter { 43 /** 44 * Audio file filter. 45 * @since 12328 46 */ 47 public static final class AudioFileFilter extends FileFilter { 44 48 @Override 45 49 public boolean accept(File f) { 46 return f.isDirectory() || Utils.hasExtension(f, "wav" );50 return f.isDirectory() || Utils.hasExtension(f, "wav", "mp3", "aac", "aif", "aiff"); 47 51 } 48 52 49 53 @Override 50 54 public String getDescription() { 51 return tr(" Wave Audio files (*.wav)");55 return tr("Audio files (*.wav, *.mp3, *.aac, *.aif, *.aiff)"); 52 56 } 53 57 } … … 119 123 * which the given audio file is associated with. Markers are derived from the following (a) 120 124 * explict waypoints in the GPX layer, or (b) named trackpoints in the GPX layer, or (d) 121 * timestamp on the wavfile (e) (in future) voice recognised markers in the sound recording (f)125 * timestamp on the audio file (e) (in future) voice recognised markers in the sound recording (f) 122 126 * a single marker at the beginning of the track 123 * @param wavFile the file to be associated with the markers in the new marker layer127 * @param audioFile the file to be associated with the markers in the new marker layer 124 128 * @param ml marker layer 125 129 * @param firstStartTime first start time in milliseconds, used for (d) 126 130 * @param markers keeps track of warning messages to avoid repeated warnings 127 131 */ 128 private void importAudio(File wavFile, MarkerLayer ml, double firstStartTime, Markers markers) {129 URL url = Utils.fileToURL( wavFile);132 private void importAudio(File audioFile, MarkerLayer ml, double firstStartTime, Markers markers) { 133 URL url = Utils.fileToURL(audioFile); 130 134 boolean hasTracks = layer.data.tracks != null && !layer.data.tracks.isEmpty(); 131 135 boolean hasWaypoints = layer.data.waypoints != null && !layer.data.waypoints.isEmpty(); … … 212 216 // (d) use timestamp of file as location on track 213 217 if (hasTracks && Main.pref.getBoolean("marker.audiofromwavtimestamps", false)) { 214 double lastModified = wavFile.lastModified() / 1000.0; // lastModified is in 215 // milliseconds 216 double duration = AudioUtil.getCalibratedDuration(wavFile); 218 double lastModified = audioFile.lastModified() / 1000.0; // lastModified is in milliseconds 219 double duration = AudioUtil.getCalibratedDuration(audioFile); 217 220 double startTime = lastModified - duration; 218 221 startTime = firstStartTime + (startTime - firstStartTime) … … 242 245 (startTime - w1.time) / (w2.time - w1.time))); 243 246 wayPointFromTimeStamp.time = startTime; 244 String name = wavFile.getName();247 String name = audioFile.getName(); 245 248 int dot = name.lastIndexOf('.'); 246 249 if (dot > 0) { -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/AudioMarker.java
r12326 r12328 13 13 import org.openstreetmap.josm.data.gpx.WayPoint; 14 14 import org.openstreetmap.josm.io.audio.AudioPlayer; 15 import org.openstreetmap.josm.io.audio.AudioUtil; 15 16 import org.openstreetmap.josm.tools.template_engine.TemplateEngineDataProvider; 16 17 … … 60 61 recentlyPlayedMarker = this; 61 62 } catch (IOException | InterruptedException e) { 62 Audio Player.audioMalfunction(e);63 AudioUtil.audioMalfunction(e); 63 64 } 64 65 } -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/DefaultMarkerProducers.java
r11892 r12328 44 44 if (url == null) { 45 45 return Collections.singleton(marker); 46 } else if ( urlStr.endsWith(".wav")) {46 } else if (Utils.hasExtension(urlStr, "wav", "mp3", "aac", "aif", "aiff")) { 47 47 final AudioMarker audioMarker = new AudioMarker(wpt.getCoor(), wpt, url, parentLayer, time, offset); 48 48 Extensions exts = (Extensions) wpt.get(GpxConstants.META_EXTENSIONS); … … 55 55 } 56 56 return Arrays.asList(marker, audioMarker); 57 } else if (urlStr.endsWith(".png") || urlStr.endsWith(".jpg") || urlStr.endsWith(".jpeg") 58 || urlStr.endsWith(".gif")) { 57 } else if (Utils.hasExtension(urlStr, "png", "jpg", "jpeg", "gif")) { 59 58 return Arrays.asList(marker, new ImageMarker(wpt.getCoor(), url, parentLayer, time, offset)); 60 59 } else { -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/Marker.java
r11892 r12328 53 53 * 54 54 * By default, one the list contains one default "Maker" implementation that 55 * will create AudioMarkers for .wav files, ImageMarkers for .png/.jpg/.jpeg55 * will create AudioMarkers for supported audio files, ImageMarkers for supported image 56 56 * files, and WebMarkers for everything else. (The creation of a WebMarker will 57 57 * fail if there's no valid URL in the <link> tag, so it might still make sense -
trunk/src/org/openstreetmap/josm/gui/layer/markerlayer/PlayHeadMarker.java
r12326 r12328 25 25 import org.openstreetmap.josm.gui.layer.GpxLayer; 26 26 import org.openstreetmap.josm.io.audio.AudioPlayer; 27 import org.openstreetmap.josm.io.audio.AudioUtil; 27 28 28 29 /** … … 100 101 AudioPlayer.pause(); 101 102 } catch (IOException | InterruptedException ex) { 102 Audio Player.audioMalfunction(ex);103 AudioUtil.audioMalfunction(ex); 103 104 } 104 105 } … … 114 115 AudioPlayer.pause(); 115 116 } catch (IOException | InterruptedException ex) { 116 Audio Player.audioMalfunction(ex);117 AudioUtil.audioMalfunction(ex); 117 118 } 118 119 }
Note:
See TracChangeset
for help on using the changeset viewer.