javascript - Do I need to disconnect an Oscillator AudioNode after stop it? - Stack Overflow

I had seen in several tutorials people using .disconnect() after an .stop() in Oscillators Nodes.As far

I had seen in several tutorials people using .disconnect() after an .stop() in Oscillators Nodes.

As far as I understand, an Oscillator Node is disposable so when it stop and get thrown away, doesn't it get disconnected too?

Am I understanding something wrong? Why do I need to use .disconnect() after an .stop() ?

I had seen in several tutorials people using .disconnect() after an .stop() in Oscillators Nodes.

As far as I understand, an Oscillator Node is disposable so when it stop and get thrown away, doesn't it get disconnected too?

Am I understanding something wrong? Why do I need to use .disconnect() after an .stop() ?

Share Improve this question asked Apr 14, 2016 at 15:49 distantedistante 7,0256 gold badges61 silver badges103 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 6

According to the W3C Specification:

When an AudioNode has no references it will be deleted. Before it is deleted, it will disconnect itself from any other AudioNodes which it is connected to.

So when an AudioNode get stopped and no references are left it will disconnect itself and it is thus not needed to explicitly call disconnect() after stop().

You shouldn't need to disconnect the oscillator after stop(). In fact, after scheduling the start and stop times of the oscillator, you should be able to drop the reference to the oscillator immediately and the oscillator should still play. After stopping, it should automatically disconnect itself.

Of course there could be bugs in the implementation that makes disconnect to the right thing. But that's a bug.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744406193a4572644.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信