SoundRecorder
Interface RecorderStorage

All Known Implementing Classes:
PamAudioFileStorage

public interface RecorderStorage

Writes audio data into a file.

The PamRecorder process bocks the data from multiple channels and sends it to PamAudioFileStorage as an array of double arrays.

Author:
Doug Gillespie

Method Summary
 boolean addData(long dataTimeMillis, double[][] newData)
          Adds data to the store.
 boolean closeStorage()
          Closes the storage (and stops recording).
 long getFileBytes()
          Get the file size in bytes
 long getFileMilliSeconds()
          Get the file length in milliseconds
 java.lang.String getFileName()
          Gets the store file name.
 boolean openStorage(javax.sound.sampled.AudioFileFormat.Type fileType, long recordingStart, float sampleRate, int nChannels, int bitDepth)
          Open audio file storage
 boolean reOpenStorage(long recordingStart)
          Reopens the recording storage in a new file (if appropriate) This is done in the RecorderStorage class rather than as separate calls to closeStorage and openStorage in
 

Method Detail

openStorage

boolean openStorage(javax.sound.sampled.AudioFileFormat.Type fileType,
                    long recordingStart,
                    float sampleRate,
                    int nChannels,
                    int bitDepth)
Open audio file storage

Parameters:
fileType - Type of file storage (e.g. AU, AIFF, WAVE)
recordingStart - Start time of recording in milliseconds. The storage system should base a file name on the time
sampleRate - Sample rate for the recording
nChannels - Number of channels in the recording
bitDepth - Number of bits (e.g. 8, 16, 24)
Returns:
true if OK

reOpenStorage

boolean reOpenStorage(long recordingStart)
Reopens the recording storage in a new file (if appropriate) This is done in the RecorderStorage class rather than as separate calls to closeStorage and openStorage in

Parameters:
recordingStart - new recording start time in milliseconds
Returns:
true if OK/

addData

boolean addData(long dataTimeMillis,
                double[][] newData)
Adds data to the store. Data are in a double array newData[channels][samples]. The number of channels must match the number of channels in the call to openStorage and the number of samples must be the same for all channels.

Parameters:
dataTimeMillis - the time of the data
newData - array of arrays of double data arranged by channel and sample
Returns:
true if OK.

closeStorage

boolean closeStorage()
Closes the storage (and stops recording). The input and output data streams are flushed and closed. This automatically causes the write thread to terminate.

Returns:
true if OK

getFileName

java.lang.String getFileName()
Gets the store file name. The file name must be set to null when the file is closed.

Returns:
file name (or name of other store type)

getFileBytes

long getFileBytes()
Get the file size in bytes

Returns:
file size in bytes

getFileMilliSeconds

long getFileMilliSeconds()
Get the file length in milliseconds

Returns:
the file length in milliseconds.