|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectddf.minim.AudioFileOut
AudioFileOut acts as the base class for classes that write
audio files to disk. When you ask Minim for an AudioFileOut
you will be returned a specific derived class, depending on whether you
requested buffered recording or not. The difference between buffered
recording and unbuffered recording is that buffered recording writes
to an in-memory array and then pushes the entire array into a file when
you call save, while unbuffered recording writes directly
to disk as it receives data and then back-patches the file when asked to
save. Back-patching is simply modifying the file header to reflect the
actual length of the file, since it could not be known at the outset.
It should be noted that currently the only file formats supported by
unbuffered recording are AIFF, AU, and WAV. Whereas buffered recording
can also save as AIFC and SND (or at least is should be able to,
it may depend on the system). A second major difference is that with
buffered recording the file format can be specified at save time. This is
because the file is not actually created until save is called.
This fact also makes it possible to save the same recording buffer to
multiple file formats by simply calling
save(javax.sound.sampled.AudioFileFormat.Type) with each format
desired. This is not possible with unbuffered recording because the
file must be opened before any audio is written and therefore the
file format must be specified at the outset and cannot be changed later.
When specifying the name for the file in the constructor or in setName(),
do not include the file extension, it will be added based on the file format you
request.
| Field Summary | |
static javax.sound.sampled.AudioFileFormat.Type |
AIFC
The .aifc file format. |
static javax.sound.sampled.AudioFileFormat.Type |
AIFF
The .aiff file format. |
static javax.sound.sampled.AudioFileFormat.Type |
AU
The .au file format. |
protected java.lang.String |
filename
|
protected javax.sound.sampled.AudioFileFormat.Type |
fileType
|
protected javax.sound.sampled.AudioFormat |
format
|
protected boolean |
recording
|
static javax.sound.sampled.AudioFileFormat.Type |
SND
The .snd file format. |
static javax.sound.sampled.AudioFileFormat.Type |
WAV
The .wav file format. |
| Constructor Summary | |
AudioFileOut(javax.sound.sampled.AudioFormat format,
java.lang.String name)
Constructs an AudioFileOut from the passed AudioFormat and
filename. |
|
| Method Summary | |
boolean |
isRecording()
|
abstract void |
save()
Saves the recorded audio. |
abstract void |
save(javax.sound.sampled.AudioFileFormat.Type fileType)
Saves the recorded audio in the requested file format. |
void |
setName(java.lang.String name)
Sets the name of the file being saved to. |
void |
setType(javax.sound.sampled.AudioFileFormat.Type type)
Sets the file format that will be used for saving. |
void |
startRecording()
Starts recording audio. |
void |
stopRecording()
Stops recording audio. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface ddf.minim.ARListener |
readSamples |
| Field Detail |
public static javax.sound.sampled.AudioFileFormat.Type WAV
public static javax.sound.sampled.AudioFileFormat.Type AIFF
public static javax.sound.sampled.AudioFileFormat.Type AIFC
public static javax.sound.sampled.AudioFileFormat.Type AU
public static javax.sound.sampled.AudioFileFormat.Type SND
protected javax.sound.sampled.AudioFormat format
protected java.lang.String filename
protected javax.sound.sampled.AudioFileFormat.Type fileType
protected boolean recording
| Constructor Detail |
public AudioFileOut(javax.sound.sampled.AudioFormat format,
java.lang.String name)
AudioFileOut from the passed AudioFormat and
filename.
format - the audio format of the audio that will be recordedname - the name of the file to save to (without the extension)| Method Detail |
public void startRecording()
save is called.
public void stopRecording()
save is called.
public boolean isRecording()
public void setName(java.lang.String name)
name - the name of the file (without the extension)#setName(String)public void setType(javax.sound.sampled.AudioFileFormat.Type type)
type - #setType(javax.sound.sampled.AudioFileFormat.Type)public abstract void save()
#save(),
#save()public abstract void save(javax.sound.sampled.AudioFileFormat.Type fileType)
fileType - the file format to save the recorded audio as#save(javax.sound.sampled.AudioFileFormat.Type),
#save(javax.sound.sampled.AudioFileFormat.Type)
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||