javazoom.jlgui.player.amp.visual.ui
Class SpectrumTimeAnalyzer

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by javazoom.jlgui.player.amp.visual.ui.SpectrumTimeAnalyzer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible

public class SpectrumTimeAnalyzer
extends javax.swing.JPanel

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JPanel
javax.swing.JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
static java.awt.Color DEFAULT_BACKGROUND_COLOR
           
static int DEFAULT_FPS
           
static int DEFAULT_HEIGHT
           
static java.awt.Color DEFAULT_SCOPE_COLOR
           
static int DEFAULT_SPECTRUM_ANALYSER_BAND_COUNT
           
static float DEFAULT_SPECTRUM_ANALYSER_DECAY
           
static int DEFAULT_SPECTRUM_ANALYSER_FFT_SAMPLE_SIZE
           
static int DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY
           
static float DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO
           
static float DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO_RANGE
           
static float DEFAULT_VU_METER_DECAY
           
static int DEFAULT_WIDTH
           
static int DISPLAY_MODE_OFF
           
static int DISPLAY_MODE_SCOPE
           
static int DISPLAY_MODE_SPECTRUM_ANALYSER
           
static float MAX_SPECTRUM_ANALYSER_DECAY
           
static float MIN_SPECTRUM_ANALYSER_DECAY
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, 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
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
SpectrumTimeAnalyzer()
           
 
Method Summary
 void closeDSP()
          Close DSP
 java.awt.Color getColor(java.lang.String linecolor)
          Convert string to color.
 AbsoluteConstraints getConstraints()
           
static java.awt.Color[] getDefaultSpectrumAnalyserColors()
           
 int getDisplayMode()
           
 KJDigitalSignalProcessingAudioDataConsumer getDSP()
          Return DSP.
 int getFps()
           
 int getPeakDelay()
          Return peak falloff delay
 java.awt.Color getScopeColor()
           
 int getSpectrumAnalyserBandCount()
           
 java.awt.Color[] getSpectrumAnalyserColors()
           
 float getSpectrumAnalyserDecay()
           
 boolean isPeaksEnabled()
           
 boolean isShowingFPS()
           
 void paintComponent(java.awt.Graphics pGraphics)
           
 void process(float[] pLeft, float[] pRight, float pFrameRateRatioHint)
           
 void setConstraints(AbsoluteConstraints cnts)
           
 void setDisplayMode(int pMode)
          Sets the current display mode.
 void setFps(int fps)
           
 void setPeakColor(java.awt.Color c)
          Set visual peak color.
 void setPeakDelay(int framestowait)
          Set peak falloff delay.
 void setPeaksEnabled(boolean peaksEnabled)
           
 void setScopeColor(java.awt.Color pColor)
          Sets the color of the scope.
 void setShowFPS(boolean pState)
          When 'true' is passed as a parameter, will overlay the "Frames Per Seconds" achieved by the component.
 void setSpectrumAnalyserBandCount(int pCount)
          Sets the numbers of bands rendered by the spectrum analyser.
 void setSpectrumAnalyserColors(java.awt.Color[] pColors)
          Sets the spectrum analyser color scale.
 void setSpectrumAnalyserDecay(float pDecay)
          Sets the spectrum analyser band decay rate.
 void setSpectrumAnalyserFFTSampleSize(int pSize)
          Sets the FFT sample size to be just for calculating the spectrum analyser values.
 void setupDSP(javax.sound.sampled.SourceDataLine line)
          Setup DSP.
 void setVisColor(java.lang.String viscolor)
          Set visual colors from skin.
 void startDSP(javax.sound.sampled.SourceDataLine line)
          Starts DSP.
 void stopDSP()
          Stop DSP.
 void writeDSP(byte[] pcmdata)
          Write PCM data to DSP.
 
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, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, 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, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DISPLAY_MODE_SCOPE

public static final int DISPLAY_MODE_SCOPE
See Also:
Constant Field Values

DISPLAY_MODE_SPECTRUM_ANALYSER

public static final int DISPLAY_MODE_SPECTRUM_ANALYSER
See Also:
Constant Field Values

DISPLAY_MODE_OFF

public static final int DISPLAY_MODE_OFF
See Also:
Constant Field Values

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
See Also:
Constant Field Values

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
See Also:
Constant Field Values

DEFAULT_FPS

public static final int DEFAULT_FPS
See Also:
Constant Field Values

DEFAULT_SPECTRUM_ANALYSER_FFT_SAMPLE_SIZE

public static final int DEFAULT_SPECTRUM_ANALYSER_FFT_SAMPLE_SIZE
See Also:
Constant Field Values

DEFAULT_SPECTRUM_ANALYSER_BAND_COUNT

public static final int DEFAULT_SPECTRUM_ANALYSER_BAND_COUNT
See Also:
Constant Field Values

DEFAULT_SPECTRUM_ANALYSER_DECAY

public static final float DEFAULT_SPECTRUM_ANALYSER_DECAY
See Also:
Constant Field Values

DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY

public static final int DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY
See Also:
Constant Field Values

DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO

public static final float DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO
See Also:
Constant Field Values

DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO_RANGE

public static final float DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO_RANGE
See Also:
Constant Field Values

MIN_SPECTRUM_ANALYSER_DECAY

public static final float MIN_SPECTRUM_ANALYSER_DECAY
See Also:
Constant Field Values

MAX_SPECTRUM_ANALYSER_DECAY

public static final float MAX_SPECTRUM_ANALYSER_DECAY
See Also:
Constant Field Values

DEFAULT_BACKGROUND_COLOR

public static final java.awt.Color DEFAULT_BACKGROUND_COLOR

DEFAULT_SCOPE_COLOR

public static final java.awt.Color DEFAULT_SCOPE_COLOR

DEFAULT_VU_METER_DECAY

public static final float DEFAULT_VU_METER_DECAY
See Also:
Constant Field Values
Constructor Detail

SpectrumTimeAnalyzer

public SpectrumTimeAnalyzer()
Method Detail

setConstraints

public void setConstraints(AbsoluteConstraints cnts)

getConstraints

public AbsoluteConstraints getConstraints()

isPeaksEnabled

public boolean isPeaksEnabled()

setPeaksEnabled

public void setPeaksEnabled(boolean peaksEnabled)

getFps

public int getFps()

setFps

public void setFps(int fps)

startDSP

public void startDSP(javax.sound.sampled.SourceDataLine line)
Starts DSP.

Parameters:
line -

stopDSP

public void stopDSP()
Stop DSP.


closeDSP

public void closeDSP()
Close DSP


setupDSP

public void setupDSP(javax.sound.sampled.SourceDataLine line)
Setup DSP.

Parameters:
line -

writeDSP

public void writeDSP(byte[] pcmdata)
Write PCM data to DSP.

Parameters:
pcmdata -

getDSP

public KJDigitalSignalProcessingAudioDataConsumer getDSP()
Return DSP.

Returns:

setVisColor

public void setVisColor(java.lang.String viscolor)
Set visual colors from skin.

Parameters:
viscolor -

setPeakColor

public void setPeakColor(java.awt.Color c)
Set visual peak color.

Parameters:
c -

setPeakDelay

public void setPeakDelay(int framestowait)
Set peak falloff delay.

Parameters:
framestowait -

getPeakDelay

public int getPeakDelay()
Return peak falloff delay

Returns:
int framestowait

getColor

public java.awt.Color getColor(java.lang.String linecolor)
Convert string to color.

Parameters:
linecolor -
Returns:

getDefaultSpectrumAnalyserColors

public static java.awt.Color[] getDefaultSpectrumAnalyserColors()

getDisplayMode

public int getDisplayMode()
Returns:
Returns the current display mode, DISPLAY_MODE_SCOPE or DISPLAY_MODE_SPECTRUM_ANALYSER.

getSpectrumAnalyserBandCount

public int getSpectrumAnalyserBandCount()
Returns:
Returns the current number of bands displayed by the spectrum analyser.

getSpectrumAnalyserDecay

public float getSpectrumAnalyserDecay()
Returns:
Returns the decay rate of the spectrum analyser's bands.

getScopeColor

public java.awt.Color getScopeColor()
Returns:
Returns the color the scope is rendered in.

getSpectrumAnalyserColors

public java.awt.Color[] getSpectrumAnalyserColors()
Returns:
Returns the color scale used to render the spectrum analyser bars.

isShowingFPS

public boolean isShowingFPS()
Returns:
Returns 'true' if "Frames Per Second" are being calculated and displayed.

paintComponent

public void paintComponent(java.awt.Graphics pGraphics)
Overrides:
paintComponent in class javax.swing.JComponent

process

public void process(float[] pLeft,
                    float[] pRight,
                    float pFrameRateRatioHint)

setDisplayMode

public void setDisplayMode(int pMode)
Sets the current display mode.

Parameters:
pMode - Must be either DISPLAY_MODE_SCOPE or DISPLAY_MODE_SPECTRUM_ANALYSER.

setScopeColor

public void setScopeColor(java.awt.Color pColor)
Sets the color of the scope.

Parameters:
pColor -

setShowFPS

public void setShowFPS(boolean pState)
When 'true' is passed as a parameter, will overlay the "Frames Per Seconds" achieved by the component.

Parameters:
pState -

setSpectrumAnalyserBandCount

public void setSpectrumAnalyserBandCount(int pCount)
Sets the numbers of bands rendered by the spectrum analyser.

Parameters:
pCount - Cannot be more than half the "FFT sample size".

setSpectrumAnalyserDecay

public void setSpectrumAnalyserDecay(float pDecay)
Sets the spectrum analyser band decay rate.

Parameters:
pDecay - Must be a number between 0.0 and 1.0 exclusive.

setSpectrumAnalyserColors

public void setSpectrumAnalyserColors(java.awt.Color[] pColors)
Sets the spectrum analyser color scale.

Parameters:
pColors - Any amount of colors may be used. Must not be null.

setSpectrumAnalyserFFTSampleSize

public void setSpectrumAnalyserFFTSampleSize(int pSize)
Sets the FFT sample size to be just for calculating the spectrum analyser values. The default is 512.

Parameters:
pSize - Cannot be more than the size of the sample provided by the DSP.


JavaZOOM 1999-2006