Package Acquisition

Class DaqSystem

java.lang.Object
Acquisition.DaqSystem
Direct Known Subclasses:
ASIOSoundSystem, FileInputSystem, icListenSystem, MCCDaqSystem, NewAsioSoundSystem, NIDAQProcess, NINetworkDaq, SimProcess, SmruDaqSystem, SoundCardSystem, STDaqSystem

public abstract class DaqSystem extends Object
Abstraction to multiple data acquisition devices. This interface performs the following tasks:

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 Details

  • Constructor Details

    • DaqSystem

      public DaqSystem()
  • Method Details

    • getSystemType

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

      Calling functions should be able to handle 'null'

    • getSystemName

      public abstract String getSystemName()
      Returns:
      A string describing the data source, e.g. the sound card name, file name, udp port, etc.
    • getDaqSpecificDialogComponent

      public 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. These could be things like a file name, gain settings, channel lists, whatever is available for the specific device

      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.

      Parameters:
      acquisitionDialog - the AcquisitionDialog this component will be added to
      Returns:
      dialog component specific to this DAQ device
    • getDaqSpecificChannelListPanel

      public ChannelListPanel getDaqSpecificChannelListPanel(AcquisitionDialog acquisitionDialog)
      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

      public abstract boolean prepareSystem(AcquisitionControl daqControl)
      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

      public abstract boolean startSystem(AcquisitionControl daqControl)
      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)

      Parameters:
      daqControl - AcquisitionControl unit.
      Returns:
      true if OK, false otherwise
    • stopSystem

      public abstract void stopSystem(AcquisitionControl daqControl)
      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

      public PlaybackSystem getPlaybackSystem(PlaybackControl playbackControl, DaqSystem daqSystem)
      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

      public void showSampleSettingsDialog(AcquisitionDialog acquisitionDialog)
    • getStatusBarComponent

      public Component getStatusBarComponent()
    • supportsChannelLists

      public boolean supportsChannelLists()
    • getInputChannelMap

      public int getInputChannelMap(AcquisitionParameters acquisitionParameters)
      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

      public abstract String 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

      public ChannelListPanel getDaqSpecificChannelListNode(AcquisitionPaneFX acquisitionPaneFX)
      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

      public DAQSettingsPane 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. These could be things like a file name, gain settings, channel lists, whatever is available for the specific device

      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.

      Parameters:
      acquisitionDialog - the AcquisitionPaneFX this component will be added to
      Returns:
      dialog component specific to this DAQ device