public class FileInputSystem extends DaqSystem implements java.awt.event.ActionListener, PamSettings
DaqSystem
,
AcquisitionProcess
,
FolderInputSystem
Modifier and Type | Class and Description |
---|---|
class |
FileInputSystem.CollectorThread |
PARAMETER_FIXED, PARAMETER_UNKNOWN, STREAM_CLOSED, STREAM_ENDED, STREAM_OPEN, STREAM_PAUSED, STREAM_RUNNING
Constructor and Description |
---|
FileInputSystem() |
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e) |
static double[] |
bytesToSamples(byte[] byteArray,
long nBytes,
int channel,
javax.sound.sampled.AudioFormat audioFormat)
Format one channel of the data in a byte array into a sample array.
|
boolean |
canPlayBack(float sampleRate) |
void |
daqHasEnded()
Called after DAQ has stopped - for whatever reason.
|
boolean |
dialogGetParams()
Called by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog
component.
|
void |
dialogSetParams()
Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's
fields
|
int |
getChannels() |
java.io.File |
getCurrentFile() |
javax.swing.JPanel |
getDaqSpecificDialogComponent(AcquisitionDialog acquisitionDialog)
The AcquisitionDialog has been designed to that each data source type can plug
in it's own panel of device specific controls.
|
int |
getDataUnitSamples() |
java.lang.String |
getDeviceName()
Gets a name for the acquisition device (may just be a number
but need to generalise).
|
long |
getEta() |
long |
getFileStartTime(java.io.File file)
Interpret the file name to get the file time.
|
int |
getMaxChannels() |
int |
getMaxSampleRate() |
double |
getPeak2PeakVoltage(int swChannel) |
static double |
getSample(byte[] buffer,
int position,
int bytesPerSample,
boolean isBigEndian)
Convenience method for getting samples from a byte array.
|
int |
getSampleBits()
Get the number of bits in each sample.
|
float |
getSampleRate() |
java.io.Serializable |
getSettingsReference() |
long |
getSettingsVersion() |
java.awt.Component |
getStatusBarComponent() |
java.lang.String |
getSystemName() |
java.lang.String |
getSystemType() |
java.lang.String |
getUnitName() |
java.lang.String |
getUnitType() |
void |
interpretNewFile(java.lang.String newFile) |
boolean |
isRealTime() |
boolean |
prepareInputFile()
Open the audio stream for processing.
|
boolean |
prepareSystem(AcquisitionControl daqControl)
Prepare the DaqSystem.
|
boolean |
restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) |
boolean |
runFileAnalysis() |
void |
sayEta() |
void |
sayEta(long timeMs) |
void |
setNewFile(java.lang.String newFile)
Called when user selects a file in the dialog.
|
void |
setStreamStatus(int streamStatus) |
boolean |
startSystem(AcquisitionControl daqControl)
Start the DaqSystem.
|
void |
stopSystem(AcquisitionControl daqControl)
Stop the DaqSystem.
|
void |
systemHasStopped(boolean wasRunning) |
areSampleSettingsOk, fillXMLParameters, getChannelGain, getDaqSpecificChannelListPanel, getInputChannelMap, getPlaybackSystem, getStreamStatus, setSelected, showSampleSettingsDialog, supportsChannelLists
public javax.swing.JPanel getDaqSpecificDialogComponent(AcquisitionDialog acquisitionDialog)
DaqSystem
The AcquisitionDialog will handle placing this component on the dialog when a particular DaqSystem is selected. The component will be placed between a drop down list of available DaqSystem's and a section of the dialog showing the sample rate and number of channels.
getDaqSpecificDialogComponent
in class DaqSystem
acquisitionDialog
- the AcquisitionDialog this component will be added topublic void dialogSetParams()
DaqSystem
dialogSetParams
in class DaqSystem
public boolean dialogGetParams()
DaqSystem
dialogGetParams
in class DaqSystem
public java.lang.String getSystemType()
getSystemType
in class DaqSystem
Calling functions should be able to handle 'null'
public java.lang.String getSystemName()
getSystemName
in class DaqSystem
public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
public void setNewFile(java.lang.String newFile)
newFile
- public void interpretNewFile(java.lang.String newFile)
public void setStreamStatus(int streamStatus)
setStreamStatus
in class DaqSystem
public int getMaxChannels()
getMaxChannels
in class DaqSystem
public int getMaxSampleRate()
getMaxSampleRate
in class DaqSystem
public double getPeak2PeakVoltage(int swChannel)
getPeak2PeakVoltage
in class DaqSystem
public boolean isRealTime()
isRealTime
in class DaqSystem
public boolean canPlayBack(float sampleRate)
canPlayBack
in class DaqSystem
public java.io.Serializable getSettingsReference()
getSettingsReference
in interface PamSettings
public long getSettingsVersion()
getSettingsVersion
in interface PamSettings
public java.lang.String getUnitName()
getUnitName
in interface PamSettings
public java.lang.String getUnitType()
getUnitType
in interface PamSettings
public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
restoreSettings
in interface PamSettings
public int getChannels()
public float getSampleRate()
public boolean prepareSystem(AcquisitionControl daqControl)
DaqSystem
Usually this is the time for opening files, preparing data buffers, etc.
prepareSystem
in class DaqSystem
daqControl
- AcquisitionControl unit.public java.io.File getCurrentFile()
public int getDataUnitSamples()
getDataUnitSamples
in class DaqSystem
public boolean prepareInputFile()
public boolean runFileAnalysis()
public long getFileStartTime(java.io.File file)
Moved to a separate function so it can be overridden in a special version for the DCL5 data set.
file
- audio file.public boolean startSystem(AcquisitionControl daqControl)
DaqSystem
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)
startSystem
in class DaqSystem
daqControl
- AcquisitionControl unit.public void stopSystem(AcquisitionControl daqControl)
DaqSystem
stopSystem
in class DaqSystem
public void systemHasStopped(boolean wasRunning)
public static double[] bytesToSamples(byte[] byteArray, long nBytes, int channel, javax.sound.sampled.AudioFormat audioFormat)
public static double getSample(byte[] buffer, int position, int bytesPerSample, boolean isBigEndian)
public void daqHasEnded()
DaqSystem
daqHasEnded
in class DaqSystem
public java.awt.Component getStatusBarComponent()
getStatusBarComponent
in class DaqSystem
public void sayEta()
public long getEta()
public void sayEta(long timeMs)
public java.lang.String getDeviceName()
DaqSystem
getDeviceName
in class DaqSystem
public int getSampleBits()
DaqSystem
getSampleBits
in class DaqSystem