net.beadsproject.beads.core
Class AudioIO

java.lang.Object
  extended by net.beadsproject.beads.core.AudioIO
Direct Known Subclasses:
NonrealtimeIO

public abstract class AudioIO
extends java.lang.Object

AudioIO is the abstract base class for setting up interaction between AudioContext and the world. It is designed to be largely controlled by AudioContext. To be precise, AudioContext will prepare(), start(), and stop() the AudioIO it is initialised with. However, certain AudioIO implementations may need to be set up before being passed to AudioContext(). By default, AudioContext creates a JavaSoundAudioIO.

Author:
ollie

Field Summary
protected  AudioContext context
          The context.
 
Constructor Summary
AudioIO()
           
 
Method Summary
protected abstract  UGen getAudioInput(int[] channels)
          Gets an audio input UGen.
 AudioContext getContext()
          Gets the AudioContext.
protected  boolean prepare()
          Prepares the AudioIO.
protected abstract  boolean start()
          Starts the AudioIO.
protected  boolean stop()
          Stops the AudioIO.
protected  void update()
          Updates the AudioContext.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

context

protected AudioContext context
The context.

Constructor Detail

AudioIO

public AudioIO()
Method Detail

prepare

protected boolean prepare()
Prepares the AudioIO. This method is called by AudioContext's constructor. This has default implementation as it will not be needed by most implementation.

Returns:
true, if successful.

start

protected abstract boolean start()
Starts the AudioIO. When started, the AudioIO should repeatedly call update() and then gather the output of AudioContext.out.

Returns:
true, if successful

stop

protected boolean stop()
Stops the AudioIO. Note this is not usually needed because the more usual way for the system to stop is simply to check AudioContext.isRunning() at each time step.

Returns:
true, if successful.

getAudioInput

protected abstract UGen getAudioInput(int[] channels)
Gets an audio input UGen. The argument specifies an array of channel numbers that this UGen should serve. For example, the array {0, 4, 2} should return a UGen with 3 outputs, corresponding to input channels 1, 5 and 3 respectively on the audio device.

Parameters:
channels - an array indicating which channels to serve.
Returns:
the audio input.

update

protected void update()
Updates the AudioContext.


getContext

public AudioContext getContext()
Gets the AudioContext.

Returns:
the context.