source: josm/trunk/src/org/openstreetmap/josm/actions/audio/AudioFwdAction.java@ 12346

Last change on this file since 12346 was 12328, checked in by Don-vip, 7 years ago

fix #2089 - Add support for MP3, AIFF and AAC audio codecs (.mp3, .aac, .aif, .aiff files) if Java FX is on the classpath (i.e. Windows, macOS, nearly all major Linux distributions). The classes are not public on purpose, as the whole system will have to be simplified when all Linux distributions propose Java FX and so we can get rid of old Java Sound implementation.

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.audio;
3
4import static org.openstreetmap.josm.tools.I18n.tr;
5import static org.openstreetmap.josm.tools.I18n.trc;
6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
9import java.io.IOException;
10
11import org.openstreetmap.josm.Main;
12import org.openstreetmap.josm.actions.JosmAction;
13import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
14import org.openstreetmap.josm.io.audio.AudioPlayer;
15import org.openstreetmap.josm.io.audio.AudioUtil;
16import org.openstreetmap.josm.tools.Shortcut;
17
18/**
19 * Jump the audio forward 10 seconds.
20 * @since 547
21 */
22public class AudioFwdAction extends JosmAction {
23
24 /**
25 * Constructs a new {@code AudioFwdAction}.
26 */
27 public AudioFwdAction() {
28 super(trc("audio", "Forward"), "audio-fwd", trc("audio", "Jump forward"),
29 Shortcut.registerShortcut("audio:forward", tr("Audio: {0}", trc("audio", "Forward")), KeyEvent.VK_F7, Shortcut.DIRECT), true);
30 }
31
32 @Override
33 public void actionPerformed(ActionEvent e) {
34 try {
35 if (AudioPlayer.playing() || AudioPlayer.paused())
36 AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position()
37 + Main.pref.getDouble("audio.forwardbackamount", 10.0));
38 else
39 MarkerLayer.playAudio();
40 } catch (IOException | InterruptedException ex) {
41 AudioUtil.audioMalfunction(ex);
42 }
43 }
44}
Note: See TracBrowser for help on using the repository browser.