Class RawSoundPlotDataFX

java.lang.Object
dataPlotsFX.rawDataPlotFX.RawSoundPlotDataFX

public class RawSoundPlotDataFX extends Object
Raw sound data is by default not stored in memory. There are good reasons for this, the first being that raw sound data is generally very large. That creates problems when trying to display raw sound data on a display. Only a second or so is available in memory for plotting. In order to have display which show a more than a second or so of data there needs to be an efficient way to store the display information for showing a sound data.

This performs operations to plot one channel of raw sound data on a plot pane of a tdGraphFX. The data to display for each pixel is stored in an array and saved in memory.

RealTime: //TODO
Viewer Mode: //TODO
The array is filled with data for each pixel from incoming raw sound data. Once the array is filled
Author:
Jamie Macaulay
  • Constructor Details

    • RawSoundPlotDataFX

      public RawSoundPlotDataFX(RawSoundDataInfo rawSoundDataInfo, int channel)
    • RawSoundPlotDataFX

      public RawSoundPlotDataFX()
  • Method Details

    • setSampleRate

      public void setSampleRate(float sampleRate)
      Set the sample rate.
      Parameters:
      sampleRate - sample rate in samples per second.
    • getSampleRate

      public float getSampleRate()
      Get the sample rate
      Returns:
      the sample rate in bins per second
    • checkConfig

      public void checkConfig()
      Check whether the time scale is correct.
    • addNewRawData

      public void addNewRawData(RawDataUnit rawDataUnit)
      Convert new RawDataUnit to pixels and then add to
      invalid @link
      #soundData
      array to be plotted on next repaint call.
      Parameters:
      rawDataUnit -
    • newRawData

      public void newRawData(RawDataUnit rawDataUnit, double binsPerPixel)
      Called whenever new raw sound data is to be added to display.
      Parameters:
      rawDataUnit - - raw data unit.
    • checkTimeGap

      public void checkTimeGap(RawDataUnit rawSoundData)
      Check that the new rawdata is concurrent to the last fft. If not fill the spectrogram with blank sapce.
    • recalcSoundData

      public void recalcSoundData(double binsPerPixel2)
      A new binsPerPixel value is being used. In real time mode will need to convert the store In viewer model will need to reload data from the store.
      Parameters:
      binsPerPixel2 - - the new bins per pixel. The old bins per pixel is still stored in the binsPerPixel field.
    • drawRawSoundData

      public void drawRawSoundData(javafx.scene.canvas.GraphicsContext g2d, javafx.scene.shape.Rectangle windowRect, javafx.geometry.Orientation orientation, PamAxisFX timeAxis, PamAxisFX dataAxis, double scrollStart, double wrapPix)
      Draw data from the array onto the screen. This functions assumes that the
      invalid @link
      #soundData
      array contains data with the correct
      invalid @link
      #binsPerPixel
      for the current time range on the display.
      Parameters:
      g2d - - the graphics context to draw onto.
      windowRect - - rectangle describing the window.
      orientation - - the orientation of the display VERTICAL or HORIZONTAL.
      timeAxis - - the time axis.
      dataAxis - - the amplitude axis.
      scrollStart - - the start of the display in milliseconds datenum. The is the left most side of the display i.e. where the oldest visble data is displayed.
      wrapPix - - the wrap position on the time display -1 if not wrapping.l
    • resetForLoad

      public void resetForLoad()
      Reset the raw sound data for loading.
    • clearRawData

      public void clearRawData()
      Reset the array, clearing all data.
    • getBinsPerPixel

      public double getBinsPerPixel()