|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.pscode.ui.audiotrace.AudioPlotPanel
public class AudioPlotPanel
The AudioPlotPanel (APP) provides a trace of an audio signal. It is very configurable. Besides configuring the class from code, it can be configured using the AudioTraceColorsPanel (ATCP) and AudioTraceOptionsPanel (ATOP) and the methods of the AudioTraceMenu to provide a JMenu that pops those two panels, and allows configuration of volume (trace) options and full-screen mode. Note that the APP can be used without the configuration classes, so long as you do not intend to offer the user the option to change the rendering options. Versions
| Nested Class Summary |
|---|
| Nested 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 | |
|---|---|
static int |
MAX_GAIN
|
| 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 | |
|---|---|
AudioPlotPanel()
|
|
AudioPlotPanel(TargetDataLine line)
Construct the plot panel. |
|
| Method Summary | |
|---|---|
void |
addLissajousPoint(GeneralPath gp,
int sampleProgress,
double signalSize,
double lastSignalSize)
Plots the amplitude of the signal against its own gradient. |
void |
addTracePoint(GeneralPath gp,
int sampleProgress,
double signalSize)
Plots the amplitude of the signal against time. |
void |
clearTrace()
|
void |
configure(Applet applet)
|
void |
copyIntoRenderBuffer(int first,
int last)
|
double[] |
frameToSignedDoubles(byte[] renderBuffer)
Converts a single frame of audio bytes to signed doubles ranging from -1 to 1. |
Color |
getColor(int index)
|
Color |
getColorForLevel(double level)
|
int |
getColorSchemeIndex()
|
int |
getGain()
|
boolean |
getGainLoop()
|
MultipleGradientPaint |
getGradient(int index)
|
int |
getGradientGain()
|
boolean |
getGradientsByTraceColor()
|
double |
getGradientToAngle(double height1,
double height2)
Returns the arctan of the gradient. |
Font |
getIdealFont(String message,
Graphics g,
Font f)
|
Color |
getOuterColor(int index)
|
HashMap |
getParamMap(Applet applet)
|
Parameter[] |
getParams(Applet applet)
|
int |
getSampleSize()
|
boolean |
getScaledVolume()
|
double |
getScalingFactor(int progress)
This provides a scaling factor intended to allow both ends of the lissajous trace to align. |
boolean |
getShowVolume()
|
Color |
getTransparentBasedOnColor(Color c,
int t)
|
void |
paintComponent(Graphics g)
Paint a trace of the current waveform to screen. |
void |
refreshBufferSize()
|
void |
refreshGradients()
|
void |
renderPlot()
|
void |
run()
Read data from the TargetDataLine, then paint it to screen. |
double |
scaledVolume(double[] raw)
|
void |
setBuffer(byte[] buffer)
|
void |
setByteCount(int byteCount)
|
void |
setColor(Color c,
int index)
|
void |
setColorScheme(int i)
|
void |
setColorSchemeIndex(int i)
|
void |
setFadeRate(int fadeRate)
|
void |
setFormat(AudioFormat af)
|
void |
setFramePosition(int framePosition)
|
void |
setGain(int gain)
|
void |
setGainLoop(boolean loopGain)
|
void |
setGradientGain(int gradientGain)
|
void |
setGradientsByTraceColor()
|
void |
setGradientsByTraceColor(boolean paintGradientsByTraceColor)
|
void |
setLine(TargetDataLine line)
|
void |
setLineNumber(int lineNumber)
Informs the class what 'line number' this represents. |
void |
setLissajous(boolean lissajous)
|
void |
setMessage(String message,
int messageDisplayTime)
|
void |
setOuterColor(Color c,
int index)
|
void |
setPaintGradient(boolean paintGradient)
|
void |
setRenderingHints(RenderingHints renderingHints)
|
void |
setSampleSize(int sampleSize)
Construct the plot panel. |
void |
setScaledVolume(boolean scaledVolume)
|
void |
setScrollStep(int step)
|
void |
setShowVolume(boolean showVolume)
|
void |
setStrokeSize(int size)
|
void |
setThreadSleep(long millis)
|
void |
setZoomStep(int step)
|
void |
start()
|
void |
stop()
|
double |
volumeRMS(double[] raw)
Computes the RMS volume of a group of signal sizes ranging from -1 to 1. |
| Methods inherited from class javax.swing.JPanel |
|---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int MAX_GAIN
| Constructor Detail |
|---|
public AudioPlotPanel()
public AudioPlotPanel(TargetDataLine line)
| Method Detail |
|---|
public boolean getGradientsByTraceColor()
public void setGradientsByTraceColor()
public void setGradientsByTraceColor(boolean paintGradientsByTraceColor)
public Parameter[] getParams(Applet applet)
getParams in interface Configurablepublic HashMap getParamMap(Applet applet)
public void configure(Applet applet)
configure in interface Configurablepublic int getColorSchemeIndex()
public void setColorSchemeIndex(int i)
public Color getTransparentBasedOnColor(Color c,
int t)
public void setSampleSize(int sampleSize)
public void refreshBufferSize()
public void setFormat(AudioFormat af)
public void start()
public void run()
run in interface Runnable
public void stop()
throws Throwable
Throwablepublic void setThreadSleep(long millis)
public void setLine(TargetDataLine line)
public void setLineNumber(int lineNumber)
public void setBuffer(byte[] buffer)
public void setFramePosition(int framePosition)
public void setMessage(String message,
int messageDisplayTime)
public void setByteCount(int byteCount)
public void copyIntoRenderBuffer(int first,
int last)
public void setColor(Color c,
int index)
public Color getColor(int index)
public void setColorScheme(int i)
public void setOuterColor(Color c,
int index)
public Color getOuterColor(int index)
public void setPaintGradient(boolean paintGradient)
public void refreshGradients()
public void setRenderingHints(RenderingHints renderingHints)
public MultipleGradientPaint getGradient(int index)
public void setStrokeSize(int size)
public void setScrollStep(int step)
public void setZoomStep(int step)
public void setGain(int gain)
public void setGainLoop(boolean loopGain)
public boolean getGainLoop()
public int getGain()
public int getSampleSize()
public int getGradientGain()
public void setLissajous(boolean lissajous)
public void setGradientGain(int gradientGain)
public void setFadeRate(int fadeRate)
public void setShowVolume(boolean showVolume)
public boolean getShowVolume()
public void clearTrace()
public void paintComponent(Graphics g)
paintComponent in class JComponentpublic void renderPlot()
public Font getIdealFont(String message,
Graphics g,
Font f)
public Color getColorForLevel(double level)
public void setScaledVolume(boolean scaledVolume)
public boolean getScaledVolume()
public double scaledVolume(double[] raw)
public double volumeRMS(double[] raw)
public void addTracePoint(GeneralPath gp,
int sampleProgress,
double signalSize)
public void addLissajousPoint(GeneralPath gp,
int sampleProgress,
double signalSize,
double lastSignalSize)
public double getGradientToAngle(double height1,
double height2)
public double getScalingFactor(int progress)
public double[] frameToSignedDoubles(byte[] renderBuffer)
renderBuffer - bytearray The bytes of a single audio frame
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||