简体   繁体   English

WebAudio activeSourceCount

[英]WebAudio activeSourceCount

Here's my code: 这是我的代码:

var ac = new webkitAudioContext();

On pressing the play button: 按下播放按钮时:

var source = ac.createBufferSource();
source.buffer = audioTrackBuffer;
source.connect(ac.destination);
source.noteOn(0);

On pressing the stop button: 按下停止按钮时:

source.noteOff(0);
source.disconnect();

Each time I press the play button ac.activeSourceCount increments. 每次按下播放按钮ac.activeSourceCount都会递增。

Why doesn't activeSourceCount decrement when I noteOff() and disconnect() the source? 为什么不activeSourceCount当我递减noteOff()disconnect()来源是什么?

Looks like it was removed from the spec: https://dvcs.w3.org/hg/audio/rev/cfe4ae147c64 看起来它已从规范中删除: https : //dvcs.w3.org/hg/audio/rev/cfe4ae147c64

Relevant discussion here: http://lists.w3.org/Archives/Public/public-audio/2013AprJun/0308.html 此处的相关讨论: http : //lists.w3.org/Archives/Public/public-audio/2013AprJun/0308.html

Basically, since they added the "ended" event, I think the idea is that you can keep track of this yourself now. 基本上,由于他们添加了“结束”事件,因此我认为您可以自己对此进行跟踪。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM