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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddAudioListener(AudioListener listener)Adds a listener that will be notified of audio playback events.voidpause(AudioPlayer.Execute command, AudioPlayer.State stateChange, java.net.URL playingUrl)Ask player to pause the current playing media.voidplay(AudioPlayer.Execute command, AudioPlayer.State stateChange, java.net.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 Detail
-
play
void play(AudioPlayer.Execute command, AudioPlayer.State stateChange, java.net.URL playingUrl) throws AudioException, java.io.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 occursjava.io.IOException- if an I/O error occurs
-
pause
void pause(AudioPlayer.Execute command, AudioPlayer.State stateChange, java.net.URL playingUrl) throws AudioException, java.io.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 occursjava.io.IOException- if an I/O error occurs
-
playing
boolean playing(AudioPlayer.Execute command) throws AudioException, java.io.IOException, java.lang.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 occursjava.io.IOException- if an I/O error occursjava.lang.InterruptedException- 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
void addAudioListener(AudioListener listener)
Adds a listener that will be notified of audio playback events.- Parameters:
listener- audio listener
-
-