ddf.minim
Class AudioObject

java.lang.Object
  extended byddf.minim.Controller
      extended byddf.minim.AudioObject
All Implemented Interfaces:
Effectable, Recordable
Direct Known Subclasses:
AudioInput, AudioOutput, AudioPlayer, AudioSample

public class AudioObject
extends Controller
implements Effectable, Recordable


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
AudioObject(javax.sound.sampled.Line line, AudioStream 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 Recordable.
 void clearEffects()
          Removes all effects from the effect chain.
 void close()
           
 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 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.
 int type()
          Returns either Minim.MONO or Minim.STEREO
 
Methods inherited from class ddf.minim.Controller
balance, gain, getBalance, getControls, getGain, getPan, getVolume, hasControl, isMuted, mute, pan, printControls, sampleRate, 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

left

public final AudioBuffer left
The buffer containing the left channel samples. If this is a mono AudioOuput, it contains the single channel of audio.


right

public final AudioBuffer right
The buffer containing the right channel samples. If this is a mono AudioOutput, right contains the same samples as left.


mix

public final AudioBuffer mix
The buffer containing the mix of the left and right channels. If this is a mono AudioOutput, mix simply contains the same samples as left.

Constructor Detail

AudioObject

public AudioObject(javax.sound.sampled.Line line,
                   AudioStream stream)
Method Detail

close

public void close()

addEffect

public void addEffect(AudioEffect effect)
Description copied from interface: Effectable
Adds an effect to the effects chain.

Specified by:
addEffect in interface Effectable
Parameters:
effect - the AudioEffect to add

clearEffects

public void clearEffects()
Description copied from interface: Effectable
Removes all effects from the effect chain.

Specified by:
clearEffects in interface Effectable

disableEffect

public void disableEffect(int i)
Description copied from interface: Effectable
disables the ith effect in the effect chain.

Specified by:
disableEffect in interface Effectable
Parameters:
i - the index of the effect to disable

disableEffect

public void disableEffect(AudioEffect effect)
Description copied from interface: Effectable
Disables effect if it is in the chain.

Specified by:
disableEffect in interface Effectable
Parameters:
effect - the AudioEffect to disable

effectCount

public int effectCount()
Description copied from interface: Effectable
Returns the number of effects in the chain.

Specified by:
effectCount in interface Effectable
Returns:
the number of effects in the chain

effects

public void effects()
Description copied from interface: Effectable
Enables all effects currently attached to this. If you want to enable only a single effect, use Effectable.enableEffect(int).

Specified by:
effects in interface Effectable

enableEffect

public void enableEffect(int i)
Description copied from interface: Effectable
Enables the ith effect in the effect chain.

Specified by:
enableEffect in interface Effectable
Parameters:
i - the index of the effect to enable

enableEffect

public void enableEffect(AudioEffect effect)
Description copied from interface: Effectable
Enables effect if it is in the chain.

Specified by:
enableEffect in interface Effectable
Parameters:
effect - the AudioEffect to enable

getEffect

public AudioEffect getEffect(int i)
Description copied from interface: Effectable
Returns the 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().

Specified by:
getEffect in interface Effectable
Parameters:
i - which effect to return
Returns:
the requested effect

isEffected

public boolean isEffected()
Description copied from interface: Effectable
Returns true if at least one effect in the chain is enabled.

Specified by:
isEffected in interface Effectable
Returns:
true if at least one effect in the effects chain is enabled

isEnabled

public boolean isEnabled(AudioEffect effect)
Description copied from interface: Effectable
Returns true if effect is in the chain and is also enabled.

Specified by:
isEnabled in interface Effectable
Parameters:
effect - the AudioEffect to check the status of
Returns:
true if effect is in the chain and is enabled

noEffects

public void noEffects()
Description copied from interface: Effectable
Disables all effects currently attached to this. If you want to disable only a single effect, use Effectable.disableEffect(int).

Specified by:
noEffects in interface Effectable

removeEffect

public void removeEffect(AudioEffect effect)
Description copied from interface: Effectable
Removes effect from the effects chain.

Specified by:
removeEffect in interface Effectable
Parameters:
effect - the AudioEffect to remove

removeEffect

public AudioEffect removeEffect(int i)
Description copied from interface: Effectable
Removes and returns the ith effect in the effect chain.

Specified by:
removeEffect in interface Effectable
Parameters:
i - which effect to remove
Returns:
the removed AudioEffect

addListener

public void addListener(AudioListener listener)
Description copied from interface: Recordable
Adds a listener who will be notified each time this receives or creates a new buffer of samples.

Specified by:
addListener in interface Recordable
Parameters:
listener - the listener to add

bufferSize

public int bufferSize()
Description copied from interface: Recordable
Returns the buffer size being used by this Recordable.

Specified by:
bufferSize in interface Recordable
Returns:
the buffer size

getFormat

public javax.sound.sampled.AudioFormat getFormat()
Description copied from interface: Recordable
Returns the format of this recordable audio.

Specified by:
getFormat in interface Recordable
Returns:
the format of the audio

removeListener

public void removeListener(AudioListener listener)
Description copied from interface: Recordable
Removes the listener from the list of listeners.

Specified by:
removeListener in interface Recordable
Parameters:
listener - the listener to remove

type

public int type()
Description copied from interface: Recordable
Returns either Minim.MONO or Minim.STEREO

Specified by:
type in interface Recordable
Returns:
Minim.MONO if this is mono, Minim.STEREO if this is stereo