Typed Arrays in Gecko 2: Float32Array concatenation and expansion.

Posted by janesconference on Stack Overflow See other posts from Stack Overflow or by janesconference
Published on 2010-12-29T12:52:07Z Indexed on 2010/12/29 12:53 UTC
Read the original article Hit count: 271

Filed under:
|
|

Hi all, I'm a bit confused with Javascript Typed Arrays.

What I have several *Float32Array*s, that have no concat method. I'd like to concatenate them all inside another Float32Array, but:

  • as I said before, there is no concatenation method
  • if I try to write past the array length, the array is not expanded (aka this won't work - please note that event.frameBuffer and buffer are both Float32Array and that I don't know what the final length of my buffer will be):

    var length_now = buffer.length; for (var i = 0; i < event.frameBuffer.length; i += 1) { buffer [length_now + i] = event.frameBuffer[i]; }

The only solution I found is to copy the Float32Array in a regular array, that's definitely not what I want. How would you do, stackoverflowers?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about arrays