Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## ddf.minim
Class SignalChain

    java.lang.Object
      ddf.minim.SignalChain

All Implemented Interfaces:
  AudioSignal

    public class SignalChain

extends java.lang.Object
implements AudioSignal

An `SignalChain` is a list of `AudioSignals` that gives you the ability to enable (unmute) and disable (mute) signals. When you add a signal, it is added to the end of the chain and is enabled. When you remove a signal, signals further down the chain are moved up a slot. `SignalChain` is itself an `AudioSignal`, so you can easily create groups of signals that can be enabled/disabled together by putting them in an `SignalChain` and then adding that chain to a `Polyphonic` object as a single signal. When the signal chain is asked to generate a signal, it asks each of its signals to generate audio and then mixes all of the signals together. `SignalChain` is fully `synchronized` so that signals cannot be added and removed from the chain during signal generation.

Author:
  Damien Di Fede

Constructor Summary
`SignalChain()` Constructs an empty `SignalChain`.

Method Summary
`void` | `add(AudioSignal signal)` Adds `signal` to the end of the chain.
`void` | `clear()` Removes all signals from the effect chain.
`boolean` | `contains(AudioSignal s)` Returns true if `s` is in the chain.
`void` | `disable(AudioSignal signal)` Disables `signal` if it is in the chain.
`void` | `disable(int i)` Disables the `i`th effect in the chain.
`void` | `disableAll()` Disables all signals in the chain.
`void` | `enable(AudioSignal signal)` Enables `signal` if it is in the chain.
`void` | `enable(int i)` Enables the `i`th effect in the chain.
`void` | `enableAll()` Enables all signals in the chain.
`void` | `generate(float[] signal)` Asks all the enabled signals in the chain to generate a new buffer of samples, adds the buffers together and puts the result in `signal`.
`void` | `generate(float[] left, float[] right)` Asks all the enabled signals in the chain to generate a left and right buffer of samples, adds the signals together and puts the result in `left` and `right`.
`AudioSignal` | `get(int i)` Gets the `ith` signal in the chain.
`boolean` | `hasEnabled()` Returns true if at least one effect in the chain is enabled.
`boolean` | `isEnabled(AudioSignal signal)` Returns true if `e` is in the chain and is enabled.
`void` | `remove(AudioSignal signal)` Removes `signal` from the chain.
`AudioSignal` | `remove(int i)` Removes and returns the `i`th signal from the chain.
`int` | `size()` Returns the number of signals in the chain.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SignalChain

    public SignalChain()

  Constructs an empty `SignalChain`.

Method Detail

### add

    public void add(AudioSignal signal)

  Adds `signal` to the end of the chain.

  Parameters:
    `signal` - the `AudioEffect` to add

### remove

    public void remove(AudioSignal signal)

  Removes `signal` from the chain.

  Parameters:
    `signal` - the `AudioSignal` to remove

### remove

    public AudioSignal remove(int i)

  Removes and returns the `i`th signal from the chain.

  Parameters:
    `i` - the index of the `AudioSignal` to remove
  Returns:
    the `AudioSignal` that was removed

### get

    public AudioSignal get(int i)

  Gets the `ith` signal in the chain.

  Parameters:
    `i` - the index of the `AudioSignal` to get

### contains

    public boolean contains(AudioSignal s)

  Returns true if `s` is in the chain.

  Parameters:
    `s` - the `AudioSignal` to check for
  Returns:
    true if `s` is in the chain

### enable

    public void enable(int i)

  Enables the `i`th effect in the chain.

  Parameters:
    `i` - the index of the effect to enable

### enable

    public void enable(AudioSignal signal)

  Enables `signal` if it is in the chain.

  Parameters:
    `signal` - the `AudioSignal` to enable

### enableAll

    public void enableAll()

  Enables all signals in the chain.

### hasEnabled

    public boolean hasEnabled()

  Returns true if at least one effect in the chain is enabled.

  Returns:
    true if at least one effect in the chain is enabled

### isEnabled

    public boolean isEnabled(AudioSignal signal)

  Returns true if `e` is in the chain and is enabled.

  Parameters:
    `signal` - the `AudioSignal` to return the status of
  Returns:
    true if `signal` is enabled and in the chain

### disable

    public void disable(int i)

  Disables the `i`th effect in the chain.

  Parameters:
    `i` - the index of the effect to disable

### disable

    public void disable(AudioSignal signal)

  Disables `signal` if it is in the chain.

  Parameters:
    `signal` - the `AudioSignal` to disable

### disableAll

    public void disableAll()

  Disables all signals in the chain.

### size

    public int size()

  Returns the number of signals in the chain.

  Returns:
    the number of signals in the chain

### clear

    public void clear()

  Removes all signals from the effect chain.

### generate

    public void generate(float[] signal)

  Asks all the enabled signals in the chain to generate a new buffer of samples, adds the buffers together and puts the result in `signal`.

  Specified by:
    `generate` in interface `AudioSignal`
  Parameters:
    `signal` - the float array to fill

### generate

    public void generate(float[] left,
                         float[] right)

  Asks all the enabled signals in the chain to generate a left and right buffer of samples, adds the signals together and puts the result in `left` and `right`.

  Specified by:
    `generate` in interface `AudioSignal`
  Parameters:
    `left` - the left channel
    `right` - the right channel

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD