Csound Csound-dev Csound-tekno Search About

[Csnd-dev] WebAssembly question

Date2018-10-27 16:40
FromMichael Gogins
Subject[Csnd-dev] WebAssembly question
I seem to recall mention on this list of updating the WebAssembly
build of Csound to be an ES6 module. How was this done?

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com

Date2018-10-27 19:06
FromSteven Yi
SubjectRe: [Csnd-dev] WebAssembly question
I experimented with making everything ES6, but ran into issues with
the main thread side complicating the build.  The ES6 modular code is
only done now for the AudioWorkletProcessor, which loads the
libcsound-worklet.js using ES6 import. The build.sh script has the
commands to generate libcsound-worklet.js and add commands to make it
into a module:

https://github.com/csound/csound/blob/develop/Emscripten/build.sh

line 42 is the part that does the ES6 exporting.  --post-js doesn't
work since we are also using MODULARIZE=1 as an option to emscripten
and post-js inserts code in a place that doesn't work for ES6 module
export declaration.

AWP can import ES6 modules cleanly so we could remove the
AudioWorkletGlobalScope hack we had previously used.

We could revisit ES6 again for the main-thread code later, but for now
it's fairly clean and stable so no rush to redo at the moment.
On Sat, Oct 27, 2018 at 11:40 AM Michael Gogins
 wrote:
>
> I seem to recall mention on this list of updating the WebAssembly
> build of Csound to be an ES6 module. How was this done?
>
> Regards,
> Mike
>
> -----------------------------------------------------
> Michael Gogins
> Irreducible Productions
> http://michaelgogins.tumblr.com

Date2018-10-27 19:47
FromMichael Gogins
SubjectRe: [Csnd-dev] WebAssembly question
OK, thanks for the information.

Regards,
Mike

-----------------------------------------------------
Michael Gogins
Irreducible Productions
http://michaelgogins.tumblr.com
Michael dot Gogins at gmail dot com

On Sat, Oct 27, 2018 at 2:07 PM Steven Yi  wrote:
>
> I experimented with making everything ES6, but ran into issues with
> the main thread side complicating the build.  The ES6 modular code is
> only done now for the AudioWorkletProcessor, which loads the
> libcsound-worklet.js using ES6 import. The build.sh script has the
> commands to generate libcsound-worklet.js and add commands to make it
> into a module:
>
> https://github.com/csound/csound/blob/develop/Emscripten/build.sh
>
> line 42 is the part that does the ES6 exporting.  --post-js doesn't
> work since we are also using MODULARIZE=1 as an option to emscripten
> and post-js inserts code in a place that doesn't work for ES6 module
> export declaration.
>
> AWP can import ES6 modules cleanly so we could remove the
> AudioWorkletGlobalScope hack we had previously used.
>
> We could revisit ES6 again for the main-thread code later, but for now
> it's fairly clean and stable so no rush to redo at the moment.
> On Sat, Oct 27, 2018 at 11:40 AM Michael Gogins
>  wrote:
> >
> > I seem to recall mention on this list of updating the WebAssembly
> > build of Csound to be an ES6 module. How was this done?
> >
> > Regards,
> > Mike
> >
> > -----------------------------------------------------
> > Michael Gogins
> > Irreducible Productions
> > http://michaelgogins.tumblr.com