Re: [web-audio-api] Loop event (#267)

On 25 October 2013 00:48, W3C Audio Working Group Notifications <
notifications@github.com> wrote:

> On Thu, Oct 24, 2013 at 1:17 PM, Douglas Gore <notifications@github.com>wrote:
>
>
> Can't you do what you want using something like
>
> source.loop = true;
> source.start(start_time);
> source.stop(start_time + 100*buffer_length);
>
> (I didn't actually try this.)
>
>
Did a quick test and this is a valid solution. You can do whole and partial
loops without issue so that would appear to meet the use case where you
want to have a predefined number of loops.

If the final number of loops required isn't known in advance I assume it
would be down to the user to track the start time of playback to use to
determine the stop time later.

Doug


> --
> Ray
>
>
> >
> The correct solution of course would probably be to create n loops ahead
> > using the onended event as a check point for creating more.
> >
> > Chris you make a very valid point that the loop could be extremely short
> > and therefore a loop event could generate an overwhelming amount of
> > activity. This would probably bring a browser / tab to its knees.
> >
> > I'm not sure what the impact is of creating new buffer nodes is vs being
> > able to loop a single buffer node for as long as needed.
> >
> > Another possible solution would be if the optional duration parameter of
> > start() accepted a value greater than the length of the buffer when loop
> is
> > enabled allowing you to loop for as long as necessary. E.g. I could
> > specifiy buffer.duration * 3 to get 3 loops or even 3.25 to get 3 and
> > quarter loops. If the loopStart and loopEnd properties are set then this
> > can be accommodated in the calculation.
> >
> > —
> > Reply to this email directly or view it on GitHub<
> https://github.com/WebAudio/web-audio-api/issues/267#issuecomment-27026097>
>
> > .
> >
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/WebAudio/web-audio-api/issues/267#issuecomment-27044054>
> .
>

---
Reply to this email directly or view it on GitHub:
https://github.com/WebAudio/web-audio-api/issues/267#issuecomment-27067291

Received on Friday, 25 October 2013 06:03:43 UTC