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

Last change on this file since 12328 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.

File size: 2.2 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 */
14interface 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.