AudioContext gain Node does not mute audio source (Web Audio API)

百般思念 提交于 2019-12-06 05:30:11

The problem is you're still connecting the buffersource directly to the destination as well as connecting it through the gain node - so you've effectively got two patch cables from source buffer to destination (one through the gain node). You should delete the following line:

this.sourceBuffer.connect(this.audioContext.destination);

as well as this line (because you want it to start out not muted):

this.gainNode.gain.value = 0;

and I think you'll get the behavior you expect.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!