2014-12-27 08:10:00 +00:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test AudioNode#addAutomationEvent() when automation series ends with
|
|
|
|
* `setTargetAtTime`, which approaches its target to infinity.
|
|
|
|
*/
|
|
|
|
|
|
|
|
add_task(function*() {
|
|
|
|
let { target, front } = yield initBackend(SIMPLE_CONTEXT_URL);
|
|
|
|
let [_, [destNode, oscNode, gainNode]] = yield Promise.all([
|
|
|
|
front.setup({ reload: true }),
|
|
|
|
get3(front, "create-node")
|
|
|
|
]);
|
|
|
|
|
2015-01-07 18:57:00 +00:00
|
|
|
yield oscNode.addAutomationEvent("frequency", "setValueAtTime", [300, 0.1]);
|
|
|
|
yield oscNode.addAutomationEvent("frequency", "linearRampToValueAtTime", [500, 0.4]);
|
|
|
|
yield oscNode.addAutomationEvent("frequency", "exponentialRampToValueAtTime", [200, 0.6]);
|
2014-12-27 08:10:00 +00:00
|
|
|
// End with a setTargetAtTime event, as the target approaches infinity, which will
|
|
|
|
// give us more points to render than the default 2000
|
2015-01-07 18:57:00 +00:00
|
|
|
yield oscNode.addAutomationEvent("frequency", "setTargetAtTime", [1000, 2, 0.5]);
|
2014-12-27 08:10:00 +00:00
|
|
|
|
2015-01-07 18:57:00 +00:00
|
|
|
var { events, values } = yield oscNode.getAutomationData("frequency");
|
2014-12-27 08:10:00 +00:00
|
|
|
|
2015-01-07 18:57:00 +00:00
|
|
|
is(events.length, 4, "4 recorded events returned.");
|
|
|
|
is(values.length, 4000, "4000 value points returned when ending with exponentiall approaching automator.");
|
2014-12-27 08:10:00 +00:00
|
|
|
|
2015-01-07 18:57:00 +00:00
|
|
|
checkAutomationValue(values, 2.01, 215.055)
|
|
|
|
checkAutomationValue(values, 2.1, 345.930);
|
|
|
|
checkAutomationValue(values, 3, 891.601);
|
|
|
|
checkAutomationValue(values, 5, 998.01);
|
|
|
|
|
|
|
|
// Refetch the automation data to ensure it recalculates correctly (bug 1118071)
|
|
|
|
var { events, values } = yield oscNode.getAutomationData("frequency");
|
|
|
|
|
|
|
|
checkAutomationValue(values, 2.01, 215.055)
|
|
|
|
checkAutomationValue(values, 2.1, 345.930);
|
|
|
|
checkAutomationValue(values, 3, 891.601);
|
|
|
|
checkAutomationValue(values, 5, 998.01);
|
2014-12-27 08:10:00 +00:00
|
|
|
|
|
|
|
yield removeTab(target.tab);
|
|
|
|
});
|