Package org.openstreetmap.josm.io.audio
Class JavaSoundPlayer
java.lang.Object
org.openstreetmap.josm.io.audio.JavaSoundPlayer
- All Implemented Interfaces:
SoundPlayer
Legacy sound player based on the Java Sound API.
Used on platforms where Java FX is not yet available. It supports only WAV files.
- Since:
- 12328
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final byte[]private AudioInputStreamprivate SourceDataLineprivate doubleprivate final doubleprivate static final intprivate final doubleprivate final ListenerList<AudioListener>private doubleprivate double -
Constructor Summary
Constructors -
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.
-
Field Details
-
chunk
- See Also:
-
audioInputStream
-
audioOutputLine
-
leadIn
-
calibration
-
bytesPerSecond
-
abData
-
position
-
speed
-
listeners
-
-
Constructor Details
-
JavaSoundPlayer
JavaSoundPlayer(double leadIn, double calibration)
-
-
Method Details
-
play
public void play(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl) throws AudioException, IOException Description copied from interface:SoundPlayerAsk player to play a new media.- Specified by:
playin interfaceSoundPlayer- 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
public void pause(AudioPlayer.Execute command, AudioPlayer.State stateChange, URL playingUrl) throws AudioException, IOException Description copied from interface:SoundPlayerAsk player to pause the current playing media.- Specified by:
pausein interfaceSoundPlayer- 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
public boolean playing(AudioPlayer.Execute command) throws AudioException, IOException, InterruptedException Description copied from interface:SoundPlayerMethod called when a media is being played.- Specified by:
playingin interfaceSoundPlayer- 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
Description copied from interface:SoundPlayerReturns the media playback position, in seconds.- Specified by:
positionin interfaceSoundPlayer- Returns:
- the media playback position, in seconds
-
speed
Description copied from interface:SoundPlayerReturns the media playback speed ratio.- Specified by:
speedin interfaceSoundPlayer- Returns:
- the media playback speed ratio
-
addAudioListener
Description copied from interface:SoundPlayerAdds a listener that will be notified of audio playback events.- Specified by:
addAudioListenerin interfaceSoundPlayer- Parameters:
listener- audio listener
-