Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ddf.minim
Class AudioRecorder

    java.lang.Object
      ddf.minim.AudioRecorder

    public class AudioRecorder

extends java.lang.Object

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).

Author:
  Damien Di Fede

Constructor Summary
`AudioRecorder(Recordable recordSource, SampleRecorder recorder)` Constructs an `AudioRecorder` that will use `recorder` to record `recordSource`.

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.
`AudioPlayer` | `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

### AudioRecorder

    public AudioRecorder(Recordable recordSource,
                         SampleRecorder recorder)

  Constructs an `AudioRecorder` that will use `recorder` to record `recordSource`.

  Parameters:
    `recordSource` - the `Recordable` object to record
    `recorder` - the `SampleRecorder` to use to record it

Method Detail

### beginRecord

    public void beginRecord()

  Begins recording audio from the current record source. If recording was previously halted, and `save()` was not called, samples will be appended to the end of the material recorded so far.

### endRecord

    public void endRecord()

  Halts the recording of audio from the current record source.

### isRecording

    public boolean isRecording()

  Returns the current record state.

  Returns:
    true if this is currently recording

### save

    public AudioPlayer save()

  Requests the current `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`).

  Returns:
    the audio that was recorded as an `AudioPlayer`

### setRecordSource

    public void setRecordSource(Recordable recordSource)

  Sets the record source for this recorder. The record source can be set at any time, though in practice it is probably a good idea to mute the old record source, then add the new record source, also muted, and then unmute the new record source. Otherwise, you'll probably wind up with a pop in the recording.

  Parameters:
    `recordSource` - the new record source

### setSampleRecorder

    public void setSampleRecorder(SampleRecorder recorder)

  Sets the `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.

  Parameters:
    `recorder` - the new `SampleRecorder` to use

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD