mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 923517 - AudioDestinationNode should work as an EventTarget, r=ehsan
This commit is contained in:
parent
5eac7c6a72
commit
8c22a53a8f
@ -71,19 +71,20 @@ AudioContext::AudioContext(nsPIDOMWindow* aWindow,
|
||||
uint32_t aLength,
|
||||
float aSampleRate)
|
||||
: mSampleRate(aIsOffline ? aSampleRate : IdealAudioRate())
|
||||
, mDestination(new AudioDestinationNode(MOZ_THIS_IN_INITIALIZER_LIST(),
|
||||
aIsOffline, aNumberOfChannels,
|
||||
aLength, aSampleRate))
|
||||
, mNumberOfChannels(aNumberOfChannels)
|
||||
, mIsOffline(aIsOffline)
|
||||
, mIsStarted(!aIsOffline)
|
||||
, mIsShutDown(false)
|
||||
{
|
||||
// Actually play audio
|
||||
mDestination->Stream()->AddAudioOutput(&gWebAudioOutputKey);
|
||||
nsDOMEventTargetHelper::BindToOwner(aWindow);
|
||||
aWindow->AddAudioContext(this);
|
||||
SetIsDOMBinding();
|
||||
|
||||
// Note: AudioDestinationNode needs an AudioContext that must already be
|
||||
// bound to the window.
|
||||
mDestination = new AudioDestinationNode(this, aIsOffline, aNumberOfChannels,
|
||||
aLength, aSampleRate);
|
||||
mDestination->Stream()->AddAudioOutput(&gWebAudioOutputKey);
|
||||
}
|
||||
|
||||
AudioContext::~AudioContext()
|
||||
|
@ -109,3 +109,4 @@ support-files =
|
||||
[test_waveShaper.html]
|
||||
[test_waveShaperNoCurve.html]
|
||||
[test_waveShaperZeroLengthCurve.html]
|
||||
[test_audioDestinationNode.html]
|
||||
|
26
content/media/webaudio/test/test_audioDestinationNode.html
Normal file
26
content/media/webaudio/test/test_audioDestinationNode.html
Normal file
@ -0,0 +1,26 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test AudioDestinationNode as EventTarget</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="webaudio.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
var ac = new AudioContext()
|
||||
ac.destination.addEventListener("foo", function() {
|
||||
ok(true, "Event received!");
|
||||
SimpleTest.finish();
|
||||
}, false);
|
||||
ac.destination.dispatchEvent(new CustomEvent("foo"));
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user