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.spi
Interface MinimServiceProvider

All Known Implementing Classes:
  JSMinim

    public interface MinimServiceProvider

`MinimServiceProvider` is the interface that an audio implementation must provide to `Minim`, to guarantee that it can provide all of the functionality that Minim promises. All of the interfaces in this package define functionality in the most minimal way possible, to make it easy for people write their own implementations, since much of what Minim provides can be done so without regard for the details of audio intput and output. If you write your own implementation of this interface, or if you are using one that someone else has written, all you must do is pass an instantiation of it to the Minim constructor. That Minim object will then delegate most of the work to the implementation.

Author:
  ddf

Method Summary
`void` | `debugOff()` Tells the implementation it should not produce debug output.
`void` | `debugOn()` Tells the implementation it should produce debug output, if that's something it does.
`AudioRecording` | `getAudioRecording(java.lang.String filename)` Should return an `AudioRecording` that can play the file requested.
`AudioRecordingStream` | `getAudioRecordingStream(java.lang.String filename, int bufferSize)` Should return an `AudioRecordingStream` that will stream the file requested.
`AudioSample` | `getAudioSample(float[] samples, javax.sound.sampled.AudioFormat format, int bufferSize)` Should return an `AudioSample` that will store the provided samples.
`AudioSample` | `getAudioSample(float[] left, float[] right, javax.sound.sampled.AudioFormat format, int bufferSize)` Should return an `AudioSample` that will store the provided samples.
`AudioSample` | `getAudioSample(java.lang.String filename, int bufferSize)` Should return an `AudioSample` that will load the requested file into memory.
`AudioStream` | `getAudioStream(int type, int bufferSize, float sampleRate, int bitDepth)` Should return an `AudioStream` with the requested parameters.
`AudioSynthesizer` | `getAudioSynthesizer(int type, int bufferSize, float sampleRate, int bitDepth)` Should return an `AudioSynthesizer` that can generate audio that will be heard through the computer's speakers.
`SampleRecorder` | `getSampleRecorder(Recordable source, java.lang.String saveTo, boolean buffered)` Should return a `SampleRecorder` that can record the `source` in a buffered (in-memory) or non-buffered (streamed) manner, to the file specified by `saveTo`
`void` | `start()` Called inside the Minim constructor.
`void` | `stop()` Called when `stop()` is called by the Minim object that owns this.

Method Detail

### start

    void start()

  Called inside the Minim constructor. Implementations should load any libraries and resources they need at this time.

### stop

    void stop()

  Called when `stop()` is called by the Minim object that owns this. Implementations should release all resources and stop all Threads at this time.

### debugOn

    void debugOn()

  Tells the implementation it should produce debug output, if that's something it does.

### debugOff

    void debugOff()

  Tells the implementation it should not produce debug output.

### getAudioRecording

    AudioRecording getAudioRecording(java.lang.String filename)

  Should return an `AudioRecording` that can play the file requested. The filename could be a URL, an absolute path, or just a filename that the user expects the system to find in their sketch somewhere.

  Parameters:
    `filename` - the name of the file to load into the AudioRecording
  Returns:
    an AudioRecording that can play the file

### getAudioRecordingStream

    AudioRecordingStream getAudioRecordingStream(java.lang.String filename,
                                                 int bufferSize)

  Should return an `AudioRecordingStream` that will stream the file requested. The filename could be a URL, an absolute path, or just a filename that the user expects the system to find in their sketch somewhere.

  Parameters:
    `filename` - the name of the file to load into the AudioRecordingStream
    `bufferSize` - the bufferSize to use in memory (implementations are free to ignore this, if they must)
  Returns:
    an AudioRecording stream that will stream the file

### getAudioStream

    AudioStream getAudioStream(int type,
                               int bufferSize,
                               float sampleRate,
                               int bitDepth)

  Should return an `AudioStream` with the requested parameters. What Minim is expecting this stream to be reading from is the active audio input of the computer, such as the microphone or line-in.

  Parameters:
    `type` - Minim.STEREO or Minim.MONO
    `bufferSize` - how big the in-memory buffer should be
    `sampleRate` - what the sample rate of the stream should be
    `bitDepth` - what the bit depth of the stream should be
  Returns:
    an AudioStream that is reading from the active audio input of the computer

### getAudioSynthesizer

    AudioSynthesizer getAudioSynthesizer(int type,
                                         int bufferSize,
                                         float sampleRate,
                                         int bitDepth)

  Should return an `AudioSynthesizer` that can generate audio that will be heard through the computer's speakers.

  Parameters:
    `type` - Minim.STEREO or Minim.MONO
    `bufferSize` - how big the in-memory buffer should be
    `sampleRate` - what the sample rate of the generated audio should be
    `bitDepth` - what the bit depth of the generated audio should be
  Returns:
    an AudioSynthesizer that will output to the computer's speakers

### getAudioSample

    AudioSample getAudioSample(java.lang.String filename,
                               int bufferSize)

  Should return an `AudioSample` that will load the requested file into memory.

  Parameters:
    `filename` - the name of the file to load, this might be a URL, an absolute path, or a file that the user expects the implementation to find in their sketch somewhere.
    `bufferSize` - how big the output buffer used for playing the sample should be
  Returns:
    an AudioSample that contains the file

### getAudioSample

    AudioSample getAudioSample(float[] samples,
                               javax.sound.sampled.AudioFormat format,
                               int bufferSize)

  Should return an `AudioSample` that will store the provided samples.

  Parameters:
    `samples` - the array of audio samples
    `bufferSize` - how large the output buffer should be
  Returns:
    an AudioSample that contains the samples

### getAudioSample

    AudioSample getAudioSample(float[] left,
                               float[] right,
                               javax.sound.sampled.AudioFormat format,
                               int bufferSize)

  Should return an `AudioSample` that will store the provided samples.

  Parameters:
    `left` - the left channel of the stereo sample
    `right` - the right channel of a stereo sample
    `bufferSize` - how large the output buffer should be
  Returns:
    an AudioSample that contains the samples

### getSampleRecorder

    SampleRecorder getSampleRecorder(Recordable source,
                                     java.lang.String saveTo,
                                     boolean buffered)

  Should return a `SampleRecorder` that can record the `source` in a buffered (in-memory) or non-buffered (streamed) manner, to the file specified by `saveTo`

  Parameters:
    `source` - the audio source that should be recorded
    `saveTo` - the file to save the recorded audio to
    `buffered` - whether or not to buffer all recorded audio in memory or stream directly to the file
  Returns:
    an appropriate SampleRecorder

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