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 buffer containing the left channel samples.
|
AudioBuffer |
mix
The buffer containing the mix of the left and right channels.
|
AudioBuffer |
right
The buffer containing the right channel samples.
|
BALANCE, GAIN, MUTE, PAN, SAMPLE_RATE, VOLUME| Constructor and Description |
|---|
AudioSource(AudioOut istream)
Constructs an
AudioSource that will subscribe to the samples
in stream. |
| Modifier and Type | Method and Description |
|---|---|
void |
addEffect(AudioEffect effect)
Adds an effect to the effects chain.
|
void |
addListener(AudioListener listener)
Adds a listener who will be notified each time this receives
or creates a new buffer of samples.
|
int |
bufferSize()
Returns the buffer size being used by this.
|
void |
clearEffects()
Removes all effects from the effect chain.
|
void |
close()
Closes the
AudioStream this was constructed with. |
void |
disableEffect(AudioEffect effect)
Disables
effect if it is in the chain. |
void |
disableEffect(int i)
disables the
ith effect in the effect chain. |
int |
effectCount()
Returns the number of effects in the chain.
|
void |
effects()
Enables all effects currently attached to this.
|
void |
enableEffect(AudioEffect effect)
Enables
effect if it is in the chain. |
void |
enableEffect(int i)
Enables the
ith effect in the effect chain. |
AudioEffect |
getEffect(int i)
Returns the
ith effect in the effect chain. |
javax.sound.sampled.AudioFormat |
getFormat()
Returns the format of this recordable audio.
|
boolean |
hasEffect(AudioEffect e)
Returns true if
effect is in the chain. |
boolean |
isEffected()
Returns true if at least one effect in the chain is enabled.
|
boolean |
isEnabled(AudioEffect effect)
Returns true if
effect is in the chain and is also enabled. |
void |
noEffects()
Disables all effects currently attached to this.
|
void |
removeEffect(AudioEffect effect)
Removes
effect from the effects chain. |
AudioEffect |
removeEffect(int i)
Removes and returns the
ith effect in the
effect chain. |
void |
removeListener(AudioListener listener)
Removes the listener from the list of listeners.
|
float |
sampleRate()
Returns the sample rate of this recordable audio.
|
int |
type()
Returns either Minim.MONO or Minim.STEREO
|
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
AudioSource, it contains the single channel of audio.public final AudioBuffer right
AudioSource, right contains the same samples
as left.public final AudioBuffer mix
AudioSource, mix contains the same
samples as left.public AudioSource(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()
AudioStream this was constructed with.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)
RecordableaddListener in interface Recordablelistener - the listener to addpublic int bufferSize()
RecordablebufferSize in interface Recordablepublic javax.sound.sampled.AudioFormat getFormat()
RecordablegetFormat in interface Recordablepublic void removeListener(AudioListener listener)
RecordableremoveListener in interface Recordablelistener - the listener to removepublic int type()
Recordabletype in interface Recordablepublic float sampleRate()
RecordablesampleRate in interface Recordable