public class PamAudioFileStorage extends java.lang.Object implements RecorderStorage
RecorderStorage
Constructor and Description |
---|
PamAudioFileStorage(RecorderControl recorderControl) |
Modifier and Type | Method and Description |
---|---|
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)
Write data to an audio file.
|
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
|
public PamAudioFileStorage(RecorderControl recorderControl)
public java.lang.String getFileName()
RecorderStorage
getFileName
in interface RecorderStorage
public boolean addData(long dataTimeMillis, double[][] newData)
RecorderStorage
addData
in interface RecorderStorage
dataTimeMillis
- the time of the datanewData
- array of arrays of double data arranged by channel and samplepublic boolean closeStorage()
RecorderStorage
closeStorage
in interface RecorderStorage
public boolean openStorage(javax.sound.sampled.AudioFileFormat.Type fileType, long recordingStart, float sampleRate, int nChannels, int bitDepth)
Writing audio data is relatively straight forward. The actual writing is done in a separate thread. That thread needs an InputStream to read data from. This is one end of a pair of PipedInput and PipedOutput Streams. This thread writes data into the other end of the pipe as it arrives.
openStorage
in interface RecorderStorage
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 timesampleRate
- Sample rate for the recordingnChannels
- Number of channels in the recordingbitDepth
- Number of bits (e.g. 8, 16, 24)public boolean reOpenStorage(long recordingStart)
RecorderStorage
reOpenStorage
in interface RecorderStorage
recordingStart
- new recording start time in millisecondspublic long getFileBytes()
RecorderStorage
getFileBytes
in interface RecorderStorage
public long getFileMilliSeconds()
RecorderStorage
getFileMilliSeconds
in interface RecorderStorage