Class DaqSystem
- Direct Known Subclasses:
ASIOSoundSystem
,FileInputSystem
,icListenSystem
,MCCDaqSystem
,NewAsioSoundSystem
,NIDAQProcess
,NINetworkDaq
,SimProcess
,SmruDaqSystem
,SoundCardSystem
,STDaqSystem
1. Provides information about the device such as min and max sample rates, number of channelse, etc. 2. Provides a dialog panel with specific options. This automatically gets incorporated into a more general data acquisition panel 3. Provides threads and any other functions necessary to create packets of raw audio data in PamDataUnit's. 4. Each concrete class should, if needed, save it's own setting using the PamSettings package.
Current examples are in SoundCardSystem and FileInputSystem
- Author:
- Doug Gillespie
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
areSampleSettingsOk
(int numInputsRequested, float sampleRateRequested) abstract boolean
canPlayBack
(float sampleRate) abstract void
Called after DAQ has stopped - for whatever reason.abstract boolean
Called by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog component.abstract void
Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's fieldsdouble
getChannelGain
(int channel) Included so that can add additional channel specific gain values for SMRU daq cardgetDaqSpecificChannelListNode
(AcquisitionPaneFX acquisitionPaneFX) Get a channel list panel (invented for NI cards which have many more options)getDaqSpecificChannelListPanel
(AcquisitionDialog acquisitionDialog) Get a channel list panel (invented for NI cards which have many more options)abstract JComponent
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.getDAQSpecificPane
(AcquisitionPaneFX acquisitionPaneFX) The AcquisitionDialog has been designed to that each data source type can plug in it's own panel of device specific controls.abstract int
abstract String
Gets a name for the acquisition device (may just be a number but need to generalise).int
getInputChannelMap
(AcquisitionParameters acquisitionParameters) abstract int
abstract int
abstract double
getPeak2PeakVoltage
(int swChannel) getPlaybackSystem
(PlaybackControl playbackControl, DaqSystem daqSystem) Gets a playback system for playing sound back out through headphones / speakers, etc.int
Get the number of bits in each sample.long
int
Status of the intput streamabstract String
abstract String
abstract boolean
void
notifyModelChanged
(int changeType) Get model changed events.abstract boolean
prepareSystem
(AcquisitionControl daqControl) Prepare the DaqSystem.void
setSelected
(boolean select) Tell a DAQ system it's been selected or deselected.void
setStreamStatus
(int streamStatus) void
showSampleSettingsDialog
(AcquisitionDialog acquisitionDialog) abstract boolean
startSystem
(AcquisitionControl daqControl) Start the DaqSystem.abstract void
stopSystem
(AcquisitionControl daqControl) Stop the DaqSystem.boolean
-
Field Details
-
PARAMETER_UNKNOWN
public static final int PARAMETER_UNKNOWN- See Also:
-
PARAMETER_FIXED
public static final int PARAMETER_FIXED- See Also:
-
STREAM_CLOSED
public static final int STREAM_CLOSED- See Also:
-
STREAM_OPEN
public static final int STREAM_OPEN- See Also:
-
STREAM_RUNNING
public static final int STREAM_RUNNING- See Also:
-
STREAM_PAUSED
public static final int STREAM_PAUSED- See Also:
-
STREAM_ENDED
public static final int STREAM_ENDED- See Also:
-
-
Constructor Details
-
DaqSystem
public DaqSystem()
-
-
Method Details
-
getSystemType
- Returns:
- The 'type' of data source for display in the Data Source dialog
Calling functions should be able to handle 'null'
-
getSystemName
- Returns:
- A string describing the data source, e.g. the sound card name, file name, udp port, etc.
-
getDaqSpecificDialogComponent
The AcquisitionDialog has been designed to that each data source type can plug in it's own panel of device specific controls. These could be things like a file name, gain settings, channel lists, whatever is available for the specific deviceThe 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.
- Parameters:
acquisitionDialog
- the AcquisitionDialog this component will be added to- Returns:
- dialog component specific to this DAQ device
-
getDaqSpecificChannelListPanel
Get a channel list panel (invented for NI cards which have many more options)- Parameters:
acquisitionDialog
- reference to main acquisition dialog- Returns:
- ChannelListPanel component.
-
dialogSetParams
public abstract void dialogSetParams()Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's fields -
dialogGetParams
public abstract boolean dialogGetParams()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.- Returns:
- true if the parameters and selections are OK. If false is returned the Acquisition dialog will not respond to its Ok button.
-
setSelected
public void setSelected(boolean select) Tell a DAQ system it's been selected or deselected.- Parameters:
select
-
-
notifyModelChanged
public void notifyModelChanged(int changeType) Get model changed events.- Parameters:
changeType
-
-
getMaxSampleRate
public abstract int getMaxSampleRate()- Returns:
- the maximum sample rate supporrted by the selected device, or PARAMETER_UNKNOWN
-
getMaxChannels
public abstract int getMaxChannels()- Returns:
- the maximum number of channels supporrted by the selected device, or PARAMETER_UNKNOWN
-
getPeak2PeakVoltage
public abstract double getPeak2PeakVoltage(int swChannel) - Returns:
- peak to peak voltage for the device or PARAMETER_UNKNOWN
-
prepareSystem
Prepare the DaqSystem.Usually this is the time for opening files, preparing data buffers, etc.
- Parameters:
daqControl
- AcquisitionControl unit.- Returns:
- true if OK, false otherwise.
-
startSystem
Start 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)
- Parameters:
daqControl
- AcquisitionControl unit.- Returns:
- true if OK, false otherwise
-
stopSystem
Stop the DaqSystem.- Parameters:
daqControl
-
-
isRealTime
public abstract boolean isRealTime()- Returns:
- true for real time systems (e.g. sound cards, NI cards, wav files which are being played back over speakers. false for reading files which are to be processed as fast as possible with no playback.
-
canPlayBack
public abstract boolean canPlayBack(float sampleRate) - Returns:
- true if the system can also play back sound - likely to be true for sound cards and ASIO, and some NI cards, false for wav files. Simulator ?
-
getDataUnitSamples
public abstract int getDataUnitSamples()- Returns:
- the number of samples expected in each data unit.
-
getPlaybackSystem
Gets a playback system for playing sound back out through headphones / speakers, etc.Generally, anything acquiring data in real time should play the sound back through itself so that clocks are correctly synchronised. i.e. A sound card input will go to the same sound card output, etc. At a later date, we may try to support output through different devices at different speeds - but this will be problematic !
If data are being read from a file, then playback is through a sound card which sits in a stand alone implementation of PlaybackSystem
- Parameters:
playbackControl
-daqSystem
-- Returns:
- null if no playback available or a PlaybackSystem object.
- See Also:
-
daqHasEnded
public abstract void daqHasEnded()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. -
getStreamStatus
public int getStreamStatus()Status of the intput stream- Returns:
- stream status
-
setStreamStatus
public void setStreamStatus(int streamStatus) -
areSampleSettingsOk
public boolean areSampleSettingsOk(int numInputsRequested, float sampleRateRequested) -
showSampleSettingsDialog
-
getStatusBarComponent
-
supportsChannelLists
public boolean supportsChannelLists() -
getInputChannelMap
- Returns:
- a bitmap of output channels. this should ALWAYS be a bitmap of channels 0 to n-1 even if different hardware channels are used since hardware channels are no longer passed through PAMGUARD.
-
getDeviceName
Gets a name for the acquisition device (may just be a number but need to generalise).- Returns:
-
getChannelGain
public double getChannelGain(int channel) Included so that can add additional channel specific gain values for SMRU daq card- Parameters:
channel
- channel number- Returns:
- channel specific gain
-
getSampleBits
public int getSampleBits()Get the number of bits in each sample.- Returns:
- the number of bits in each sample.
-
getStallCheckSeconds
public long getStallCheckSeconds()- Returns:
- how often its reasonable to check whether or not the system has stalled.
-
getDaqSpecificChannelListNode
Get a channel list panel (invented for NI cards which have many more options)- Parameters:
acquisitionDialog
- reference to main acquisition dialog- Returns:
- ChannelListPanel component.
-
getDAQSpecificPane
The AcquisitionDialog has been designed to that each data source type can plug in it's own panel of device specific controls. These could be things like a file name, gain settings, channel lists, whatever is available for the specific deviceThe 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.
- Parameters:
acquisitionDialog
- the AcquisitionPaneFX this component will be added to- Returns:
- dialog component specific to this DAQ device
-