[webkit-dev] Using JavaScriptCore in an audio context
Stéphane Letz
letz at grame.fr
Tue Sep 22 08:32:03 PDT 2015
Hi,
We have the following project of using JavaScriptCore framework on iOS in an audio context :
- we generate optimized asm.js code from a Domain Specific Language (actually an asm.js module for the audio code itself + some additional standard JS functions)
- the asm.js module contains a "compute" function that receive an array of input float buffers, process them, and returns an array of output float buffers.
- the array of input float buffers is typically got from a realtime CoreAudio audio callback, and the array of output float buffers has to be given back to the callback. So we would basically need to transfer C float arrays to the asm.js code and back.
Now the questions :
- since the asm.js code does not allocate memory, we hope calling the asm.js "compute" function directly form the CoreAudio callback will work, so basically that asm.js code can be called from a real-time callback. Is that a correct assumption?
- what would be the most efficient manner to transfer C float arrays to the asm.js code and back? Is there a way to completely avoid copies during the process? Since JavaScriptCore can be used using a Objective C API (but not pure C API right?) do we need to use intermediate Objective C arrays to transfer data?
Thanks for any advance or code example to look at.
Stéphane Letz
More information about the webkit-dev
mailing list