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

Last change on this file was 12846, checked in by bastiK, 7 years ago

see #15229 - use Config.getPref() wherever possible

  • Property svn:eol-style set to native
File size: 1.4 KB
RevLine 
[6380]1// License: GPL. For details, see LICENSE file.
[626]2package org.openstreetmap.josm.actions.audio;
3
[582]4import static org.openstreetmap.josm.tools.I18n.tr;
[2842]5import static org.openstreetmap.josm.tools.I18n.trc;
[582]6
7import java.awt.event.ActionEvent;
8import java.awt.event.KeyEvent;
[11746]9import java.io.IOException;
[582]10
[547]11import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer;
[12326]12import org.openstreetmap.josm.io.audio.AudioPlayer;
[12328]13import org.openstreetmap.josm.io.audio.AudioUtil;
[12846]14import org.openstreetmap.josm.spi.preferences.Config;
[1084]15import org.openstreetmap.josm.tools.Shortcut;
[547]16
[5871]17/**
18 * Jump the audio forward 10 seconds.
19 * @since 547
20 */
[12565]21public 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}
Note: See TracBrowser for help on using the repository browser.