Package Acquisition
Class FolderInputSystem
java.lang.Object
Acquisition.DaqSystem
Acquisition.FileInputSystem
Acquisition.FolderInputSystem
- All Implemented Interfaces:
FileDateObserver,ActionListener,EventListener,DataInputStore,DataStoreInfoHolder,PamSettings,SettingsNameProvider
- Direct Known Subclasses:
DCL5System,RonaInputSystem
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
-
Nested Class Summary
Nested classes/interfaces inherited from class Acquisition.FileInputSystem
FileInputSystem.CollectorThread -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ArrayList<WavFileType> protected PamPanelPanel which shows bespoke settings for certain audio loaders.protected intstatic final Stringprotected longstatic final Stringstatic final StringFields inherited from class Acquisition.FileInputSystem
acquisitionControl, acquisitionDialog, audioFormat, audioStream, blockSamples, byteConverter, collectorThread, currentAnalysisTime, dontStop, etaLabel, fileDateStrip, fileInputParameters, fileNameCombo, fileProgress, fileSelect, fileStartTime, newDataUnits, repeat, speedLabel, theThreadFields inherited from class Acquisition.DaqSystem
PARAMETER_FIXED, PARAMETER_UNKNOWN, STREAM_CLOSED, STREAM_ENDED, STREAM_OPEN, STREAM_PAUSED, STREAM_RUNNING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidvoidChecks file length matched actual file data length and repairs if necessary.protected JPanelvoidCalled after DAQ has stopped - for whatever reason.voidCalled by AcquisitionDialog.SetParams so that the dialog node can update it's fields.booleanCalled by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog component.voidCalled by AcquisitionDialog.SetParams so that the dialog componenet can update it's fieldsprotected intfudgeNumChannels(int nChannels) Fudge function so that the RonaInputsystem can always fudge the number of channels to be 7.Get a status update for batch processing.getDAQSpecificPane(AcquisitionPaneFX acquisitionPaneFX) JavaFX bitsGets a name for the acquisition device (may just be a number but need to generalise).longgetEta()longgetStoreInfo(PamWorkMonitor workMonitor, boolean detail) Get information about the input store (e.g.voidinterpretNewFile(WavFileType newFile) Called when a new file or folder is selected.intMake a list of wav files within a folder.intmakeSelFileList(String[] rootList) Make a list of wav files within a folder.voidnewFileList(FileListData<WavFileType> fileListData) Callback when the file list has completed it's background task.protected booleanopenNextFile(long totalSamples) Open next file in a list for continuous processing, not the function that opens a file for normal processing.booleanOpen the audio stream for processing.voidReset to start of file list and also the current time to zero.booleanrestoreSettings(PamControlledUnitSettings pamControlledUnitSettings) booleanprotected voidbooleansetAnalysisStartTime(long startTime) Set an analysis start time.voidsetAudioFileFilter(PamFileFilter audioFileFilter) voidShow the date of the first file in the dialog.voidSet bespoke options for certain file types.voidsetFolderInputParameters(FolderInputParameters folderInputParameters) voidsetSelected(boolean select) Tell a DAQ system it's been selected or deselected.protected voidstartAtCurrent(long currT) voidstartButtonXtraActions(Component component, AWTEvent e) Extra options for the start menubooleanstartSystem(AcquisitionControl daqControl) Start the DaqSystem.Methods inherited from class Acquisition.FileInputSystem
actionPerformed, bytesToSamples, canPlayBack, collectFlacData, fileDateChange, fileListComplete, getAquisitionControl, getChannels, getDaqSpecificDialogComponent, getDataUnitSamples, getDialogPanel, getFileStartTime, getFirstFile, getMaxChannels, getMaxSampleRate, getPeak2PeakVoltage, getSample, getSampleBits, getSampleRate, getSelectedFileTypes, getSkipStartFileTime, getSystemName, isRealTime, loadByteConverter, prepareSystem, sayEta, sayEta, selectFile, setNewFile, setSelectedFileTypes, setStreamStatus, stopSystem, systemHasStoppedMethods inherited from class Acquisition.DaqSystem
areSampleSettingsOk, getChannelGain, getDaqSpecificChannelListNode, getDaqSpecificChannelListPanel, getInputChannelMap, getPlaybackSystem, getStallCheckSeconds, getStreamStatus, notifyModelChanged, showSampleSettingsDialog, supportsChannelLists
-
Field Details
-
daqType
- See Also:
-
sysType
- See Also:
-
allFiles
-
currentFileIndex
protected int currentFileIndex -
eta
protected long eta -
GlobalWavFolderArg
- See Also:
-
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
-
FolderInputSystem
-
-
Method Details
-
runFileAnalysis
public boolean runFileAnalysis()- Overrides:
runFileAnalysisin classFileInputSystem
-
prepareInputFile
public boolean prepareInputFile()Description copied from class:FileInputSystemOpen the audio stream for processing.- Overrides:
prepareInputFilein classFileInputSystem- Returns:
- true if audio stream opened correctly.
-
createDaqDialogPanel
- Overrides:
createDaqDialogPanelin classFileInputSystem
-
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:DaqSystemTell a DAQ system it's been selected or deselected.- Overrides:
setSelectedin classFileInputSystem- 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
Make a list of wav files within a folder.- Parameters:
rootList-- Returns:
-
getFolderFileFilter
-
selectFolder
protected void selectFolder() -
getCurrentFolder
-
interpretNewFile
Description copied from class:FileInputSystemCalled when a new file or folder is selected.- Overrides:
interpretNewFilein classFileInputSystem- Parameters:
newFile-
-
newFileList
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
- Overrides:
getSystemTypein classFileInputSystem- Returns:
- The 'type' of data source for display in the Data Source dialog
Calling functions should be able to handle 'null'
-
getUnitName
- Specified by:
getUnitNamein interfaceSettingsNameProvider- Overrides:
getUnitNamein classFileInputSystem- Returns:
- A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.
-
getUnitType
- Specified by:
getUnitTypein interfacePamSettings- Overrides:
getUnitTypein classFileInputSystem- Returns:
- A Name specific to the type, e.g. Click detector
-
getCurrentFile
- Overrides:
getCurrentFilein classFileInputSystem
-
openNextFile
protected boolean openNextFile(long totalSamples) Description copied from class:FileInputSystemOpen next file in a list for continuous processing, not the function that opens a file for normal processing.- Overrides:
openNextFilein classFileInputSystem- Parameters:
totalSamples-- Returns:
-
daqHasEnded
public void daqHasEnded()Description copied from class:DaqSystemCalled 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:
daqHasEndedin classFileInputSystem
-
calculateETA
protected void calculateETA() -
getStatusBarComponent
- Overrides:
getStatusBarComponentin classFileInputSystem
-
getEta
public long getEta()- Overrides:
getEtain classFileInputSystem
-
getSettingsReference
- Specified by:
getSettingsReferencein interfacePamSettings- Overrides:
getSettingsReferencein classFileInputSystem- Returns:
- The serialisable object that will be stored
-
getSettingsVersion
public long getSettingsVersion()- Specified by:
getSettingsVersionin interfacePamSettings- Overrides:
getSettingsVersionin classFileInputSystem- Returns:
- An integer version number for the settings
-
dialogGetParams
public boolean dialogGetParams()Description copied from class:DaqSystemCalled 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:
dialogGetParamsin classFileInputSystem- 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:DaqSystemCalled by AcquisitionDialog.SetParams so that the dialog componenet can update it's fields- Overrides:
dialogSetParamsin classFileInputSystem
-
restoreSettings
- Specified by:
restoreSettingsin interfacePamSettings- Overrides:
restoreSettingsin classFileInputSystem- 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
-
setFolderInputParameters
-
startSystem
Description copied from class:DaqSystemStart the DaqSystem. This is called immediately after PrepareSystemMost 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:
startSystemin classFileInputSystem- Parameters:
daqControl- AcquisitionControl unit.- Returns:
- true if OK, false otherwise
-
getDeviceName
Description copied from class:DaqSystemGets a name for the acquisition device (may just be a number but need to generalise).- Overrides:
getDeviceNamein classFileInputSystem- Returns:
-
getAudioFileFilter
-
setAudioFileFilter
-
getDAQSpecificPane
JavaFX bits- Overrides:
getDAQSpecificPanein classDaqSystem- 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
Description copied from interface:DataStoreInfoHolderGet information about the input store (e.g. start times of all files).- Specified by:
getStoreInfoin interfaceDataStoreInfoHolder- Overrides:
getStoreInfoin classFileInputSystem- 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:DataInputStoreSet an analysis start time. This might get called just before processing starts, in which case- Specified by:
setAnalysisStartTimein interfaceDataInputStore- Overrides:
setAnalysisStartTimein classFileInputSystem- Parameters:
startTime-- Returns:
- ok if no problems.
-
getBatchStatus
Get a status update for batch processing.- Specified by:
getBatchStatusin interfaceDataInputStore- Overrides:
getBatchStatusin classFileInputSystem- Returns:
-
startButtonXtraActions
Extra options for the start menu- Overrides:
startButtonXtraActionsin classDaqSystem- 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
- Overrides:
getStartButtonToolTipin classDaqSystem
-