當我用Web音頻振盪器(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))
此答案由FAQ這裏證實: http://updates.html5rocks.com/2012/01/Web-Audio-FAQ – aaaidan