Package org.openstreetmap.josm.io.audio
Interface SoundPlayer
- All Known Implementing Classes:
JavaSoundPlayer
public interface SoundPlayer
Sound player interface. Implementations can be backed up by Java Sound API or Java FX Media API.
- Since:
- 12328
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAudioListener(AudioListener listener) Adds a listener that will be notified of audio playback events.voidpause(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl) Ask player to pause the current playing media.voidplay(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl) Ask player to play a new media.booleanplaying(AudioPlayer.Execute command) Method called when a media is being played.doubleposition()Returns the media playback position, in seconds.doublespeed()Returns the media playback speed ratio.
-
Method Details
-
play
void play(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl) throws AudioException, IOException Ask player to play a new media.- Parameters:
command- Command containing media informationstateChange- the previous stateplayingUrl- the currently playing URL, if any- Throws:
AudioException- if an audio error occursIOException- if an I/O error occurs
-
pause
void pause(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl) throws AudioException, IOException Ask player to pause the current playing media.- Parameters:
command- Command containing media informationstateChange- the previous stateplayingUrl- the currently playing URL, if any- Throws:
AudioException- if an audio error occursIOException- if an I/O error occurs
-
playing
boolean playing(AudioPlayer.Execute command) throws AudioException, IOException, InterruptedException Method called when a media is being played.- Parameters:
command- Command containing media information- Returns:
trueif the playing call was blocking, and the playback is finished when this method returns- Throws:
AudioException- if an audio error occursIOException- if an I/O error occursInterruptedException- if the play is interrupted
-
position
double position()Returns the media playback position, in seconds.- Returns:
- the media playback position, in seconds
-
speed
double speed()Returns the media playback speed ratio.- Returns:
- the media playback speed ratio
-
addAudioListener
Adds a listener that will be notified of audio playback events.- Parameters:
listener- audio listener
-