edu.cmu.sphinx.frontend.util
Class ConcatAudioFileDataSource

java.lang.Object
  extended by edu.cmu.sphinx.util.props.ConfigurableAdapter
      extended by edu.cmu.sphinx.frontend.BaseDataProcessor
          extended by edu.cmu.sphinx.frontend.util.AudioFileDataSource
              extended by edu.cmu.sphinx.frontend.util.ConcatAudioFileDataSource
All Implemented Interfaces:
DataProcessor, Configurable, ReferenceSource

public class ConcatAudioFileDataSource
extends AudioFileDataSource
implements ReferenceSource

Concatenates a list of audio files as one continuous audio stream.

A DataStartSignal will be placed before the start of the first file, and a DataEndSignal after the last file. No DataStartSignal or DataEndSignal will be placed between them.

Author:
Holger Brandl

Nested Class Summary
(package private)  class ConcatAudioFileDataSource.InputStreamEnumeration
          The work of the concatenating of the audio files are done here.
 
Field Summary
(package private)  java.util.List<java.net.URL> batchFiles
           
private  boolean isInitialized
           
private  java.net.URL nextFile
           
private  java.util.List<java.lang.String> referenceList
           
 
Fields inherited from class edu.cmu.sphinx.frontend.util.AudioFileDataSource
AUDIO_FILE_LISTENERS, bigEndian, bytesPerRead, bytesPerValue, dataStream, fileListeners, PROP_BYTES_PER_READ, sampleRate, signedData
 
Fields inherited from class edu.cmu.sphinx.util.props.ConfigurableAdapter
logger
 
Constructor Summary
ConcatAudioFileDataSource()
           
ConcatAudioFileDataSource(int bytesPerRead, java.util.List<AudioFileProcessListener> listeners)
           
 
Method Summary
 java.util.List<java.lang.String> getReferences()
          Returns a list of all reference text.
 void initialize()
          Initializes a ConcatFileDataSource.
private static java.util.List<java.net.URL> readDriver(java.lang.String fileName)
          Reads and verifies a driver file.
 void setAudioFile(java.net.URL audioFileURL, java.lang.String streamName)
          Sets the audio file from which the data-stream will be generated of.
 void setBatchFile(java.io.File batchFile)
           
 void setBatchFiles(java.util.List<java.io.File> files)
           
 void setBatchUrls(java.util.List<java.net.URL> urls)
           
 
Methods inherited from class edu.cmu.sphinx.frontend.util.AudioFileDataSource
addNewFileListener, getData, getSampleRate, isBigEndian, newProperties, removeNewFileListener, setAudioFile, setInputStream
 
Methods inherited from class edu.cmu.sphinx.frontend.BaseDataProcessor
getPredecessor, getTimer, setPredecessor
 
Methods inherited from class edu.cmu.sphinx.util.props.ConfigurableAdapter
getName, initLogger, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nextFile

private java.net.URL nextFile

referenceList

private java.util.List<java.lang.String> referenceList

isInitialized

private boolean isInitialized

batchFiles

java.util.List<java.net.URL> batchFiles
Constructor Detail

ConcatAudioFileDataSource

public ConcatAudioFileDataSource(int bytesPerRead,
                                 java.util.List<AudioFileProcessListener> listeners)

ConcatAudioFileDataSource

public ConcatAudioFileDataSource()
Method Detail

initialize

public void initialize()
Initializes a ConcatFileDataSource.

Specified by:
initialize in interface DataProcessor
Overrides:
initialize in class AudioFileDataSource

setBatchFile

public void setBatchFile(java.io.File batchFile)

setBatchFiles

public void setBatchFiles(java.util.List<java.io.File> files)

setBatchUrls

public void setBatchUrls(java.util.List<java.net.URL> urls)

readDriver

private static java.util.List<java.net.URL> readDriver(java.lang.String fileName)
Reads and verifies a driver file.

Parameters:
fileName -

setAudioFile

public void setAudioFile(java.net.URL audioFileURL,
                         java.lang.String streamName)
Description copied from class: AudioFileDataSource
Sets the audio file from which the data-stream will be generated of.

Overrides:
setAudioFile in class AudioFileDataSource
Parameters:
audioFileURL - The location of the audio file to use
streamName - The name of the InputStream. if null the complete path of the audio file will be uses as stream name.

getReferences

public java.util.List<java.lang.String> getReferences()
Returns a list of all reference text. Implements the getReferences() method of ReferenceSource.

Specified by:
getReferences in interface ReferenceSource
Returns:
a list of all reference text