Yeah, looks like the current code just supports U8 and S16. Probably because the first things ported with it used those ;) I see that BananaBread and Me&MyShadow both use S16...
Would be good to improve this. On Wed, Apr 4, 2018 at 1:16 PM, Floh <flo...@gmail.com> wrote: > Hi, I'm currently snooping around in library_sdl.js and wonder if there is > a specific reason why the SDL Audio wrapper doesn't accept float32 samples? > > Here's my situation: > > - WebAudio AudioBuffers generally seem to have float32 samples (?) > > - the SoLoud library "SDL static" backend (which is best suited for > emscripten) first tries to create an SDL audio context with float32 > samples, however this fails, so it falls back to signed 16-bit (see here: > https://github.com/jarikomppa/soloud/blob/3cd9b4bfa96a1e4b468dac34643a49 > 5fcaa77b0f/src/backend/sdl_static/soloud_sdl_static.cpp#L74 ) > > - however, in its audio callback, SoLoud also only accepts float32 > samples... > > - ...so what happens is unfortunately this: > (1) application provides float32 samples to SoLoud > (2) SoLoud converts the float32 sample data to 16-bit integer before > handing it to emscripten's SDL wrapper > (3) emscripten converts the 16-bit integer samples back to float32 (I > think at least) before handing the sample data to WebAudio... > > It looks like supporting float32 samples in library_sdl.js wouldn't be too > much work, unless I've overlooked something? Should I open a ticket for > this? I might even find some time to tinker around with it and provide a > pull request... > > Cheers! > -Floh. > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to emscripten-discuss+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to emscripten-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.