nativeformat / NFPlayerJS

A JavaScript/TypeScript audio engine for the Web and Server capable of multitrack time stretching, pitch shifting, declarative effects, faster than realtime processing, and more!
https://nativeformat.github.io/NFPlayerJS
Apache License 2.0
129 stars 9 forks source link

fix: use `Float32Array` instead of number array #22

Closed Korilakkuma closed 4 years ago

Korilakkuma commented 4 years ago

The 1st argument of setValueCurveAtTime is Float32Array (sequence<float>)

kirbysayshi commented 4 years ago

Hey! Thanks a lot for the effort you put into this!

I'm having trouble remembering why, but these are actually generated files with some hand-modifications.

So the true change would be here https://github.com/spotify/NFPlayerJS/blob/4f4f198ddc6ba54a3cfebe429134c38edee8e7d6/src/params/ScoreAudioParam.ts#L134, and then regenerate the declaration.

However, I think the root reason why I left it as a number[] instead of the correct Float32Array is because serializing and deserializing to a Float32Array from JSON requires special consideration, such as a custom deserializer. And I think we wanted to avoid anything that wasn't pure JSON.

So. I'm going to close this, since the goal is to keep it pure JSON. But please let me know if you think it should be otherwise!