Package Acquisition.pamAudio
Class PamAudioFileManager
java.lang.Object
Acquisition.pamAudio.PamAudioFileManager
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionGet the audio file filter.getAudioFileLoader
(File soundFile) Get the audio file loader for a file.Get the current audio filegetAudioFileLoaders
(List<? extends File> files) Get the loaders which are needed to open a list of filesgetAudioInputStream
(File file) Open an audio input stream.static PamAudioFileManager
Get the instance of the PamAudioManagerGet the default file loader for raw files.boolean
isExtension
(File file, PamAudioFileLoader pamAudioFile) Check if a file has an extension supported by a PamAudioFile.boolean
isSoundFile
(File soundFile, String soundExtension)
-
Constructor Details
-
PamAudioFileManager
public PamAudioFileManager()
-
-
Method Details
-
getAudioFileLoader
Get the audio file loader for a file.- Parameters:
soundFile
- - the sound file- Returns:
- the audio file loader.
-
isExtension
Check if a file has an extension supported by a PamAudioFile.- Parameters:
file
-pamAudioFile
-
-
isSoundFile
-
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
Get the instance of the PamAudioManager -
getAudioFileFilter
Get the audio file filter.- Returns:
- the audio file filter.
-
getAudioFileLoaders
Get the current audio file- Returns:
- a list of the current audio loaders.
-
getAudioFileLoaders
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
Get the default file loader for raw files.- Returns:
- the default file loader for raw files.
-