当我使用网络音频振荡器(带有noteOn
)成功创建音调,然后调用其noteOff
函数时,后续调用noteOn
不会再次播放音调。我似乎必须创建一个新的振荡器来播放一个新的音符。为什么是这样?
var ctx = new webkitAudioContext();
var osc = ctx.createOscillator();
osc.connect(ctx.destination);
osc.start(0); // tone is heard (previously noteOn(0))
// ... some time later
osc.stop(0); // tone falls silent (previously noteOff(0))
// ... some time later
osc.start(0); // no effect! (previously noteOn(0))