Re: Questions about AudioParam

On Tue, Dec 11, 2012 at 2:27 PM, Chris Rogers <crogers@google.com> wrote:

> I can see how an AudioParam could keep a record for .computedValue for the
> last N "rendering quantums", so it could look back in time to the
> .computedValue corresponding to the snapshot of .currentTime you're
> suggesting.  But we can't go back an arbitrary amount of time, since we
> don't have infinite storage.  This value is computed based on timeline
> values and also audio-rate signals (from other AudioNodes) connected to it.
>  So we don't necessarily have all the information we need to compute this
> value on-the-fly arbitrarily backwards in time.
>

One possible approach:
1) Before you modify an AudioParam in a way that could affect its value at
currentTime, compute and save the current computedValue. Flush these saved
values at the next stable state.
2) When you update the snapshot of currentTime, grab the value at
currentTime of the output of every AudioNode that is being used as input to
an AudioParam and store the result somewhere as part of the snapshot.
Then you should have enough information to recompute computedValue at
currentTime for any AudioParam.

Perhaps there is a clever technique, and I'd have to understand more
> specific details of exactly how you'd approach it.  But in any case, I
> would not like any solution which would worsen the normal average update
> rate of these parameters if animated at 60fps in requestAnimationFrame().
>  In other words, if a solution to synchronize these values to a snapshot
> caused the average performance of the animation to appear more choppy, then
> that seems bad.
>

It wouldn't. The browser is not allowed to update the page rendering while
script is running (ignoring some async compositing features that aren't
relevant here), so we'd be able to snapshot state at least as often as we
repaint the screen.

Rob
-- 
Jesus called them together and said, “You know that the rulers of the
Gentiles lord it over them, and their high officials exercise authority
over them. Not so with you. Instead, whoever wants to become great among
you must be your servant, and whoever wants to be first must be your
slave — just
as the Son of Man did not come to be served, but to serve, and to give his
life as a ransom for many.” [Matthew 20:25-28]

Received on Tuesday, 11 December 2012 01:42:14 UTC