mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1083881 - add method connectParam to AudioNodeActors, r=vp
From 9677a120a84ff73e07a2dd734c8d3f3e2c9b5b9e Mon Sep 17 00:00:00 2001 --- browser/devtools/webaudioeditor/test/browser.ini | 1 + .../test/browser_audionode-actor-connectparam.js | 35 ++++++++++++++++++++++ toolkit/devtools/server/actors/webaudio.js | 30 +++++++++++++++++++ 3 files changed, 66 insertions(+) create mode 100644 browser/devtools/webaudioeditor/test/browser_audionode-actor-connectparam.js
This commit is contained in:
parent
23c103fc58
commit
225f65b270
@ -23,6 +23,7 @@ support-files =
|
||||
[browser_audionode-actor-is-source.js]
|
||||
[browser_audionode-actor-bypass.js]
|
||||
[browser_audionode-actor-connectnode-disconnect.js]
|
||||
[browser_audionode-actor-connectparam.js]
|
||||
[browser_webaudio-actor-simple.js]
|
||||
[browser_webaudio-actor-destroy-node.js]
|
||||
[browser_webaudio-actor-connect-param.js]
|
||||
|
@ -0,0 +1,35 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
/**
|
||||
* Tests that AudioNodeActor#connectParam() work.
|
||||
* Uses the editor front as the actors do not retain connect state.
|
||||
*/
|
||||
|
||||
function spawnTest() {
|
||||
let { target, panel } = yield initWebAudioEditor(SIMPLE_CONTEXT_URL);
|
||||
let { panelWin } = panel;
|
||||
let { gFront, $, $$, EVENTS, gAudioNodes } = panelWin;
|
||||
|
||||
reload(target);
|
||||
|
||||
let [actors] = yield Promise.all([
|
||||
get3(gFront, "create-node"),
|
||||
waitForGraphRendered(panelWin, 3, 2)
|
||||
]);
|
||||
|
||||
let [dest, osc, gain] = actors;
|
||||
|
||||
yield osc.disconnect();
|
||||
|
||||
osc.connectParam(gain, "gain");
|
||||
yield Promise.all([
|
||||
waitForGraphRendered(panelWin, 3, 1, 1),
|
||||
once(gAudioNodes, "connect")
|
||||
]);
|
||||
ok(true, "Oscillator connect to Gain's Gain AudioParam, event emitted.");
|
||||
|
||||
yield teardown(panel);
|
||||
finish();
|
||||
}
|
||||
|
@ -292,6 +292,36 @@ let AudioNodeActor = exports.AudioNodeActor = protocol.ActorClass({
|
||||
response: { params: RetVal("json") }
|
||||
}),
|
||||
|
||||
/**
|
||||
* Connects this audionode to an AudioParam via `node.connect(param)`.
|
||||
*/
|
||||
connectParam: method(function (destActor, paramName, output) {
|
||||
let srcNode = this.node.get();
|
||||
let destNode = destActor.node.get();
|
||||
|
||||
if (srcNode === null || destNode === null) {
|
||||
return CollectedAudioNodeError();
|
||||
}
|
||||
|
||||
try {
|
||||
// Connect via the unwrapped node, so we can call the
|
||||
// patched method that fires the webaudio actor's `connect-param` event.
|
||||
// Connect directly to the wrapped `destNode`, otherwise
|
||||
// the patched method thinks this is a new node and won't be
|
||||
// able to find it in `_nativeToActorID`.
|
||||
XPCNativeWrapper.unwrap(srcNode).connect(destNode[paramName], output);
|
||||
} catch (e) {
|
||||
return constructError(e);
|
||||
}
|
||||
}, {
|
||||
request: {
|
||||
destActor: Arg(0, "audionode"),
|
||||
paramName: Arg(1, "string"),
|
||||
output: Arg(2, "nullable:number")
|
||||
},
|
||||
response: { error: RetVal("nullable:json") }
|
||||
}),
|
||||
|
||||
/**
|
||||
* Connects this audionode to another via `node.connect(dest)`.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user