|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectAcquisition.DaqSystem
Acquisition.FileInputSystem
public class FileInputSystem
Implementation of DaqSystem for reading data from audio files.
DaqSystem,
AcquisitionProcess,
FolderInputSystem| Nested Class Summary | |
|---|---|
class |
FileInputSystem.CollectorThread
|
| Field Summary | |
|---|---|
protected AcquisitionControl |
acquisitionControl
|
protected AcquisitionDialog |
acquisitionDialog
|
protected javax.sound.sampled.AudioFormat |
audioFormat
|
protected javax.sound.sampled.AudioInputStream |
audioStream
|
private int |
blockSamples
|
private ByteConverter |
byteConverter
|
protected FileInputSystem.CollectorThread |
collectorThread
|
private javax.swing.JPanel |
daqDialog
|
private boolean |
dontStop
|
private javax.swing.JLabel |
etaLabel
|
private double[] |
fileData
|
(package private) FileDate |
fileDate
|
(package private) long |
fileDateMillis
|
protected javax.swing.JTextField |
fileDateText
|
protected FileInputParameters |
fileInputParameters
|
(package private) long |
fileLength
|
protected javax.swing.JComboBox |
fileName
|
private javax.swing.JProgressBar |
fileProgress
|
(package private) long |
fileSamples
|
protected javax.swing.JButton |
fileSelect
|
protected long |
fileStartTime
using a system.currentTimeMS not PamCalander time to predict eta. |
(package private) int |
nChannels
|
protected java.util.List<RawDataUnit> |
newDataUnits
|
(package private) long |
readFileSamples
|
protected javax.swing.JCheckBox |
repeat
|
(package private) float |
sampleRate
|
(package private) long |
startTimeMS
|
(package private) javax.swing.JPanel |
statusPanel
|
protected java.lang.Thread |
theThread
|
| Fields inherited from class Acquisition.DaqSystem |
|---|
PARAMETER_FIXED, PARAMETER_UNKNOWN, STREAM_CLOSED, STREAM_ENDED, STREAM_OPEN, STREAM_PAUSED, STREAM_RUNNING |
| Constructor Summary | |
|---|---|
FileInputSystem()
|
|
| Method Summary | |
|---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
|
(package private) void |
addComponent(javax.swing.JPanel panel,
java.awt.Component p,
java.awt.GridBagConstraints constraints)
|
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)
|
protected javax.swing.JPanel |
createDaqDialogPanel()
|
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 |
private void |
fillFileList()
|
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()
|
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. |
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()
|
private boolean |
loadByteConverter(javax.sound.sampled.AudioFormat audioFormat)
|
protected boolean |
openNextFile()
|
boolean |
prepareInputFile()
|
boolean |
prepareSystem(AcquisitionControl daqControl)
Prepare the DaqSystem. |
boolean |
restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
|
boolean |
runFileAnalysis()
|
void |
sayEta()
|
void |
sayEta(long timeMs)
|
protected void |
selectFile()
|
void |
setNewFile(java.lang.String newFile)
|
void |
setStreamStatus(int streamStatus)
|
boolean |
startSystem(AcquisitionControl daqControl)
Start the DaqSystem. |
void |
stopSystem(AcquisitionControl daqControl)
Stop the DaqSystem. |
void |
systemHasStopped(boolean wasRunning)
|
| Methods inherited from class Acquisition.DaqSystem |
|---|
areSampleSettingsOk, getDaqSpecificChannelListPanel, getInputChannelMap, getPlaybackSystem, getStreamStatus, setSelected, showSampleSettingsDialog, supportsChannelLists |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private javax.swing.JPanel daqDialog
protected javax.swing.JComboBox fileName
protected javax.swing.JButton fileSelect
protected javax.swing.JTextField fileDateText
protected AcquisitionDialog acquisitionDialog
protected FileInputParameters fileInputParameters
protected AcquisitionControl acquisitionControl
private int blockSamples
private javax.swing.JProgressBar fileProgress
private javax.swing.JLabel etaLabel
protected long fileStartTime
private volatile boolean dontStop
private double[] fileData
protected javax.sound.sampled.AudioFormat audioFormat
protected javax.sound.sampled.AudioInputStream audioStream
protected FileInputSystem.CollectorThread collectorThread
protected java.lang.Thread theThread
protected java.util.List<RawDataUnit> newDataUnits
long startTimeMS
int nChannels
float sampleRate
FileDate fileDate
long fileDateMillis
long fileLength
long fileSamples
long readFileSamples
protected javax.swing.JCheckBox repeat
private ByteConverter byteConverter
javax.swing.JPanel statusPanel
| Constructor Detail |
|---|
public FileInputSystem()
| Method Detail |
|---|
public javax.swing.JPanel getDaqSpecificDialogComponent(AcquisitionDialog acquisitionDialog)
DaqSystemThe 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 DaqSystemacquisitionDialog - the AcquisitionDialog this component will be added to
protected javax.swing.JPanel createDaqDialogPanel()
void addComponent(javax.swing.JPanel panel,
java.awt.Component p,
java.awt.GridBagConstraints constraints)
public void dialogSetParams()
DaqSystem
dialogSetParams in class DaqSystemprivate void fillFileList()
public boolean dialogGetParams()
DaqSystem
dialogGetParams in class DaqSystempublic java.lang.String getSystemType()
getSystemType in class DaqSystemCalling functions should be able to handle 'null'
public java.lang.String getSystemName()
getSystemName in class DaqSystempublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed in interface java.awt.event.ActionListenerprotected void selectFile()
public void setNewFile(java.lang.String newFile)
public void interpretNewFile(java.lang.String newFile)
private boolean loadByteConverter(javax.sound.sampled.AudioFormat audioFormat)
public void setStreamStatus(int streamStatus)
setStreamStatus in class DaqSystempublic int getMaxChannels()
getMaxChannels in class DaqSystempublic int getMaxSampleRate()
getMaxSampleRate in class DaqSystempublic double getPeak2PeakVoltage(int swChannel)
getPeak2PeakVoltage in class DaqSystempublic boolean isRealTime()
isRealTime in class DaqSystempublic boolean canPlayBack(float sampleRate)
canPlayBack in class DaqSystempublic java.io.Serializable getSettingsReference()
getSettingsReference in interface PamSettingspublic long getSettingsVersion()
getSettingsVersion in interface PamSettingspublic java.lang.String getUnitName()
getUnitName in interface PamSettingspublic java.lang.String getUnitType()
getUnitType in interface PamSettingspublic boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
restoreSettings in interface PamSettingspublic int getChannels()
public float getSampleRate()
public boolean prepareSystem(AcquisitionControl daqControl)
DaqSystemUsually this is the time for opening files, preparing data buffers, etc.
prepareSystem in class DaqSystemdaqControl - AcquisitionControl unit.
public java.io.File getCurrentFile()
public int getDataUnitSamples()
getDataUnitSamples in class DaqSystempublic boolean prepareInputFile()
public boolean runFileAnalysis()
public boolean startSystem(AcquisitionControl daqControl)
DaqSystemMost 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 DaqSystemdaqControl - AcquisitionControl unit.
public void stopSystem(AcquisitionControl daqControl)
DaqSystem
stopSystem in class DaqSystempublic void systemHasStopped(boolean wasRunning)
protected boolean openNextFile()
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 DaqSystempublic java.awt.Component getStatusBarComponent()
getStatusBarComponent in class DaqSystempublic void sayEta()
public long getEta()
public void sayEta(long timeMs)
public java.lang.String getDeviceName()
DaqSystem
getDeviceName in class DaqSystem
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||