ddf.minim.javasound
Class JSMinim

java.lang.Object
  extended by ddf.minim.javasound.JSMinim
All Implemented Interfaces:
MinimServiceProvider

public class JSMinim
extends java.lang.Object
implements MinimServiceProvider

JSMinim is an implementation of the MinimServiceProvider interface that use Javasound to provide all audio functionality. That's about all you really need to know about it.

Author:
Damien Di Fede

Constructor Summary
JSMinim(processing.core.PApplet parent)
           
 
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.
 AudioStream getAudioInput(int type, int bufferSize, float sampleRate, int bitDepth)
          Should return an AudioStream with the requested parameters.
 AudioOut getAudioOutput(int type, int bufferSize, float sampleRate, int bitDepth)
          Should return an AudioOut that can be used to generate audio that will be heard through the computer's speakers.
 AudioRecording getAudioRecording(java.lang.String filename)
          Deprecated.  
 AudioRecording getAudioRecordingClip(java.lang.String filename)
          Deprecated.  
 AudioRecordingStream getAudioRecordingStream(java.lang.String filename, int bufferSize, boolean inMemory)
          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.
 javax.sound.sampled.Mixer getInputMixer()
           
 javax.sound.sampled.Mixer getOutputMixer()
           
 SampleRecorder getSampleRecorder(Recordable source, java.lang.String fileName, 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 setInputMixer(javax.sound.sampled.Mixer mix)
           
 void setOutputMixer(javax.sound.sampled.Mixer mix)
           
 void start()
          Called inside the Minim constructor.
 void stop()
          Called when stop() is called by the Minim object that owns this.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JSMinim

public JSMinim(processing.core.PApplet parent)
Method Detail

setInputMixer

public void setInputMixer(javax.sound.sampled.Mixer mix)

getInputMixer

public javax.sound.sampled.Mixer getInputMixer()

setOutputMixer

public void setOutputMixer(javax.sound.sampled.Mixer mix)

getOutputMixer

public javax.sound.sampled.Mixer getOutputMixer()

start

public void start()
Description copied from interface: MinimServiceProvider
Called inside the Minim constructor. Implementations should load any libraries and resources they need at this time.

Specified by:
start in interface MinimServiceProvider

stop

public void stop()
Description copied from interface: MinimServiceProvider
Called when stop() is called by the Minim object that owns this. Implementations should release all resources and stop all Threads at this time.

Specified by:
stop in interface MinimServiceProvider

debugOn

public void debugOn()
Description copied from interface: MinimServiceProvider
Tells the implementation it should produce debug output, if that's something it does.

Specified by:
debugOn in interface MinimServiceProvider

debugOff

public void debugOff()
Description copied from interface: MinimServiceProvider
Tells the implementation it should not produce debug output.

Specified by:
debugOff in interface MinimServiceProvider

getSampleRecorder

public SampleRecorder getSampleRecorder(Recordable source,
                                        java.lang.String fileName,
                                        boolean buffered)
Description copied from interface: MinimServiceProvider
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

Specified by:
getSampleRecorder in interface MinimServiceProvider
Parameters:
source - the audio source that should be recorded
fileName - 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

getAudioRecordingStream

public AudioRecordingStream getAudioRecordingStream(java.lang.String filename,
                                                    int bufferSize,
                                                    boolean inMemory)
Description copied from interface: MinimServiceProvider
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.

Specified by:
getAudioRecordingStream in interface MinimServiceProvider
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)
inMemory - TODO
Returns:
an AudioRecording stream that will stream the file

getAudioInput

public AudioStream getAudioInput(int type,
                                 int bufferSize,
                                 float sampleRate,
                                 int bitDepth)
Description copied from interface: MinimServiceProvider
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.

Specified by:
getAudioInput in interface MinimServiceProvider
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

getAudioSample

public AudioSample getAudioSample(java.lang.String filename,
                                  int bufferSize)
Description copied from interface: MinimServiceProvider
Should return an AudioSample that will load the requested file into memory.

Specified by:
getAudioSample in interface MinimServiceProvider
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

public AudioSample getAudioSample(float[] samples,
                                  javax.sound.sampled.AudioFormat format,
                                  int bufferSize)
Description copied from interface: MinimServiceProvider
Should return an AudioSample that will store the provided samples.

Specified by:
getAudioSample in interface MinimServiceProvider
Parameters:
samples - the array of audio samples
bufferSize - how large the output buffer should be
Returns:
an AudioSample that contains the samples

getAudioSample

public AudioSample getAudioSample(float[] left,
                                  float[] right,
                                  javax.sound.sampled.AudioFormat format,
                                  int bufferSize)
Description copied from interface: MinimServiceProvider
Should return an AudioSample that will store the provided samples.

Specified by:
getAudioSample in interface MinimServiceProvider
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

getAudioOutput

public AudioOut getAudioOutput(int type,
                               int bufferSize,
                               float sampleRate,
                               int bitDepth)
Description copied from interface: MinimServiceProvider
Should return an AudioOut that can be used to generate audio that will be heard through the computer's speakers.

Specified by:
getAudioOutput in interface MinimServiceProvider
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

getAudioRecordingClip

public AudioRecording getAudioRecordingClip(java.lang.String filename)
Deprecated. 


getAudioRecording

public AudioRecording getAudioRecording(java.lang.String filename)
Deprecated. 

Specified by:
getAudioRecording in interface MinimServiceProvider