Package Acquisition

Class RawDataBinaryDataSource

java.lang.Object
binaryFileStorage.BinaryDataSource
Acquisition.RawDataBinaryDataSource

public class RawDataBinaryDataSource extends BinaryDataSource
Data source for Raw acoustic data. This is set up to NEVER be written to binary storage files - WAV files are way better for that. The purpose of this class is to enable sending of raw audio data over the network. Currently assumes 16 bit audio, but may make this more flexible in the future is higher res ADC's are in use within PAMGUARD.
Author:
Doug Gillespie
  • Constructor Details

    • RawDataBinaryDataSource

      public RawDataBinaryDataSource(PamRawDataBlock sisterDataBlock)
  • Method Details

    • getModuleHeaderData

      public byte[] getModuleHeaderData()
      Specified by:
      getModuleHeaderData in class BinaryDataSource
      Returns:
      Additional information (e.g. a control structure for a detector) to be stored in the Module Specific Control structure
    • getModuleVersion

      public int getModuleVersion()
      Description copied from class: BinaryDataSource
      Get a version number for the module.

      This is different to the version number in the main file header and allows individual modules to update their format and maintain backwards compatibility with old data

      Specified by:
      getModuleVersion in class BinaryDataSource
      Returns:
      integer module version number
    • getStreamName

      public String getStreamName()
      Specified by:
      getStreamName in class BinaryDataSource
      Returns:
      Stream name to be stored in the file header
    • getStreamVersion

      public int getStreamVersion()
      Specified by:
      getStreamVersion in class BinaryDataSource
      Returns:
      Stream version name to be stored in the Module Specific Control structure
    • newFileOpened

      public void newFileOpened(File outputFile)
      Description copied from class: BinaryDataSource
      Called from the BinaryOutputStream whenever a new output file is opened.
      Specified by:
      newFileOpened in class BinaryDataSource
      Parameters:
      outputFile - file information.
    • getPackedData

      public BinaryObjectData getPackedData(PamDataUnit pamDataUnit)
      Description copied from class: BinaryDataSource
      Get packed binary data for either sending to file or over the network
      Specified by:
      getPackedData in class BinaryDataSource
      Parameters:
      pamDataUnit - data unit to pack
      Returns:
      packed binary data object
    • sinkData

      public PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion)
      Description copied from class: BinaryDataSource
      Convert data read back in in viewer mode into the correct type of PamDataUnit.

      DO NOT add this unit directly to the datablock, but pass it back to the calling process which will add it to the datablock if necessary.

      Specified by:
      sinkData in class BinaryDataSource
      Parameters:
      binaryObjectData - Binary data read back from a file.
      bh - binary header from start of file.
      Returns:
      the PamDataUnit created from these data
    • sinkModuleFooter

      public ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData, BinaryHeader bh, ModuleHeader moduleHeader)
      Description copied from class: BinaryDataSource
      Do something with module footer information
      Specified by:
      sinkModuleFooter in class BinaryDataSource
      Parameters:
      binaryObjectData - data for the module header.
      bh - Binary header information
    • sinkModuleHeader

      public ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh)
      Description copied from class: BinaryDataSource
      Do something with module header information
      Specified by:
      sinkModuleHeader in class BinaryDataSource
      Parameters:
      binaryObjectData - data for the module header.
      bh - Binary header information
    • reset

      public void reset()
      Description copied from class: BinaryDataSource
      Reset anything needing resetting in the binary data source. This get's called just before PamStart().
      Overrides:
      reset in class BinaryDataSource