Package org.xiph.speex.player
Class Player
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.xiph.speex.player.Player
- All Implemented Interfaces:
ActionListener
,ImageObserver
,MenuContainer
,Serializable
,EventListener
,Accessible
- Direct Known Subclasses:
Recorder
JavaSound Player.
Here is the Finite State Machine describing it's state.
+----+ |Init| +----+ V ----->+----+ / >|Stop| \ / / +----+invalid input: '<' \ / / \ V | +-----+ ---> +----+ | |Pause| |Play| | +-----+ invalid input: '<'--- +----+ \ A / A \ \+----+invalid input: '<' / ------|Buff| / +----+
- Version:
- $Revision: 1.2 $
- Author:
- Marc Gimpel, Wimba S.A. (mgimpel@horizonwimba.com)
- See Also:
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected URL
protected String
protected int
static final String
Build Numberprotected int
Previous State of the Finite State Machineprotected JButton
Pause Buttonprotected Player.Playback
protected JButton
Play Buttonprotected JPanel
The Players Button Panelprotected JPanel
The Players Scroll Panelprotected JSlider
Progress Barstatic final String
Revision Numberprotected int
Current State of the Finite State Machineprotected static final int
Finite State Machine State: Bufferingprotected static final int
Finite State Machine State: Errorprotected static final int
Finite State Machine State: Initialisedprotected static final int
Finite State Machine State: Pausedprotected static final int
Finite State Machine State: Playingprotected static final int
Finite State Machine State: Stoppedprotected JButton
Stop Buttonprotected Timer
static final String
Version NumberFields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Process Actions when button are pressed.protected static JButton
buildButton
(String actionCommand, String toolTip, String pathIconDefault, String pathIconDisabled, String pathIconRollover, ActionListener listener) Build a Button.protected void
Create the ButtonPanel for the player.protected void
Create GUI for the player.protected static ImageIcon
createImageIcon
(String path) Returns an ImageIcon, or null if the path was invalid.protected void
Create the ScrollPanel for the player.protected InputStream
Returns an InputSteam containing the Audio to playback.protected int
Return the progress of the playback.void
init()
Initialize the Player Component.static void
Command Line entrance.void
pauseIt()
Pausevoid
playIt()
void
start()
Start the Player Component.void
stop()
Stop the Player Component.void
stopIt()
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Field Details
-
BUILD
Build Number- See Also:
-
VERSION
Version Number- See Also:
-
REVISION
Revision Number- See Also:
-
STATE_INIT
protected static final int STATE_INITFinite State Machine State: Initialised- See Also:
-
STATE_STOPPED
protected static final int STATE_STOPPEDFinite State Machine State: Stopped- See Also:
-
STATE_PLAYING
protected static final int STATE_PLAYINGFinite State Machine State: Playing- See Also:
-
STATE_PAUSED
protected static final int STATE_PAUSEDFinite State Machine State: Paused- See Also:
-
STATE_BUFFERING
protected static final int STATE_BUFFERINGFinite State Machine State: Buffering- See Also:
-
STATE_ERROR
protected static final int STATE_ERRORFinite State Machine State: Error- See Also:
-
playerScrollPane
The Players Scroll Panel -
playerButtonPane
The Players Button Panel -
playButton
Play Button -
pauseButton
Pause Button -
stopButton
Stop Button -
progressBar
Progress Bar -
timer
-
state
protected int stateCurrent State of the Finite State Machine -
oldstate
protected int oldstatePrevious State of the Finite State Machine -
audioFilename
-
audioFile
-
audioLength
protected int audioLength -
playback
-
-
Constructor Details
-
Player
Build a Player.- Parameters:
file
-
-
-
Method Details
-
main
Command Line entrance.- Parameters:
args
-
-
init
public void init()Initialize the Player Component. -
start
public void start()Start the Player Component. -
stop
public void stop()Stop the Player Component. -
getAudioStream
Returns an InputSteam containing the Audio to playback.- Returns:
- an InputSteam containing the Audio to playback.
- Throws:
IOException
-
actionPerformed
Process Actions when button are pressed. Implemented from ActionListener interface.- Specified by:
actionPerformed
in interfaceActionListener
- Parameters:
e
-
-
stopIt
public void stopIt() -
playIt
public void playIt() -
pauseIt
public void pauseIt()Pause -
getProgress
protected int getProgress()Return the progress of the playback.- Returns:
- the progress of the playback.
-
createGUI
protected void createGUI()Create GUI for the player. The player panel that should look something like this:+-----------------------+ | ----|-------------- | Scroll Panel +-----------------------+ | +----+ +-----+ +----+ | | |play| |pause| |stop| | Button Panel | +----+ +-----+ +----+ | +-----------------------+
-
createScrollPanel
protected void createScrollPanel()Create the ScrollPanel for the player. The player scroll panel that should look something like this:+-----------------------+ | ----|-------------- | Scroll Panel +-----------------------+
-
createButtonPanel
protected void createButtonPanel()Create the ButtonPanel for the player. The player button panel that should look something like this:+-----------------------+ | +----+ +-----+ +----+ | | |play| |pause| |stop| | Button Panel | +----+ +-----+ +----+ | +-----------------------+
-
buildButton
protected static JButton buildButton(String actionCommand, String toolTip, String pathIconDefault, String pathIconDisabled, String pathIconRollover, ActionListener listener) Build a Button.- Parameters:
actionCommand
-toolTip
-pathIconDefault
-pathIconDisabled
-pathIconRollover
-listener
-- Returns:
- the Button that was built.
-
createImageIcon
Returns an ImageIcon, or null if the path was invalid.- Parameters:
path
-- Returns:
- an ImageIcon, or null if the path was invalid.
-