public class AudioSource extends Controller implements Effectable, Recordable
AudioSource is a kind of wrapper around an
AudioStream. An AudioSource will add its
AudioBuffers as listeners on the stream so that you can access
the stream's samples without having to implement AudioListener
yourself. It also provides the Effectable and
Recordable interface. Because an AudioStream must
be closed when you are finished with it, you must remember to call
close() on any AudioSources you obtain from Minim, such
as AudioInputs, AudioOutputs, and
AudioPlayers.| Modifier and Type | Field and Description |
|---|---|
AudioBuffer |
left
The AudioBuffer containing the left channel samples.
|
AudioBuffer |
mix
The AudioBuffer containing the mix of the left and right channels.
|
AudioBuffer |
right
The AudioBuffer containing the right channel samples.
|
BALANCE, GAIN, MUTE, PAN, SAMPLE_RATE, VOLUME| Constructor and Description |
|---|
AudioSource(ddf.minim.spi.AudioOut istream)
Constructs an
AudioSource that will subscribe to the samples
in stream. |
| Modifier and Type | Method and Description |
|---|---|
void |
addEffect(AudioEffect effect)
Deprecated.
|
void |
addListener(AudioListener listener)
Add an AudioListener to this sound generating object,
which will have its samples method called every time
this object generates a new buffer of samples.
|
int |
bufferSize()
The internal buffer size of this sound object.
|
void |
clearEffects()
Deprecated.
|
void |
close()
Closes this source, making it unavailable.
|
void |
disableEffect(AudioEffect effect)
Deprecated.
|
void |
disableEffect(int i)
Deprecated.
|
int |
effectCount()
Deprecated.
|
void |
effects()
Deprecated.
|
void |
enableEffect(AudioEffect effect)
Deprecated.
|
void |
enableEffect(int i)
Deprecated.
|
AudioEffect |
getEffect(int i)
Deprecated.
|
javax.sound.sampled.AudioFormat |
getFormat()
Returns an AudioFormat object that describes the audio properties
of this sound generating object.
|
boolean |
hasEffect(AudioEffect e)
Deprecated.
|
boolean |
isEffected()
Deprecated.
|
boolean |
isEnabled(AudioEffect effect)
Deprecated.
|
void |
noEffects()
Deprecated.
|
void |
removeEffect(AudioEffect effect)
Deprecated.
|
AudioEffect |
removeEffect(int i)
Deprecated.
|
void |
removeListener(AudioListener listener)
Removes an AudioListener that was previously
added to this sound object.
|
float |
sampleRate()
Returns the sample rate of this sound object.
|
int |
type()
The type is an int describing the number of channels
this sound object has.
|
balance, gain, getBalance, getControl, getControls, getGain, getPan, getVolume, hasControl, isMuted, mute, pan, printControls, setBalance, setGain, setPan, setVolume, shiftBalance, shiftGain, shiftPan, shiftVolume, unmute, volumepublic final AudioBuffer left
public final AudioBuffer right
right contains the same samples as
left.public final AudioBuffer mix
mix contains the same
samples as left.public AudioSource(ddf.minim.spi.AudioOut istream)
AudioSource that will subscribe to the samples
in stream. It is expected that the stream is using a
DataLine for playback. If it is not, calls to
Controller's methods will result in a
NullPointerException.istream - the AudioStream to subscribe to and wrappublic void close()
public void addEffect(AudioEffect effect)
EffectableaddEffect in interface Effectableeffect - the AudioEffect to addpublic void clearEffects()
EffectableclearEffects in interface Effectablepublic void disableEffect(int i)
Effectableith effect in the effect chain.disableEffect in interface Effectablei - the index of the effect to disablepublic void disableEffect(AudioEffect effect)
Effectableeffect if it is in the chain.disableEffect in interface Effectableeffect - the AudioEffect to disablepublic int effectCount()
EffectableeffectCount in interface Effectablepublic void effects()
EffectableEffectable.enableEffect(int).effects in interface Effectablepublic boolean hasEffect(AudioEffect e)
Effectableeffect is in the chain.hasEffect in interface Effectablee - the effec to check foreffect is attached to thispublic void enableEffect(int i)
Effectableith effect in the effect chain.enableEffect in interface Effectablei - the index of the effect to enablepublic void enableEffect(AudioEffect effect)
Effectableeffect if it is in the chain.enableEffect in interface Effectableeffect - the AudioEffect to enablepublic AudioEffect getEffect(int i)
Effectableith effect in the effect chain.
This method is not required to do bounds checking and may throw an
ArrayOutOfBoundsException if i is larger than
Effectable.effectCount().getEffect in interface Effectablei - which effect to returnpublic boolean isEffected()
EffectableisEffected in interface Effectablepublic boolean isEnabled(AudioEffect effect)
Effectableeffect is in the chain and is also enabled.isEnabled in interface Effectableeffect - the AudioEffect to check the status ofeffect is in the chain and is enabledpublic void noEffects()
EffectableEffectable.disableEffect(int).noEffects in interface Effectablepublic void removeEffect(AudioEffect effect)
Effectableeffect from the effects chain.removeEffect in interface Effectableeffect - the AudioEffect to removepublic AudioEffect removeEffect(int i)
Effectableith effect in the
effect chain.removeEffect in interface Effectablei - which effect to removeAudioEffectpublic void addListener(AudioListener listener)
addListener in interface Recordablelistener - the AudioListener that will listen to thispublic int bufferSize()
bufferSize in interface Recordablepublic javax.sound.sampled.AudioFormat getFormat()
getFormat in interface Recordablepublic void removeListener(AudioListener listener)
removeListener in interface Recordablelistener - the AudioListener that should stop listening to thispublic int type()
type in interface Recordablepublic float sampleRate()
sampleRate in interface Recordable