| [6380] | 1 | // License: GPL. For details, see LICENSE file.
|
|---|
| [626] | 2 | package org.openstreetmap.josm.actions.audio;
|
|---|
| 3 |
|
|---|
| [582] | 4 | import static org.openstreetmap.josm.tools.I18n.tr;
|
|---|
| [2842] | 5 | import static org.openstreetmap.josm.tools.I18n.trc;
|
|---|
| [582] | 6 |
|
|---|
| 7 | import java.awt.event.ActionEvent;
|
|---|
| 8 | import java.awt.event.KeyEvent;
|
|---|
| [11746] | 9 | import java.io.IOException;
|
|---|
| [582] | 10 |
|
|---|
| [547] | 11 | import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
|
|---|
| [12326] | 12 | import org.openstreetmap.josm.io.audio.AudioPlayer;
|
|---|
| [12328] | 13 | import org.openstreetmap.josm.io.audio.AudioUtil;
|
|---|
| [12846] | 14 | import org.openstreetmap.josm.spi.preferences.Config;
|
|---|
| [1084] | 15 | import org.openstreetmap.josm.tools.Shortcut;
|
|---|
| [547] | 16 |
|
|---|
| [5871] | 17 | /**
|
|---|
| 18 | * Jump the audio forward 10 seconds.
|
|---|
| 19 | * @since 547
|
|---|
| 20 | */
|
|---|
| [12565] | 21 | public class AudioFwdAction extends AbstractAudioAction {
|
|---|
| [6069] | 22 |
|
|---|
| [5871] | 23 | /**
|
|---|
| 24 | * Constructs a new {@code AudioFwdAction}.
|
|---|
| 25 | */
|
|---|
| [1169] | 26 | public AudioFwdAction() {
|
|---|
| [2857] | 27 | super(trc("audio", "Forward"), "audio-fwd", trc("audio", "Jump forward"),
|
|---|
| [4982] | 28 | Shortcut.registerShortcut("audio:forward", tr("Audio: {0}", trc("audio", "Forward")), KeyEvent.VK_F7, Shortcut.DIRECT), true);
|
|---|
| [1169] | 29 | }
|
|---|
| [626] | 30 |
|
|---|
| [6084] | 31 | @Override
|
|---|
| [1169] | 32 | public void actionPerformed(ActionEvent e) {
|
|---|
| 33 | try {
|
|---|
| 34 | if (AudioPlayer.playing() || AudioPlayer.paused())
|
|---|
| [1245] | 35 | AudioPlayer.play(AudioPlayer.url(), AudioPlayer.position()
|
|---|
| [12846] | 36 | + Config.getPref().getDouble("audio.forwardbackamount", 10.0));
|
|---|
| [1169] | 37 | else
|
|---|
| 38 | MarkerLayer.playAudio();
|
|---|
| [11746] | 39 | } catch (IOException | InterruptedException ex) {
|
|---|
| [12328] | 40 | AudioUtil.audioMalfunction(ex);
|
|---|
| [1169] | 41 | }
|
|---|
| 42 | }
|
|---|
| [626] | 43 | }
|
|---|