我正在尝试使用 Web Audio API 创建自定义平移控件,但是使用通道拆分器和合并节点无法从正确的通道中发出任何声音:
var context = new webkitAudioContext(),
destination = context.destination,
osc = context.createOscillator(),
gainL = context.createGainNode(),
gainR = context.createGainNode(),
splitter = context.createChannelSplitter(2),
merger = context.createChannelMerger(2);
osc.frequency.value = 500;
osc.connect(splitter);
splitter.connect(gainL, 0);
splitter.connect(gainR, 1);
gainL.connect(merger, 0, 0);
gainR.connect(merger, 0, 1);
osc.noteOn(0);
gainL.gain.value = 0.1;
gainR.gain.value = 0.5;
osc.noteOff(2);
merger.connect(destination);
我在这里遗漏了一些明显的东西吗?这里有上面代码的 JSBin 预览:http: //jsbin.com/ayijoy/1/
我正在运行 Chrome v24.0.1312.57,以防万一。