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

## micromod
Class Mixer

    java.lang.Object
      micromod.Mixer

public class Mixer
extends java.lang.Object

Mixer mixes the output of the individual channels together.

Field Summary
`protected int` | `gain`
`protected int[]` | `leftMixBuffer`
`protected int[]` | `rightMixBuffer`
`protected Synthesizer` | `synthesizer`
`protected WaveScaler` | `waveScaler`
`protected WaveShaper` | `waveShaper`

Constructor Summary
`Mixer(Synthesizer synth, WaveShaper shaper, WaveScaler scaler)` Constructor.

Method Summary
`int` | `getGain()`
`void` | `output(short[] leftBuffer, short[] rightBuffer, int length, Resampler resampler, boolean snapBack)` Mix the specified number of samples from each of the channels into the specified buffers.
`void` | `setGain(int value)` Set the current gain value.
`void` | `setWaveScaler(WaveScaler scaler)`
`void` | `setWaveShaper(WaveShaper shaper)`

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

Field Detail

### waveShaper

    protected WaveShaper waveShaper

### waveScaler

    protected WaveScaler waveScaler

### synthesizer

    protected Synthesizer synthesizer

### leftMixBuffer

    protected int[] leftMixBuffer

### rightMixBuffer

    protected int[] rightMixBuffer

### gain

    protected int gain

Constructor Detail

### Mixer

    public Mixer(Synthesizer synth,
                 WaveShaper shaper,
                 WaveScaler scaler)

  Constructor.

Parameters:
  `synth` - The Synthesizer object that maintains the Channels.
  `shaper` - This may be null. It is the compressor/limiter/clipping algorithm to use.
  `scaler` - This may be null. It is the decimation algorithm to use. Eg dithering.

Method Detail

### setWaveShaper

    public void setWaveShaper(WaveShaper shaper)

### setWaveScaler

    public void setWaveScaler(WaveScaler scaler)

### getGain

    public int getGain()

  Returns:
    the current gain value. 4096 represents a gain of 1.0

### setGain

    public void setGain(int value)

  Set the current gain value. A parameter of 4096(1.0) guarantees the output never goes above the maximum. The maximum gain is 8.0

### output

    public void output(short[] leftBuffer,
                       short[] rightBuffer,
                       int length,
                       Resampler resampler,
                       boolean snapBack)

  Mix the specified number of samples from each of the channels into the specified buffers.

  Parameters:
    `leftBuffer` - The buffer containing the left channel's audio.
    `length` - The number of samples to mix. Should be > 0.
    `snapBack` - If true, the audio will be "rewound" after mixing, so a subsequent identical call to output() will yield the same output. Used for the volume ramping.

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