source: josm/trunk/src/org/openstreetmap/josm/io/audio/SoundPlayer.java@ 14095

Last change on this file since 14095 was 13819, checked in by Don-vip, 6 years ago

see #2089, see #16047 - move JavaFX classes to their own package in order to exclude them automatically when JavaFX is not on the classpath (needed for Java 11+ now that FX is gone)

File size: 2.3 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.io.audio;
3
4import java.io.IOException;
5import java.net.URL;
6
7import org.openstreetmap.josm.io.audio.AudioPlayer.Execute;
8import org.openstreetmap.josm.io.audio.AudioPlayer.State;
9
10/**
11 * Sound player interface. Implementations can be backed up by Java Sound API or Java FX Media API.
12 * @since 12328
13 */
14public interface SoundPlayer {
15
16 /**
17 * Ask player to play a new media.
18 * @param command Command containing media information
19 * @param stateChange the previous state
20 * @param playingUrl the currently playing URL, if any
21 * @throws AudioException if an audio error occurs
22 * @throws IOException if an I/O error occurs
23 */
24 void play(Execute command, State stateChange, URL playingUrl) throws AudioException, IOException;
25
26 /**
27 * Ask player to pause the current playing media.
28 * @param command Command containing media information
29 * @param stateChange the previous state
30 * @param playingUrl the currently playing URL, if any
31 * @throws AudioException if an audio error occurs
32 * @throws IOException if an I/O error occurs
33 */
34 void pause(Execute command, State stateChange, URL playingUrl) throws AudioException, IOException;
35
36 /**
37 * Method called when a media is being played.
38 * @param command Command containing media information
39 * @return {@code true} if the playing call was blocking, and the playback is finished when this method returns
40 * @throws AudioException if an audio error occurs
41 * @throws IOException if an I/O error occurs
42 * @throws InterruptedException if the play is interrupted
43 */
44 boolean playing(Execute command) throws AudioException, IOException, InterruptedException;
45
46 /**
47 * Returns the media playback position, in seconds.
48 * @return the media playback position, in seconds
49 */
50 double position();
51
52 /**
53 * Returns the media playback speed ratio.
54 * @return the media playback speed ratio
55 */
56 double speed();
57
58 /**
59 * Adds a listener that will be notified of audio playback events.
60 * @param listener audio listener
61 */
62 void addAudioListener(AudioListener listener);
63}
Note: See TracBrowser for help on using the repository browser.