Add a way to mute an AudioContext.
authoradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Nov 2014 18:50:12 +0000 (18:50 +0000)
committeradachan@apple.com <adachan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 20 Nov 2014 18:50:12 +0000 (18:50 +0000)
commit4fad68a415b5ba4d8d895ceb76fa39cb01bec9e7
tree3cd3332b4306ac73df0e3c68e5e055210a335fb9
parentf6813e5226fe2e43dcc85c1e6ea8da0255cab3ef
Add a way to mute an AudioContext.
https://bugs.webkit.org/show_bug.cgi?id=138104

Reviewed by Eric Carlson.

Keep a muted state in AudioDestinationNode. If m_muted is true,
zero out the audio buffers.

No new tests, since it's difficult to test whether the audio is indeed muted.

* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::AudioContext):
Call pageMutedStateDidChange() so it'll initialize the destination audio node's muted state accordingly.
(WebCore::AudioContext::pageMutedStateDidChange):
Set the destination audio node's muted state to match the page's muted state.

* Modules/webaudio/AudioDestinationNode.cpp:
(WebCore::AudioDestinationNode::AudioDestinationNode):
Initialize m_muted.
(WebCore::AudioDestinationNode::render):
If m_muted is true, call AudioBus::zero() to zero out the buffers.
* Modules/webaudio/AudioDestinationNode.h:
(WebCore::AudioDestinationNode::setMuted):
Set m_muted.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@176403 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/Modules/webaudio/AudioDestinationNode.cpp
Source/WebCore/Modules/webaudio/AudioDestinationNode.h