Class PamAudioFileManager

java.lang.Object
Acquisition.pamAudio.PamAudioFileManager

public class PamAudioFileManager extends Object
Central class for opening sound files.

PamAudioFieManager holds a list of PamAudioFile classes. Each PamAudioFile can open a certain type of sound file e.g. flac or raw wav files. PamAudioFieManager provides functions around the list to open files, provide file filters etc.

Author:
Jamie Macaulay
  • Constructor Details

    • PamAudioFileManager

      public PamAudioFileManager()
  • Method Details

    • getAudioFileLoader

      public PamAudioFileLoader getAudioFileLoader(File soundFile)
      Get the audio file loader for a file.
      Parameters:
      soundFile - - the sound file
      Returns:
      the audio file loader.
    • isExtension

      public boolean isExtension(File file, PamAudioFileLoader pamAudioFile)
      Check if a file has an extension supported by a PamAudioFile.
      Parameters:
      file -
      pamAudioFile -
    • isSoundFile

      public boolean isSoundFile(File soundFile, String soundExtension)
    • getAudioInputStream

      public AudioInputStream getAudioInputStream(File file) throws UnsupportedAudioFileException, IOException
      Open an audio input stream. If the file is a Wav file, then it will attempt to read the file with PAMGuards bespoke audio stream reader. This includes support for wav files which are > 2GByte in size and also works for floating point 32 bit files (which the Java one doesn't). If that fails, or if its not a wav file, then the standard java AudioInputStream is used.
      Parameters:
      file - file to open
      Returns:
      a new audio input stream
      Throws:
      UnsupportedAudioFileException - thrown if it can't understand the audio format.
      IOException
    • getInstance

      public static PamAudioFileManager getInstance()
      Get the instance of the PamAudioManager
    • getAudioFileFilter

      public PamAudioFileFilter getAudioFileFilter()
      Get the audio file filter.
      Returns:
      the audio file filter.
    • getAudioFileLoaders

      public ArrayList<PamAudioFileLoader> getAudioFileLoaders()
      Get the current audio file
      Returns:
      a list of the current audio loaders.
    • getAudioFileLoaders

      public ArrayList<PamAudioFileLoader> getAudioFileLoaders(List<? extends File> files)
      Get the loaders which are needed to open a list of files
      Parameters:
      files - - the files to find audio loaders for.
      Returns:
      a list of the audio loaders required for the file list
    • getRawFileLoader

      public WavAudioFile getRawFileLoader()
      Get the default file loader for raw files.
      Returns:
      the default file loader for raw files.