com.icdif.audio.graph
Class PlaybackPlot

java.lang.Object
  extended by com.icdif.audio.graph.PlaybackPlot

public class PlaybackPlot
extends java.lang.Object

Receives a plot and a decoder and plays back the audio from 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
PlaybackPlot(Plot plot, int samplesPerPixel, AudioDecoder decoder)
          This constructor plays back the audio form the decoder and sets the marker of the plot accordingly.
 
Method Summary
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PlaybackPlot

public PlaybackPlot(Plot plot,
                    int samplesPerPixel,
                    AudioDecoder decoder)
             throws java.lang.Exception
This constructor plays back the audio form the decoder and sets the marker of the plot accordingly.

Parameters:
plot - The plot in which it will set the marker
samplesPerPixel - the number of samples per pixel.
decoder - The decoder instance, in order to play the audio
Throws:
java.lang.Exception - - When the program can connect to the Line to play the audio