Re: Valid start offsets and durations for AudioBufferSourceNodes?

On Thu, Oct 31, 2013 at 1:11 PM, Karl Tomlinson <> wrote:

> Raymond Toy writes:
> > The spec doesn't say, but are there any constraints on valid values for
> the
> > offset or duration for the start method of an AudioBufferSourceNode?
>  What
> > does it mean if the offset or duration is negative? What about a duration
> > of 0?
> I don't think it would be right to throw an exception for offset
> or duration greater than the buffer length.  These are real
> numbers so rounding errors may mean they end up a little greater
> than the length.
> Also, I assume |buffer| can be set after start() is called with
> duration, but I guess this depends on and perhaps influences the
> outcome from
> Anyway, I don't think the method should throw on offset duration
> too large.  Perhaps similar rounding in complex calculations could
> make offset or duration less than zero, and consistency would
> suggest also not throwing there.
> Outside the sensible ranges for offset and duration, I think the
> implementation should do the best it can.  Perhaps this means that
> samples from the buffer will be played later if offset is
> negative, but Gecko treats negative offsets as zero.

I'm perfectly happy with just clipping the offset and duration to values
between 0 and the actual buffer length. I just wasn't sure what the spec
wanted here.

> A duration of 0 should play nothing and I assume dispatch ended
> when start time is reached, but I don't think Gecko dispatches
> ended.

This seems like a corner case.  I'll have to check to see what Blink does.


Received on Thursday, 31 October 2013 21:10:21 UTC