Package com.tagtraum.audiokern
Interface AudioPlayer
-
- All Known Subinterfaces:
PlayListPlayer
- All Known Implementing Classes:
AVPlayer,CompositePlayer,InternalPlayer,ITunesPlayerComponent,JavaPlayer,Player
public interface AudioPlayerAudio player.- Author:
- Hendrik Schreiber
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddAudioPlayerListener(AudioPlayerListener listener)voidaddPropertyChangeListener(PropertyChangeListener propertyChangeListener)voidaddPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)voidclose()Closes the audio file and associated player resources.voidfastForward()Plays the file forward at accelerated speed.AudioDevicegetAudioDevice()Current audio device.longgetDuration()Duration of the song in ms.ReplayGain.TypegetReplayGainType()Currently configured type of replay gain.AudioSonggetSong()Returns the currently opened song.longgetTime()Returns the current time in ms.floatgetVolume()Returns the volume.booleanisDone()True, if the song was played to the end.booleanisMuted()Indicates whether the player is muted.booleanisPaused()Indicates whether the song is currently playing.voidopen(AudioSong song)Opens a song.voidpause()Stops playback.voidplay()Starts playback.voidplayPause()Starts playback, if song is paused, otherwise pauses playback.voidremoveAudioPlayerListener(AudioPlayerListener listener)voidremovePropertyChangeListener(PropertyChangeListener propertyChangeListener)voidremovePropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)voidreset()Positions the player at the beginning of the file.voidsetAudioDevice(AudioDevice audioDevice)Sets the desired audio device.voidsetMuted(boolean muted)Un/mutes this player.voidsetReplayGainType(ReplayGain.Type type)Asks the player to respect the given kind of replay gain.voidsetTime(long time)Sets the current time in ms.voidsetVolume(float volume)Changes the volume.
-
-
-
Method Detail
-
setAudioDevice
void setAudioDevice(AudioDevice audioDevice) throws IllegalArgumentException
Sets the desired audio device.- Parameters:
audioDevice- audio device- Throws:
IllegalArgumentException- if the device is not supported
-
getAudioDevice
AudioDevice getAudioDevice()
Current audio device.- Returns:
- currently used audio device
-
getSong
AudioSong getSong()
Returns the currently opened song.- Returns:
- currently opened song
-
open
void open(AudioSong song) throws IOException
- Parameters:
song- song- Throws:
IOException- if the song cannot be opened
-
play
void play()
Starts playback.
-
pause
void pause()
Stops playback.
-
playPause
void playPause()
Starts playback, if song is paused, otherwise pauses playback.
-
fastForward
void fastForward()
Plays the file forward at accelerated speed.
-
close
void close()
Closes the audio file and associated player resources.
-
reset
void reset()
Positions the player at the beginning of the file. Equivalent to callingsetTime(long)with 0 as argument.- See Also:
setTime(long)
-
getTime
long getTime()
Returns the current time in ms.- Returns:
- current time in ms
-
setTime
void setTime(long time) throws IllegalArgumentExceptionSets the current time in ms.- Parameters:
time- time in ms- Throws:
IllegalArgumentException- if the time is not valid because it is either less than 0 or greater than duration- See Also:
reset(),getDuration()
-
getDuration
long getDuration()
Duration of the song in ms.- Returns:
- the overall duration of the song in ms.
-
isDone
boolean isDone()
True, if the song was played to the end.- Returns:
- true if the song was played to the end.
-
isPaused
boolean isPaused()
Indicates whether the song is currently playing.- Returns:
- false if the song is playing
-
getVolume
float getVolume()
Returns the volume.- Returns:
- value between -1 and 1, negative values equating to silence
-
setVolume
void setVolume(float volume) throws IllegalArgumentExceptionChanges the volume.- Parameters:
volume- value between -1 and 1, negative values equating to silence. A volume value outside the valid range will lead to an IllegalArgumentException- Throws:
IllegalArgumentException- if the value is outside the valid range
-
setMuted
void setMuted(boolean muted)
Un/mutes this player.- Parameters:
muted- muted
-
isMuted
boolean isMuted()
Indicates whether the player is muted.- Returns:
- true to false
-
setReplayGainType
void setReplayGainType(ReplayGain.Type type)
Asks the player to respect the given kind of replay gain. Some players may ignore this property.- Parameters:
type- type
-
getReplayGainType
ReplayGain.Type getReplayGainType()
Currently configured type of replay gain.- Returns:
- replay gain type
-
addPropertyChangeListener
void addPropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
-
removePropertyChangeListener
void removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
-
addPropertyChangeListener
void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
-
removePropertyChangeListener
void removePropertyChangeListener(String propertyName, PropertyChangeListener propertyChangeListener)
-
addAudioPlayerListener
void addAudioPlayerListener(AudioPlayerListener listener)
-
removeAudioPlayerListener
void removeAudioPlayerListener(AudioPlayerListener listener)
-
-