|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectSoundRecorder.PamAudioFileStorage
public class PamAudioFileStorage
Implementation of RecorderStorage specific to audio files.
RecorderStorage| Nested Class Summary | |
|---|---|
(package private) class |
PamAudioFileStorage.WriteThread
WriteThread makes a single call to AudioSystem.write. |
| Field Summary | |
|---|---|
private java.io.File |
audioFile
|
(package private) javax.sound.sampled.AudioFileFormat.Type |
audioFileType
|
private javax.sound.sampled.AudioFormat |
audioFormat
|
private javax.sound.sampled.AudioInputStream |
audioInputStream
|
(package private) int |
bitDepth
|
(package private) byte[] |
byteBuffer
|
(package private) long |
fileBytes
|
private java.lang.String |
fileName
|
(package private) long |
fileStartMillis
|
(package private) javax.sound.sampled.AudioFileFormat.Type |
fileType
|
(package private) long |
lastDataMillis
|
(package private) int |
nChannels
|
private java.io.PipedInputStream |
pipedInputStream
|
private java.io.PipedOutputStream |
pipedOutputStream
|
private RecorderControl |
recorderControl
|
(package private) float |
sampleRate
|
(package private) long |
totalFrames
|
private java.lang.Thread |
writeThread
|
| Constructor Summary | |
|---|---|
PamAudioFileStorage(RecorderControl recorderControl)
|
|
| 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)
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 |
private void |
writeData()
Called within the write thread, this does not return until the pipes get closed. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private java.lang.String fileName
private RecorderControl recorderControl
private javax.sound.sampled.AudioFormat audioFormat
private javax.sound.sampled.AudioInputStream audioInputStream
private java.io.File audioFile
private java.io.PipedInputStream pipedInputStream
private java.io.PipedOutputStream pipedOutputStream
byte[] byteBuffer
javax.sound.sampled.AudioFileFormat.Type fileType
long fileBytes
long fileStartMillis
long lastDataMillis
private java.lang.Thread writeThread
long totalFrames
float sampleRate
javax.sound.sampled.AudioFileFormat.Type audioFileType
int nChannels
int bitDepth
| Constructor Detail |
|---|
public PamAudioFileStorage(RecorderControl recorderControl)
| Method Detail |
|---|
public java.lang.String getFileName()
RecorderStorage
getFileName in interface RecorderStorage
public boolean addData(long dataTimeMillis,
double[][] newData)
RecorderStorage
addData in interface RecorderStoragedataTimeMillis - the time of the datanewData - array of arrays of double data arranged by channel and sample
public 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 RecorderStoragefileType - 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 RecorderStoragerecordingStart - new recording start time in milliseconds
private void writeData()
public long getFileBytes()
RecorderStorage
getFileBytes in interface RecorderStoragepublic long getFileMilliSeconds()
RecorderStorage
getFileMilliSeconds in interface RecorderStorage
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||