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 void
addAudioListener(AudioListener listener)
Adds a listener that will be notified of audio playback events.void
pause(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl)
Ask player to pause the current playing media.void
play(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl)
Ask player to play a new media.boolean
playing(AudioPlayer.Execute command)
Method called when a media is being played.double
position()
Returns the media playback position, in seconds.double
speed()
Returns the media playback speed ratio.
-
-
-
Method Detail
-
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:
true
if 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
void addAudioListener(AudioListener listener)
Adds a listener that will be notified of audio playback events.- Parameters:
listener
- audio listener
-
-