com.icdif.audio.graph
Class PlaybackVisualizer
java.lang.Object
com.icdif.audio.graph.PlaybackVisualizer
public class PlaybackVisualizer
- extends java.lang.Object
Receives a plot and a decoder and plays back the audio form the decoder at
the same time as it sets the marker in the plot accordingly.
The marker position is calculated in pixels by measuring the
elapsed time between the start of the playback and the current time. The
elapsed time is then multiplied by the frequency divided by the sample window
size (1024 samples in this case). This gives us the x-coordinate of the
marker in the plot. After writting a sample window to the audio device and
setting the marker we sleep for 20ms to give the Swing GUI thread time to
repaint the plot with the updated marker position.
- Author:
- wanderer
Constructor Summary |
PlaybackVisualizer(Plot plot,
int samplesPerPixel,
AudioDecoder decoder)
Constructor, plays back the audio form the decoder and sets the marker of
the plot accordingly. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
PlaybackVisualizer
public PlaybackVisualizer(Plot plot,
int samplesPerPixel,
AudioDecoder decoder)
throws java.lang.Exception
- Constructor, plays back the audio form the decoder and sets the marker of
the plot accordingly.
- Parameters:
plot
- The plot.samplesPerPixel
- the number of samples per pixel.decoder
- The decoder.
- Throws:
java.lang.Exception