public class JSMinim extends java.lang.Object implements MinimServiceProvider
MinimServiceProvider
interface that use
Javasound to provide all audio functionality. That's about all you really need to know about it.Constructor and Description |
---|
JSMinim(processing.core.PApplet parent) |
Modifier and Type | Method and Description |
---|---|
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. |
public void setInputMixer(javax.sound.sampled.Mixer mix)
public javax.sound.sampled.Mixer getInputMixer()
public void setOutputMixer(javax.sound.sampled.Mixer mix)
public javax.sound.sampled.Mixer getOutputMixer()
public void start()
MinimServiceProvider
start
in interface MinimServiceProvider
public void stop()
MinimServiceProvider
stop()
is called by the Minim object that owns this.
Implementations should release all resources and stop all Threads at this time.stop
in interface MinimServiceProvider
public void debugOn()
MinimServiceProvider
debugOn
in interface MinimServiceProvider
public void debugOff()
MinimServiceProvider
debugOff
in interface MinimServiceProvider
public SampleRecorder getSampleRecorder(Recordable source, java.lang.String fileName, boolean buffered)
MinimServiceProvider
SampleRecorder
that can record the source
in a
buffered (in-memory) or non-buffered (streamed) manner, to the file specified by saveTo
getSampleRecorder
in interface MinimServiceProvider
source
- the audio source that should be recordedfileName
- the file to save the recorded audio tobuffered
- whether or not to buffer all recorded audio in memory or stream directly to the filepublic AudioRecordingStream getAudioRecordingStream(java.lang.String filename, int bufferSize, boolean inMemory)
MinimServiceProvider
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.getAudioRecordingStream
in interface MinimServiceProvider
filename
- the name of the file to load into the AudioRecordingStreambufferSize
- the bufferSize to use in memory (implementations are free to ignore this, if they must)inMemory
- TODO figure out if this inMemory thing really makes sense.public AudioStream getAudioInput(int type, int bufferSize, float sampleRate, int bitDepth)
MinimServiceProvider
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.getAudioInput
in interface MinimServiceProvider
type
- Minim.STEREO or Minim.MONObufferSize
- how big the in-memory buffer should besampleRate
- what the sample rate of the stream should bebitDepth
- what the bit depth of the stream should bepublic AudioSample getAudioSample(java.lang.String filename, int bufferSize)
MinimServiceProvider
AudioSample
that will load the requested file into memory.getAudioSample
in interface MinimServiceProvider
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 bepublic AudioSample getAudioSample(float[] samples, javax.sound.sampled.AudioFormat format, int bufferSize)
MinimServiceProvider
AudioSample
that will store the provided samples.getAudioSample
in interface MinimServiceProvider
samples
- the array of audio samplesbufferSize
- how large the output buffer should bepublic AudioSample getAudioSample(float[] left, float[] right, javax.sound.sampled.AudioFormat format, int bufferSize)
MinimServiceProvider
AudioSample
that will store the provided samples.getAudioSample
in interface MinimServiceProvider
left
- the left channel of the stereo sampleright
- the right channel of a stereo samplebufferSize
- how large the output buffer should bepublic AudioOut getAudioOutput(int type, int bufferSize, float sampleRate, int bitDepth)
MinimServiceProvider
AudioOut
that can be used to generate audio that will
be heard through the computer's speakers.getAudioOutput
in interface MinimServiceProvider
type
- Minim.STEREO or Minim.MONObufferSize
- how big the in-memory buffer should besampleRate
- what the sample rate of the generated audio should bebitDepth
- what the bit depth of the generated audio should bepublic AudioRecording getAudioRecordingClip(java.lang.String filename)
public AudioRecording getAudioRecording(java.lang.String filename)
getAudioRecording
in interface MinimServiceProvider