ddf.minim
Class AudioOutput

java.lang.Object
  extended by ddf.minim.Controller
      extended by ddf.minim.AudioSource
          extended by ddf.minim.AudioOutput
All Implemented Interfaces:
Effectable, Polyphonic, Recordable

public class AudioOutput
extends AudioSource
implements Polyphonic

An AudioOutput is used to generate audio with AudioSignals. Well, strictly speaking, the AudioSynthesizer it is constructed with generates the signals and AudioOutput merely delegates to the synth when signals are added. You can get an AudioOutput from Minim by calling one of the getLineOut methods.

Author:
Damien Di Fede

Field Summary
 Summer bus
           
 NoteManager noteManager
           
 
Fields inherited from class ddf.minim.AudioSource
left, mix, right
 
Fields inherited from class ddf.minim.Controller
BALANCE, GAIN, MUTE, PAN, SAMPLE_RATE, VOLUME
 
Constructor Summary
AudioOutput(AudioOut synthesizer)
          Constructs an AudioOutput that will subscribe its buffers to synthesizer and be able to control the DataLine the synthesizer uses for output.
 
Method Summary
 void addSignal(AudioSignal signal)
          Adds an signal to the signals chain.
 void clearSignals()
          Removes all signals from the signal chain.
 void disableSignal(AudioSignal signal)
          Disables signal if it is in the chain.
 void disableSignal(int i)
          disables the ith signal in the signal chain.
 void enableSignal(AudioSignal signal)
          Enables signal if it is in the chain.
 void enableSignal(int i)
          Enables the ith signal in the signal chain.
 AudioSignal getSignal(int i)
          Returns the ith signal in the signal chain.
 boolean hasSignal(AudioSignal signal)
           
 boolean isEnabled(AudioSignal signal)
          Returns true if signal is in the chain and is also enabled.
 boolean isSounding()
          Returns true if at least one signal in the chain is enabled.
 void noSound()
          Disables all signals currently attached to this.
 void pauseNotes()
           
 void playNote()
           
 void playNote(float hz)
           
 void playNote(float startTime, float hz)
           
 void playNote(float startTime, float duration, float hz)
           
 void playNote(float startTime, float duration, Instrument instrument)
          Play a note startTime seconds from now, for the given duration, using the given instrument.
 void playNote(float startTime, float duration, java.lang.String pitchName)
           
 void playNote(float startTime, java.lang.String pitchName)
           
 void playNote(java.lang.String pitchName)
           
 void removeSignal(AudioSignal signal)
          Removes signal from the signals chain.
 AudioSignal removeSignal(int i)
          Removes and returns the ith signal in the signal chain.
 void resumeNotes()
           
 void setDurationFactor(float durationFactor)
           
 void setNoteOffset(float noteOffset)
           
 void setTempo(float tempo)
           
 int signalCount()
          Returns the number of signals in the chain.
 void sound()
          Enables all signals currently attached to this.
 
Methods inherited from class ddf.minim.AudioSource
addEffect, addListener, bufferSize, clearEffects, close, disableEffect, disableEffect, effectCount, effects, enableEffect, enableEffect, getEffect, getFormat, hasEffect, isEffected, isEnabled, noEffects, removeEffect, removeEffect, removeListener, sampleRate, type
 
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

noteManager

public final NoteManager noteManager

bus

public final Summer bus
Constructor Detail

AudioOutput

public AudioOutput(AudioOut synthesizer)
Constructs an AudioOutput that will subscribe its buffers to synthesizer and be able to control the DataLine the synthesizer uses for output. If the synth does not have an associated DataLine, then calls to Controller's methods will result in a NullPointerException.

Parameters:
synthesizer - the AudioSynthesizer to subscribe to
Method Detail

addSignal

public void addSignal(AudioSignal signal)
Description copied from interface: Polyphonic
Adds an signal to the signals chain.

Specified by:
addSignal in interface Polyphonic
Parameters:
signal - the AudioSignal to add

getSignal

public AudioSignal getSignal(int i)
Description copied from interface: Polyphonic
Returns the ith signal in the signal chain. This method is not required to do bounds checking and may throw an ArrayOutOfBoundsException if i is larger than Polyphonic.signalCount().

Specified by:
getSignal in interface Polyphonic
Parameters:
i - which signal to return
Returns:
the requested signal

removeSignal

public void removeSignal(AudioSignal signal)
Description copied from interface: Polyphonic
Removes signal from the signals chain.

Specified by:
removeSignal in interface Polyphonic
Parameters:
signal - the AudioSignal to remove

removeSignal

public AudioSignal removeSignal(int i)
Description copied from interface: Polyphonic
Removes and returns the ith signal in the signal chain.

Specified by:
removeSignal in interface Polyphonic
Parameters:
i - which signal to remove
Returns:
the removed AudioSignal

clearSignals

public void clearSignals()
Description copied from interface: Polyphonic
Removes all signals from the signal chain.

Specified by:
clearSignals in interface Polyphonic

disableSignal

public void disableSignal(int i)
Description copied from interface: Polyphonic
disables the ith signal in the signal chain.

Specified by:
disableSignal in interface Polyphonic
Parameters:
i - the index of the signal to disable

disableSignal

public void disableSignal(AudioSignal signal)
Description copied from interface: Polyphonic
Disables signal if it is in the chain.

Specified by:
disableSignal in interface Polyphonic
Parameters:
signal - the AudioSignal to disable

enableSignal

public void enableSignal(int i)
Description copied from interface: Polyphonic
Enables the ith signal in the signal chain.

Specified by:
enableSignal in interface Polyphonic
Parameters:
i - the index of the signal to enable

enableSignal

public void enableSignal(AudioSignal signal)
Description copied from interface: Polyphonic
Enables signal if it is in the chain.

Specified by:
enableSignal in interface Polyphonic
Parameters:
signal - the AudioSignal to enable

isEnabled

public boolean isEnabled(AudioSignal signal)
Description copied from interface: Polyphonic
Returns true if signal is in the chain and is also enabled.

Specified by:
isEnabled in interface Polyphonic
Parameters:
signal - the AudioSignal to check the status of
Returns:
true if signal is in the chain and is enabled

isSounding

public boolean isSounding()
Description copied from interface: Polyphonic
Returns true if at least one signal in the chain is enabled.

Specified by:
isSounding in interface Polyphonic
Returns:
true if at least one signal in the signal chain is enabled

noSound

public void noSound()
Description copied from interface: Polyphonic
Disables all signals currently attached to this. If you want to disable only a single signal, use Polyphonic.disableSignal(int).

Specified by:
noSound in interface Polyphonic

signalCount

public int signalCount()
Description copied from interface: Polyphonic
Returns the number of signals in the chain.

Specified by:
signalCount in interface Polyphonic
Returns:
the number of signals in the chain

sound

public void sound()
Description copied from interface: Polyphonic
Enables all signals currently attached to this. If you want to enable only a single signal, use Polyphonic.enableSignal(int).

Specified by:
sound in interface Polyphonic

hasSignal

public boolean hasSignal(AudioSignal signal)
Specified by:
hasSignal in interface Polyphonic

playNote

public void playNote(float startTime,
                     float duration,
                     Instrument instrument)
Play a note startTime seconds from now, for the given duration, using the given instrument.

Parameters:
startTime -
duration -
instrument -

playNote

public void playNote(float startTime,
                     float duration,
                     float hz)

playNote

public void playNote(float startTime,
                     float duration,
                     java.lang.String pitchName)

playNote

public void playNote(float startTime,
                     float hz)

playNote

public void playNote(float startTime,
                     java.lang.String pitchName)

playNote

public void playNote(float hz)

playNote

public void playNote(java.lang.String pitchName)

playNote

public void playNote()

setTempo

public void setTempo(float tempo)

setNoteOffset

public void setNoteOffset(float noteOffset)

setDurationFactor

public void setDurationFactor(float durationFactor)

pauseNotes

public void pauseNotes()

resumeNotes

public void resumeNotes()