|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.atunes.kernel.handlers.PlayerHandler
public abstract class PlayerHandler
The Class PlayerHandler. This class has common logic for all player engines
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_ENGINE
Default player engine |
protected static Logger |
logger
The logger used in player engines |
Constructor Summary | |
---|---|
protected |
PlayerHandler()
Instantiates a new player handler. |
Method Summary | |
---|---|
void |
applicationFinish()
Called when application finishes |
protected abstract void |
applyEqualization(float[] values)
This method must be implemented by player engines. |
abstract void |
applyMuteState(boolean state)
This method must be implemented by player engines. |
protected abstract void |
finishPlayer()
This method must be implemented by player engines It's called when application finishes |
java.lang.String[] |
getEngineNames()
Return list of engine names as configured in settings file This method is mainly designed to be used in preferences window to select a player engine by its name |
protected float[] |
getEqualizerValues()
Returns equalizer values or null if equalizer is disabled
TODO: Add more explanation about equalizer values |
static PlayerHandler |
getInstance()
Gets the single instance of PlayerHandler. |
protected abstract boolean |
isEngineAvailable()
This method must be implemented by player engines. |
abstract boolean |
isEnginePlaying()
Checks if engine is currently playing ( true ) or not (
false ) |
protected boolean |
isMuteEnabled()
Checks if mute is enabled ( true ) or not (false ) |
protected boolean |
isPaused()
Checks if playback is paused. |
protected boolean |
isSoundNormalizationEnabled()
Checks if sound normalization is enabled ( true ) or not (
false ) |
static void |
notifyPlayerError(java.lang.Exception e)
Called when a exception is thrown related with player engine |
protected void |
notifyRadioOrPodcastFeedEntryStarted()
Notifies the handler that the radio or podcast feed entry has started playing (MPlayer bug workaround). |
protected abstract void |
pausePlayback()
This method must be implemented by player engines. |
void |
playCurrentAudioObject(boolean buttonPressed)
Starts playing current audio object from play list |
void |
playNextAudioObject(boolean autoNext)
Starts playing next audio object from play list |
void |
playPreviousAudioObject()
Starts playing previous audio object from play list |
protected abstract void |
resumePlayback()
This method must be implemented by player engines. |
void |
seekCurrentAudioObject(double position)
Seek function: play current audio object from position defined by parameter (0-100%) |
protected abstract void |
seekTo(double perCent)
This method must be implemented by player engines. |
protected void |
setCurrentAudioObjectLength(long currentLength)
Sets the length of the current audio object |
protected void |
setCurrentAudioObjectPlayedTime(long playedTime)
Sets the time played for the current audio object as playback advances |
void |
setPlayListPositionToPlay(int pos)
Sets position to play in current play list |
abstract void |
setVolume(int perCent)
This method must be implemented by player engines. |
protected abstract void |
startPlayback(AudioObject audioObjectToPlay,
AudioObject audioObject)
play this audio object |
void |
stopCurrentAudioObject(boolean userStopped)
Stops playing current audio object |
protected abstract void |
stopPlayback(boolean userStopped,
boolean useFadeAway)
This method must be implemented by player engines. |
abstract boolean |
supportsCapability(PlayerEngineCapability capability)
This method must be implemented by player engines. |
protected abstract float[] |
transformEqualizerValues(float[] values)
This method must be implemented by player engines. |
void |
volumeDown()
Lower volume |
void |
volumeUp()
Raise volume |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static Logger logger
public static final java.lang.String DEFAULT_ENGINE
Constructor Detail |
---|
protected PlayerHandler()
Method Detail |
---|
public abstract boolean isEnginePlaying()
true
) or not (
false
)
true
if engine is currently playingprotected abstract boolean isEngineAvailable()
true
if engine is available in the system and can be
used to play, false
otherwiseprotected abstract void startPlayback(AudioObject audioObjectToPlay, AudioObject audioObject)
audioObjectToPlay
- audio object to play. May be cashed to temp dirs or the same
as audioObject.audioObject
- original audio object to update statistics TODO: Change method
signature and add javadocprotected abstract void pausePlayback()
protected abstract void resumePlayback()
protected abstract void stopPlayback(boolean userStopped, boolean useFadeAway)
userStopped
- true
if stopped by user input, false
otherwise.useFadeAway
- if true
- fade away then stop. Stop immediately
otherwise.protected abstract void seekTo(double perCent)
perCent
- 0-100public abstract void setVolume(int perCent)
perCent
- 0-100public abstract void applyMuteState(boolean state)
state
- : enabled (true
) or disabled (false
)public abstract boolean supportsCapability(PlayerEngineCapability capability)
true
if engine supports capability or notprotected abstract void applyEqualization(float[] values)
values
- protected abstract float[] transformEqualizerValues(float[] values)
values
-
protected abstract void finishPlayer()
public static final PlayerHandler getInstance()
public final java.lang.String[] getEngineNames()
public final void playCurrentAudioObject(boolean buttonPressed)
buttonPressed
- TODO: Add more javadocpublic final void stopCurrentAudioObject(boolean userStopped)
userStopped
- true
if user has stopped playbackpublic final void playPreviousAudioObject()
public final void playNextAudioObject(boolean autoNext)
autoNext
- true
if this method is called because current
audio object has finished, false
if this method
is called because user has pressed the "NEXT" buttonpublic final void seekCurrentAudioObject(double position)
position
- From start of audio object (0) to end of audio object (100)public final void setPlayListPositionToPlay(int pos)
pos
- the new play list position to playpublic final void volumeDown()
public final void volumeUp()
public static final void notifyPlayerError(java.lang.Exception e)
e
- The exception thrownpublic void applicationFinish()
ApplicationFinishListener
applicationFinish
in interface ApplicationFinishListener
protected final float[] getEqualizerValues()
null
if equalizer is disabled
TODO: Add more explanation about equalizer values
protected final boolean isSoundNormalizationEnabled()
true
) or not (
false
)
true
if sound normalization is enabledprotected final boolean isMuteEnabled()
true
) or not (false
)
true
if mute is enabledprotected final void setCurrentAudioObjectLength(long currentLength)
currentLength
- The length of the current audio object in milliseconds (ms)protected final void setCurrentAudioObjectPlayedTime(long playedTime)
playedTime
- played time in milliseconds (ms)protected final boolean isPaused()
protected final void notifyRadioOrPodcastFeedEntryStarted()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |