com.melloware.jukes.gui.view.component
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 com.melloware.jukes.gui.view.component.SpectrumTimeAnalyzer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, javax.accessibility.Accessible, kj.dsp.KJDigitalSignalProcessor

public final class SpectrumTimeAnalyzer
extends javax.swing.JPanel
implements kj.dsp.KJDigitalSignalProcessor

Spectrum Analyzer component to display visualizations in the Jukes.

Copyright (c) 1999-2007 Melloware, Inc.

Version:
4.0
Author:
Emil A. Lefkof III
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.lang.String ANALYZER
           
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
           
static java.lang.String OFF
           
static java.lang.String SCOPE
           
 
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
 java.awt.Color getColor(java.lang.String linecolor)
          Convert string to color.
static java.awt.Color[] getDefaultSpectrumAnalyserColors()
           
 int getDisplayMode()
           
 kj.dsp.KJDigitalSignalProcessingAudioDataConsumer getDSP()
          Return DSP.
 int getPeakDelay()
          Return peak falloff delay
 java.awt.Color getScopeColor()
           
 int getSpectrumAnalyserBandCount()
           
 java.awt.Color[] getSpectrumAnalyserColors()
           
 float getSpectrumAnalyserDecay()
           
 boolean isPeaksEnabled()
           
 void paintComponent(java.awt.Graphics pGraphics)
           
 void process(float[] pLeft, float[] pRight, float pFrameRateRatioHint)
           
 void setDisplayMode(int pMode)
          Sets the current display mode.
 void setDisplayMode(java.lang.String pMode)
          Sets the display mode based on a string value of one of the String constants OFF, ANALYZER, SCOPE.
 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 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, transferFocusBackward, 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, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SCOPE

public static final java.lang.String SCOPE
See Also:
Constant Field Values

OFF

public static final java.lang.String OFF
See Also:
Constant Field Values

ANALYZER

public static final java.lang.String ANALYZER
See Also:
Constant Field Values

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

isPeaksEnabled

public boolean isPeaksEnabled()

setPeaksEnabled

public void setPeaksEnabled(boolean peaksEnabled)

startDSP

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

Parameters:
line -

stopDSP

public void stopDSP()
Stop 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 kj.dsp.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.

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)
Specified by:
process in interface kj.dsp.KJDigitalSignalProcessor

setDisplayMode

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

Parameters:
pMode - Must be either DISPLAY_MODE_SCOPE or DISPLAY_MODE_SPECTRUM_ANALYSER.

setDisplayMode

public void setDisplayMode(java.lang.String pMode)
Sets the display mode based on a string value of one of the String constants OFF, ANALYZER, SCOPE.

Parameters:
pMode - the string value of which mode to set

setScopeColor

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

Parameters:
pColor -

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.


Copyright © 1999-2008 Melloware Inc. All Rights Reserved.