lhmc.plugins
Class BasicPlayerPlugin

java.lang.Object
  extended by lhmc.plugins.Plugin
      extended by lhmc.plugins.BasicPlayerPlugin
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.util.EventListener

public class BasicPlayerPlugin
extends Plugin
implements java.awt.event.KeyListener, java.awt.event.FocusListener

BasicPlayerPlugin executes a single sound file or a directory of files making a playlist. When a file is played a play panel is showed. It supports MP3, OGG Vorbis, FLAC, MONKEY's AUDIO, WAV, AIFF, AU and SPEEX audio formats.

Version:
0.01 Mar 2007
Author:
Cristina Roura Claver

Field Summary
protected  java.util.Map audioInfo
           
protected  PlaylistItem currentItem
           
protected  boolean isMuted
           
protected  boolean isPaused
           
protected  BasicPlayer player
           
protected  float positonValue
           
protected  double volume
           
 
Fields inherited from class lhmc.plugins.Plugin
backupFrame, mainFrame
 
Constructor Summary
BasicPlayerPlugin()
          Constructs the basic player plugin.
 
Method Summary
 void display(java.lang.String msg)
          Displays a message.
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void opened(java.lang.Object stream, java.util.Map properties)
          Open callback, stream is ready to play.
 void play(java.net.URL url)
          Shows the play panel and plays a single song.
 void playAll(java.net.URL file)
          Shows the play panel and creates a playlist for all the songs in the current directory, and plays one by one.
 void progress(int bytesread, long microseconds, byte[] pcmdata, java.util.Map properties)
          Progress callback while playing.
 void run(java.net.URL urlFile)
          Starts to play a song.
 void setController(BasicController controller)
          A handle to the BasicPlayer, plugins may control the player through the controller (play, stop, ...)
 void stateUpdated(BasicPlayerEvent event)
          Notification callback for basicplayer events such as opened, eom ...
 
Methods inherited from class lhmc.plugins.Plugin
setMainFrame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

player

protected BasicPlayer player

currentItem

protected PlaylistItem currentItem

audioInfo

protected java.util.Map audioInfo

positonValue

protected float positonValue

volume

protected double volume

isPaused

protected boolean isPaused

isMuted

protected boolean isMuted
Constructor Detail

BasicPlayerPlugin

public BasicPlayerPlugin()
Constructs the basic player plugin.

Method Detail

play

public void play(java.net.URL url)
Shows the play panel and plays a single song.

Specified by:
play in class Plugin
Parameters:
url - the song to play.

playAll

public void playAll(java.net.URL file)
Shows the play panel and creates a playlist for all the songs in the current directory, and plays one by one.

Specified by:
playAll in class Plugin
Parameters:
file - the songs directory to play.

run

public void run(java.net.URL urlFile)
Starts to play a song.

Parameters:
urlFile - the song file.

opened

public void opened(java.lang.Object stream,
                   java.util.Map properties)
Open callback, stream is ready to play. properties map includes audio format dependant features such as bitrate, duration, frequency, channels, number of frames, vbr flag, id3v2/id3v1 (for MP3 only), comments (for Ogg Vorbis), ...

Parameters:
stream - could be File, URL or InputStream
properties - audio stream properties.

progress

public void progress(int bytesread,
                     long microseconds,
                     byte[] pcmdata,
                     java.util.Map properties)
Progress callback while playing. This method is called severals time per seconds while playing. properties map includes audio format features such as instant bitrate, microseconds position, current frame number, ...

Parameters:
bytesread - from encoded stream.
microseconds - elapsed (reseted after a seek !).
pcmdata - PCM samples.
properties - audio stream parameters.

stateUpdated

public void stateUpdated(BasicPlayerEvent event)
Notification callback for basicplayer events such as opened, eom ...

Parameters:
event -

setController

public void setController(BasicController controller)
A handle to the BasicPlayer, plugins may control the player through the controller (play, stop, ...)

Parameters:
controller - : a handle to the player

display

public void display(java.lang.String msg)
Displays a message.

Parameters:
msg - A string of the message.

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener