W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2012

Re: replay AudioBufferSourceNode ?

From: Jerome Etienne <jerome.etienne@gmail.com>
Date: Wed, 21 Mar 2012 05:30:37 +0100
Message-ID: <CAN_PVv6TG1hM9MYbw3bTbfgDVxWhsySx+XZt=QX_C6P=RBp6Eg@mail.gmail.com>
To: Chris Rogers <crogers@google.com>
Cc: public-audio@w3.org
On Tue, Mar 20, 2012 at 8:34 PM, Chris Rogers <crogers@google.com> wrote:
> On Tue, Mar 20, 2012 at 12:29 AM, Jerome Etienne <jerome.etienne@gmail.com>
>> Nevertheless in a game, a sound is played many-many times. So
>> BufferSource javascript object needs to be recreated, fully
>> reconfigured and reconnect every time you play it. This is rather
>> cumbersome for the developer. How can i clone an existing BufferSource
>> ? maybe somebody did a javascript function on top of the spec ?
>
>
> Although it may seem strange at first, I think it's straight-forward and
> works quite well.  There are a few tutorials/blogs explaining how this
> works, for example:
>
> Please see the playSound() function here:
> http://www.html5rocks.com/en/tutorials/webaudio/intro/

i read this tutorial. in fact i read all tutorials about webaudio i
could find on html5rock. i failed to find one which explain how to
*clone* a buffersource, aka copy an existing buffersource. i only
found how to *create* one. did i miss it ?

> It's only a few lines of JavaScript which is wrapped up in a function which
> is simple to call each time a particular sound needs to be played.

I asuppose i want to play a sound several time ? how can i do that ?
what is the recommended way ?

Is it to create a function which init the buffersource node, and call
it to recreate the node at every occurance ? how to do that
efficiently ?
Received on Wednesday, 21 March 2012 04:31:06 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 21 March 2012 04:31:11 GMT