|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectddf.minim.AudioRecorder
An AudioRecorder can be used to record audio that is being
played by a Recordable object. An AudioRecorder
need not necessarily record to disk, but the recorders you receive from
Minim.createRecorder(Recordable, String, boolean) will do so. If
you'd like to save a file somewhere other than the sketches root folder, you
can constructor an AudioRecorder directly, using an absolute
path for the filename (such as "C:\My Documents\Music\song.wav"). You can
also create a recorder that uses your own implementation of
SampleRecorder (like if you wanted to implement an mp3 encoder).
| Constructor Summary | |
AudioRecorder(Recordable recordSource,
SampleRecorder recorder)
Constructs an AudioRecorder that will use
recorder to record recordSource. |
|
AudioRecorder(Recordable recordSource,
java.lang.String fileName,
javax.sound.sampled.AudioFileFormat.Type fileType,
boolean buffered)
Constructs an AudioRecorder with the given parameters. |
|
| Method Summary | |
void |
beginRecord()
Begins recording audio from the current record source. |
void |
endRecord()
Halts the recording of audio from the current record source. |
boolean |
isRecording()
Returns the current record state. |
AudioRecording |
save()
Requests the current SampleRecorder to save. |
void |
setRecordSource(Recordable recordSource)
Sets the record source for this recorder. |
void |
setSampleRecorder(SampleRecorder recorder)
Sets the SampleRecorder for this recorder. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public AudioRecorder(Recordable recordSource,
java.lang.String fileName,
javax.sound.sampled.AudioFileFormat.Type fileType,
boolean buffered)
AudioRecorder with the given parameters. Note
that fileName must be an absolute path and that
fileType should be a supported audio file type. When using
buffered recording, be aware that all recorded samples are stored in memory
(meaning a long recording will take up a lot of memory) and that a
subsequent call to save() will write the entire buffer to disk,
causing the thread of execution to block until all samples have been
written. This means that your sketch will appear to hang when you save
large recordings.
recordSource - the source to recordfileName - the file to save to (must be an absolute path)fileType - the format of the file (ie Minim.WAV, Minim.AU, etc.)buffered - whether or not to use buffered recording
public AudioRecorder(Recordable recordSource,
SampleRecorder recorder)
AudioRecorder that will use
recorder to record recordSource.
recordSource - the Recordable object to recordrecorder - the SampleRecorder to use to record it| Method Detail |
public void beginRecord()
save() was not called, samples will be
appended to the end of the material recorded so far.
public void endRecord()
public boolean isRecording()
public AudioRecording save()
SampleRecorder to save. This will only
work if you have called endRecord(). If this was created with a
buffered recorder, then calling beginRecord() after saving will
not overwrite the file on the disk, unless this method is subsequently
called. However, if this was created with an unbuffered recorder, it is
likely that a call to beginRecord() will create the file again,
overwriting the file that had previously been saved. An
AudioRecording will be returned if the
SampleRecorder used to record the audio saved to a file
(this will always be the case if you use createRecorder or
the first constructor for AudioRecorder).
AudioRecording,
or null if the audio was not recorded to a filepublic void setRecordSource(Recordable recordSource)
recordSource - the new record sourcepublic void setSampleRecorder(SampleRecorder recorder)
SampleRecorder for this recorder. Similar caveats
apply as with setRecordSource(Recordable). This calls
endRecord and save on the current
SampleRecorder before setting the new one.
recorder - the new SampleRecorder to use
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||