Package Acquisition

Class FolderInputSystem

All Implemented Interfaces:
FileDateObserver, ActionListener, EventListener, DataInputStore, DataStoreInfoHolder, PamSettings, SettingsNameProvider
Direct Known Subclasses:
DCL5System, RonaInputSystem

public class FolderInputSystem extends FileInputSystem implements PamSettings, DataInputStore
Read multiple files in sequence. Options exist to either pause and restart analysis after each file, or to merge files into one long continuous sound stream.
Author:
Doug Gillespie
  • Field Details

    • daqType

      public static final String daqType
      See Also:
    • sysType

      public static final String sysType
      See Also:
    • allFiles

      protected ArrayList<WavFileType> allFiles
    • currentFileIndex

      protected int currentFileIndex
    • eta

      protected long eta
    • GlobalWavFolderArg

      public static final String GlobalWavFolderArg
      See Also:
    • audioLoaderHolder

      protected PamPanel audioLoaderHolder
      Panel which shows bespoke settings for certain audio loaders. Contains nothing if the audio loader has no settings or no file is selected.
  • Constructor Details

  • Method Details

    • runFileAnalysis

      public boolean runFileAnalysis()
      Overrides:
      runFileAnalysis in class FileInputSystem
    • prepareInputFile

      public boolean prepareInputFile()
      Description copied from class: FileInputSystem
      Open the audio stream for processing.
      Overrides:
      prepareInputFile in class FileInputSystem
      Returns:
      true if audio stream opened correctly.
    • createDaqDialogPanel

      protected JPanel createDaqDialogPanel()
      Overrides:
      createDaqDialogPanel in class FileInputSystem
    • checkFileHeaders

      public void checkFileHeaders()
      Checks file length matched actual file data length and repairs if necessary.
    • setSelected

      public void setSelected(boolean select)
      Description copied from class: DaqSystem
      Tell a DAQ system it's been selected or deselected.
      Overrides:
      setSelected in class FileInputSystem
      Parameters:
      select -
    • makeSelFileList

      public int makeSelFileList()
      Make a list of wav files within a folder. In some circumstances this can be a list of actual files in a folder. Also needs to handle the possibility of it using a globally set folder name.
      Returns:
      flag to indicate...nothing?
    • makeSelFileList

      public int makeSelFileList(String[] rootList)
      Make a list of wav files within a folder.
      Parameters:
      rootList -
      Returns:
    • getFolderFileFilter

      public PamFileFilter getFolderFileFilter()
    • selectFolder

      protected void selectFolder()
    • getCurrentFolder

      public String getCurrentFolder()
    • interpretNewFile

      public void interpretNewFile(WavFileType newFile)
      Description copied from class: FileInputSystem
      Called when a new file or folder is selected.
      Overrides:
      interpretNewFile in class FileInputSystem
      Parameters:
      newFile -
    • newFileList

      public void newFileList(FileListData<WavFileType> fileListData)
      Callback when the file list has completed it's background task.
      Parameters:
      fileListData -
    • fudgeNumChannels

      protected int fudgeNumChannels(int nChannels)
      Fudge function so that the RonaInputsystem can always fudge the number of channels to be 7.
      Parameters:
      nChannels -
      Returns:
    • setFileOptionPanel

      public void setFileOptionPanel()
      Set bespoke options for certain file types.
    • setFileDateText

      public void setFileDateText()
      Show the date of the first file in the dialog.
    • getSystemType

      public String getSystemType()
      Overrides:
      getSystemType in class FileInputSystem
      Returns:
      The 'type' of data source for display in the Data Source dialog

      Calling functions should be able to handle 'null'

    • getUnitName

      public String getUnitName()
      Specified by:
      getUnitName in interface SettingsNameProvider
      Overrides:
      getUnitName in class FileInputSystem
      Returns:
      A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
    • getUnitType

      public String getUnitType()
      Specified by:
      getUnitType in interface PamSettings
      Overrides:
      getUnitType in class FileInputSystem
      Returns:
      A Name specific to the type, e.g. Click detector
    • getCurrentFile

      public WavFileType getCurrentFile()
      Overrides:
      getCurrentFile in class FileInputSystem
    • openNextFile

      protected boolean openNextFile(long totalSamples)
      Description copied from class: FileInputSystem
      Open next file in a list for continuous processing, not the function that opens a file for normal processing.
      Overrides:
      openNextFile in class FileInputSystem
      Parameters:
      totalSamples -
      Returns:
    • daqHasEnded

      public void daqHasEnded()
      Description copied from class: DaqSystem
      Called after DAQ has stopped - for whatever reason. Nost DAQ systems will not need to do anything here, but they could potentially clean up memory The motivation for putting this here now is for the folder analysis system so that it can start analysing the next file.
      Overrides:
      daqHasEnded in class FileInputSystem
    • calculateETA

      protected void calculateETA()
    • getStatusBarComponent

      public Component getStatusBarComponent()
      Overrides:
      getStatusBarComponent in class FileInputSystem
    • getEta

      public long getEta()
      Overrides:
      getEta in class FileInputSystem
    • getSettingsReference

      public Serializable getSettingsReference()
      Specified by:
      getSettingsReference in interface PamSettings
      Overrides:
      getSettingsReference in class FileInputSystem
      Returns:
      The serialisable object that will be stored
    • getSettingsVersion

      public long getSettingsVersion()
      Specified by:
      getSettingsVersion in interface PamSettings
      Overrides:
      getSettingsVersion in class FileInputSystem
      Returns:
      An integer version number for the settings
    • dialogGetParams

      public boolean dialogGetParams()
      Description copied from class: DaqSystem
      Called by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog component. The DaqSystem should also implement PamSettings and handle storage of parameters between runs.
      Overrides:
      dialogGetParams in class FileInputSystem
      Returns:
      true if the parameters and selections are OK. If false is returned the Acquisition dialog will not respond to its Ok button.
    • dialogSetParams

      public void dialogSetParams()
      Description copied from class: DaqSystem
      Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's fields
      Overrides:
      dialogSetParams in class FileInputSystem
    • restoreSettings

      public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
      Specified by:
      restoreSettings in interface PamSettings
      Overrides:
      restoreSettings in class FileInputSystem
      Parameters:
      pamControlledUnitSettings -
      Returns:
      true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required
    • getFolderInputParameters

      public FolderInputParameters getFolderInputParameters()
    • setFolderInputParameters

      public void setFolderInputParameters(FolderInputParameters folderInputParameters)
    • startSystem

      public boolean startSystem(AcquisitionControl daqControl)
      Description copied from class: DaqSystem
      Start the DaqSystem. This is called immediately after PrepareSystem

      Most things should be ready from the call to PrepareSystem. In StartSystem you will generally need to start a thread which will read in the data and place PamDataUnits in a buffer from where they are read by the main thred and passed on to other Pam modules for processing (see SoundCardSystem for an example)

      Overrides:
      startSystem in class FileInputSystem
      Parameters:
      daqControl - AcquisitionControl unit.
      Returns:
      true if OK, false otherwise
    • getDeviceName

      public String getDeviceName()
      Description copied from class: DaqSystem
      Gets a name for the acquisition device (may just be a number but need to generalise).
      Overrides:
      getDeviceName in class FileInputSystem
      Returns:
    • getAudioFileFilter

      public PamFileFilter getAudioFileFilter()
    • setAudioFileFilter

      public void setAudioFileFilter(PamFileFilter audioFileFilter)
    • getDAQSpecificPane

      public DAQSettingsPane getDAQSpecificPane(AcquisitionPaneFX acquisitionPaneFX)
      JavaFX bits
      Overrides:
      getDAQSpecificPane in class DaqSystem
      Returns:
      dialog component specific to this DAQ device
    • dialogFXSetParams

      public void dialogFXSetParams()
      Called by AcquisitionDialog.SetParams so that the dialog node can update it's fields.
    • getStoreInfo

      public InputStoreInfo getStoreInfo(PamWorkMonitor workMonitor, boolean detail)
      Description copied from interface: DataStoreInfoHolder
      Get information about the input store (e.g. start times of all files).
      Specified by:
      getStoreInfo in interface DataStoreInfoHolder
      Overrides:
      getStoreInfo in class FileInputSystem
      Parameters:
      workMonitor - monitor for work progress, should be called whenever a task is likely to take a long time so that a progress bar can update.
      detail - get detail of all files.
      Returns:
      information about data input.
    • setAnalysisStartTime

      public boolean setAnalysisStartTime(long startTime)
      Description copied from interface: DataInputStore
      Set an analysis start time. This might get called just before processing starts, in which case
      Specified by:
      setAnalysisStartTime in interface DataInputStore
      Overrides:
      setAnalysisStartTime in class FileInputSystem
      Parameters:
      startTime -
      Returns:
      ok if no problems.
    • getBatchStatus

      public String getBatchStatus()
      Get a status update for batch processing.
      Specified by:
      getBatchStatus in interface DataInputStore
      Overrides:
      getBatchStatus in class FileInputSystem
      Returns:
    • startButtonXtraActions

      public void startButtonXtraActions(Component component, AWTEvent e)
      Extra options for the start menu
      Overrides:
      startButtonXtraActions in class DaqSystem
      Parameters:
      component -
      e -
    • resetToStart

      public void resetToStart()
      Reset to start of file list and also the current time to zero.
    • startAtCurrent

      protected void startAtCurrent(long currT)
    • getStartButtonToolTip

      public String getStartButtonToolTip()
      Overrides:
      getStartButtonToolTip in class DaqSystem