void connectGenerator (Synthesizer synth)
    throws SynthIfException
  {
    Generator freq = ((Input)inputs.elementAt (0)).getGenerator();
    Generator phase = ((Input)inputs.elementAt (1)).getGenerator();
    if (phase == null)
      synth.add (phase = new Constant (synth, 0));
    Generator amp = ((Input)inputs.elementAt (2)).getGenerator();
    if (type == SIN)
      ((SinGenerator)generator).setParameters (freq, phase, amp);
    if (type == TRIANGLE)
      ((TriangleGenerator)generator).setParameters (freq, phase, amp);
    if (type == SQUARE)
      ((SquareGenerator)generator).setParameters (freq, phase, amp);
    if (type == SAWTOOTH)
      ((SawtoothGenerator)generator).setParameters (freq, phase, amp);
    if (type == WAVE) {
      if (wave == null)
        throw new SynthIfException ("Empty wave in oscillator");
      ((WaveGenerator)generator).setParameters (wave.getWave(), freq, phase, amp, interpolate);
    }
  }