ddf.minim.ugens
Class Balance

java.lang.Object
  extended by ddf.minim.ugens.UGen
      extended by ddf.minim.ugens.Balance

public class Balance
extends UGen

Balance is for controlling the left/right channel balance of a stereo signal. This is different from Pan because rather than moving the signal around it simply attenuates the existing audio.

A balance of 0 will make no change to the incoming audio. Negative balance will decrease the volume of the right channel and positive balance will decrease the volume of the left channel. This is meant to mirror how a balance knob on a typical stereo operates.

Author:
Anderson Mills

Nested Class Summary
 
Nested classes/interfaces inherited from class ddf.minim.ugens.UGen
UGen.InputType, UGen.UGenInput
 
Field Summary
 UGen.UGenInput audio
          The audio input is where audio comes in to be balanced.
 UGen.UGenInput balance
          The balance control should be driven by UGens that generate values in the range [-1, 1].
 
Constructor Summary
Balance()
          Construct a Balance with a value of 0 (no change).
Balance(float balanceVal)
          Construct a balance with a particular value.
 
Method Summary
 void setBalance(float balanceVal)
          Set the balance value directly.
protected  void uGenerate(float[] channels)
          Implement this method when you extend UGen.
 
Methods inherited from class ddf.minim.ugens.UGen
addInput, getLastValues, patch, patch, patch, printInputs, removeInput, sampleRate, sampleRateChanged, setSampleRate, tick, unpatch, unpatch
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

audio

public UGen.UGenInput audio
The audio input is where audio comes in to be balanced. You won't need to patch to this directly, patching to the balance UGen itself will achieve the same thing.


balance

public UGen.UGenInput balance
The balance control should be driven by UGens that generate values in the range [-1, 1].

Constructor Detail

Balance

public Balance()
Construct a Balance with a value of 0 (no change).


Balance

public Balance(float balanceVal)
Construct a balance with a particular value.

Parameters:
balanceVal - a value in the range [-1, 1]
Method Detail

setBalance

public void setBalance(float balanceVal)
Set the balance value directly.

Parameters:
balanceVal - a value in the range [-1, 1]

uGenerate

protected void uGenerate(float[] channels)
Description copied from class: UGen
Implement this method when you extend UGen. It will be called when your UGen needs to generate one sample frame of audio. It is expected that you will assign values to the array and not simply modify the existing values. In the case where you write a UGen that takes audio input and modifies it, the pattern to follow is to have the first UGenInput you create be your audio input and then in uGenerate you will use the getLastValues method of your audio UGenInput to retrieve the audio you want to modify, which you will then modify however you need to, assigning the result to the values in channels.

Specified by:
uGenerate in class UGen
Parameters:
channels - an array representing one sample frame.