|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object ddf.minim.Controller ddf.minim.AudioSource
public class AudioSource
An AudioSource
is a kind of wrapper around an
AudioStream
. An AudioSource
will add its
AudioBuffer
s 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 AudioSource
s
you obtain from Minim, such as AudioInput
s,
AudioOutput
s, and AudioPlayer
s.
Field Summary | |
---|---|
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. |
Fields inherited from class ddf.minim.Controller |
---|
BALANCE, GAIN, MUTE, PAN, SAMPLE_RATE, VOLUME |
Constructor Summary | |
---|---|
AudioSource(AudioOut istream)
Constructs an AudioSource that will subscribe to the samples
in stream . |
Method Summary | |
---|---|
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 i th 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 i th 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 |
Methods inherited from class ddf.minim.Controller |
---|
balance, gain, getBalance, getControl, getControls, getGain, getPan, getVolume, hasControl, isMuted, mute, pan, printControls, setBalance, setGain, setPan, setVolume, shiftBalance, shiftGain, shiftPan, shiftVolume, unmute, volume |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public 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
.
Constructor Detail |
---|
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 wrapMethod Detail |
---|
public void close()
AudioStream
this was constructed with.
public void addEffect(AudioEffect effect)
Effectable
addEffect
in interface Effectable
effect
- the AudioEffect to addpublic void clearEffects()
Effectable
clearEffects
in interface Effectable
public void disableEffect(int i)
Effectable
i
th effect in the effect chain.
disableEffect
in interface Effectable
i
- the index of the effect to disablepublic void disableEffect(AudioEffect effect)
Effectable
effect
if it is in the chain.
disableEffect
in interface Effectable
effect
- the AudioEffect
to disablepublic int effectCount()
Effectable
effectCount
in interface Effectable
public void effects()
Effectable
Effectable.enableEffect(int)
.
effects
in interface Effectable
public boolean hasEffect(AudioEffect e)
Effectable
effect
is in the chain.
hasEffect
in interface Effectable
e
- the effec to check for
effect
is attached to thispublic void enableEffect(int i)
Effectable
i
th effect in the effect chain.
enableEffect
in interface Effectable
i
- the index of the effect to enablepublic void enableEffect(AudioEffect effect)
Effectable
effect
if it is in the chain.
enableEffect
in interface Effectable
effect
- the AudioEffect
to enablepublic AudioEffect getEffect(int i)
Effectable
ith
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 Effectable
i
- which effect to return
public boolean isEffected()
Effectable
isEffected
in interface Effectable
public boolean isEnabled(AudioEffect effect)
Effectable
effect
is in the chain and is also enabled.
isEnabled
in interface Effectable
effect
- the AudioEffect
to check the status of
effect
is in the chain and is enabledpublic void noEffects()
Effectable
Effectable.disableEffect(int)
.
noEffects
in interface Effectable
public void removeEffect(AudioEffect effect)
Effectable
effect
from the effects chain.
removeEffect
in interface Effectable
effect
- the AudioEffect to removepublic AudioEffect removeEffect(int i)
Effectable
ith
effect in the
effect chain.
removeEffect
in interface Effectable
i
- which effect to remove
AudioEffect
public void addListener(AudioListener listener)
Recordable
addListener
in interface Recordable
listener
- the listener to addpublic int bufferSize()
Recordable
bufferSize
in interface Recordable
public javax.sound.sampled.AudioFormat getFormat()
Recordable
getFormat
in interface Recordable
public void removeListener(AudioListener listener)
Recordable
removeListener
in interface Recordable
listener
- the listener to removepublic int type()
Recordable
type
in interface Recordable
public float sampleRate()
Recordable
sampleRate
in interface Recordable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |