Re: AudioBuffer mutability

On Mon, Oct 29, 2012 at 5:41 PM, Robert O'Callahan <robert@ocallahan.org>wrote:

> I think in this case this problem is actually easy to solve without even
> changing the API. The typed array spec defines a "neuter" operation on
> ArrayBuffers that makes the underlying data inaccessible through the
> ArrayBuffer and any objects (such as Float32Array) that depend on the
> ArrayBuffer:
> http://www.khronos.org/registry/typedarray/specs/latest/#9.2
> This is used by Web Workers to enable safe zero-copy transfer of ownership
> of the data from one thread to another. We could say that, for a given
> AudioBuffer B, the first time start() is called on an AudioBufferSourceNode
> whose 'buffer' is B, B's channel ArrayBuffers are neutered. Any future
> attempts to modify the data will then fail, probably with an "array index
> out of bounds" error.
>
> How does that sound?
>

This makes the most sense to me.

Cheers,
--
Ehsan
<http://ehsanakhgari.org/>

Received on Monday, 29 October 2012 22:57:31 UTC