const Crossfade = ({ input1, input2, output, crossfade }) => {
  for (let i = 0; i < input1.length; i ++) {
    output[i] = (input1[i] * (1 - crossfade[i])) + (input2[i] * crossfade[i])
  }
}

this.constructDevice = () => constructPerChannelDevice({
  implementation: Crossfade,
  inputs: {
    input1: stereo('In 1'),
    input2: stereo('In 2'),
    crossfade: numberSetting('Crossfade', { defaultValue: 0.5, min: 0, max: 1, curve: Curve.Linear }),
  },
  outputs: {
    output: stereo('Out'),
  }
});
