javazoom.jlgui.player.amp.visual.ui

Class SpectrumTimeAnalyzer

Implemented Interfaces:
KJDigitalSignalProcessor

public class SpectrumTimeAnalyzer
extends JPanel
implements KJDigitalSignalProcessor

Field Summary

static Color
DEFAULT_BACKGROUND_COLOR
static int
DEFAULT_FPS
static int
DEFAULT_HEIGHT
static 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

Constructor Summary

SpectrumTimeAnalyzer()

Method Summary

void
closeDSP()
Close DSP
Color
getColor(String linecolor)
Convert string to color.
AbsoluteConstraints
getConstraints()
KJDigitalSignalProcessingAudioDataConsumer
getDSP()
Return DSP.
static Color[]
getDefaultSpectrumAnalyserColors()
int
getDisplayMode()
int
getFps()
int
getPeakDelay()
Return peak falloff delay
Color
getScopeColor()
int
getSpectrumAnalyserBandCount()
Color[]
getSpectrumAnalyserColors()
float
getSpectrumAnalyserDecay()
boolean
isPeaksEnabled()
boolean
isShowingFPS()
void
paintComponent(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(Color c)
Set visual peak color.
void
setPeakDelay(int framestowait)
Set peak falloff delay.
void
setPeaksEnabled(boolean peaksEnabled)
void
setScopeColor(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(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
setVisColor(String viscolor)
Set visual colors from skin.
void
setupDSP(SourceDataLine line)
Setup DSP.
void
startDSP(SourceDataLine line)
Starts DSP.
void
stopDSP()
Stop DSP.
void
writeDSP(byte[] pcmdata)
Write PCM data to DSP.

Field Details

DEFAULT_BACKGROUND_COLOR

public static final Color DEFAULT_BACKGROUND_COLOR

DEFAULT_FPS

public static final int DEFAULT_FPS
Field Value:
50

DEFAULT_HEIGHT

public static final int DEFAULT_HEIGHT
Field Value:
128

DEFAULT_SCOPE_COLOR

public static final Color DEFAULT_SCOPE_COLOR

DEFAULT_SPECTRUM_ANALYSER_BAND_COUNT

public static final int DEFAULT_SPECTRUM_ANALYSER_BAND_COUNT
Field Value:
19

DEFAULT_SPECTRUM_ANALYSER_DECAY

public static final float DEFAULT_SPECTRUM_ANALYSER_DECAY
Field Value:
0.0f

DEFAULT_SPECTRUM_ANALYSER_FFT_SAMPLE_SIZE

public static final int DEFAULT_SPECTRUM_ANALYSER_FFT_SAMPLE_SIZE
Field Value:
512

DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY

public static final int DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY
Field Value:
20

DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO

public static final float DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO
Field Value:
0.0f

DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO_RANGE

public static final float DEFAULT_SPECTRUM_ANALYSER_PEAK_DELAY_FPS_RATIO_RANGE
Field Value:
0.0f

DEFAULT_VU_METER_DECAY

public static final float DEFAULT_VU_METER_DECAY
Field Value:
0.0f

DEFAULT_WIDTH

public static final int DEFAULT_WIDTH
Field Value:
256

DISPLAY_MODE_OFF

public static final int DISPLAY_MODE_OFF
Field Value:
2

DISPLAY_MODE_SCOPE

public static final int DISPLAY_MODE_SCOPE
Field Value:
0

DISPLAY_MODE_SPECTRUM_ANALYSER

public static final int DISPLAY_MODE_SPECTRUM_ANALYSER
Field Value:
1

MAX_SPECTRUM_ANALYSER_DECAY

public static final float MAX_SPECTRUM_ANALYSER_DECAY
Field Value:
0.0f

MIN_SPECTRUM_ANALYSER_DECAY

public static final float MIN_SPECTRUM_ANALYSER_DECAY
Field Value:
0.0f

Constructor Details

SpectrumTimeAnalyzer

public SpectrumTimeAnalyzer()

Method Details

closeDSP

public void closeDSP()
Close DSP

getColor

public Color getColor(String linecolor)
Convert string to color.
Parameters:
linecolor -
Returns:

getConstraints

public AbsoluteConstraints getConstraints()

getDSP

public KJDigitalSignalProcessingAudioDataConsumer getDSP()
Return DSP.
Returns:

getDefaultSpectrumAnalyserColors

public static Color[] getDefaultSpectrumAnalyserColors()

getDisplayMode

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

getFps

public int getFps()

getPeakDelay

public int getPeakDelay()
Return peak falloff delay
Returns:
int framestowait

getScopeColor

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

getSpectrumAnalyserBandCount

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

getSpectrumAnalyserColors

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

getSpectrumAnalyserDecay

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

isPeaksEnabled

public boolean isPeaksEnabled()

isShowingFPS

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

paintComponent

public void paintComponent(Graphics pGraphics)

process

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

setConstraints

public void setConstraints(AbsoluteConstraints cnts)

setDisplayMode

public void setDisplayMode(int pMode)
Sets the current display mode.
Parameters:
pMode - Must be either DISPLAY_MODE_SCOPE or DISPLAY_MODE_SPECTRUM_ANALYSER.

setFps

public void setFps(int fps)

setPeakColor

public void setPeakColor(Color c)
Set visual peak color.
Parameters:
c -

setPeakDelay

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

setPeaksEnabled

public void setPeaksEnabled(boolean peaksEnabled)

setScopeColor

public void setScopeColor(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".

setSpectrumAnalyserColors

public void setSpectrumAnalyserColors(Color[] pColors)
Sets the spectrum analyser color scale.
Parameters:
pColors - Any amount of colors may be used. Must not be null.

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.

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.

setVisColor

public void setVisColor(String viscolor)
Set visual colors from skin.
Parameters:
viscolor -

setupDSP

public void setupDSP(SourceDataLine line)
Setup DSP.
Parameters:
line -

startDSP

public void startDSP(SourceDataLine line)
Starts DSP.
Parameters:
line -

stopDSP

public void stopDSP()
Stop DSP.

writeDSP

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

JavaZOOM 1999-2006