[x3d-public] Fwd: Specification Editors: Audio and Sound, 24 June 2020

GPU Group gpugroup at gmail.com
Wed Jul 1 11:43:07 PDT 2020


Repost
---------- Forwarded message ---------



> 3. *Questions and Answers*
>
> a. We are wondering about representation of AudioContext, not seeing
>  that in your document.  Is it an X3D node?
>
> In the initial structure, we have used the AudioContext as new node in
>  X3D (in order to match with Web Audio API structure). At the moment,
>  we decide to extent X3D only with the important and necessary nodes
>  from Web Audio API. Hence, we don’t use it as X3D node.
>
Presumably you want something implementable in native as well. And a
hard-reality is there aren't a lot of choices for native libs,
Labsound boeing the closest to webAudio - a port of webAudio to
native.

https://github.com/LabSound/LabSound/blob/master/examples/src/Examples.hpp
- about Line 65 you can see Context and some effect nodes being created
- context - there's some kind of channel frequency that's shared by
all the nodes in the context, and context is responsible for setting
that.
- the context is also doing the connections between the effect nodes.
At this API level, labsound is using a lot of smart pointers. If I
call a function in the draw thread to make some sound effect, and
leave immediatly to continue drawing, the smart pointer objects will
be garbage collect -that includes context and effect nodes - and the
sound stops.
To keep the sound going, I can put a timer - but that stalls the draw thread.
The other option I mentioned last week: making a worker-thread-per-context.
- then the sound can continue playing when I return to the draw thread.
I haven't seen your draft with the correspondence table. If you don't
explicitly have AudioContext, then you should have something else that
parents the effect nodes that maps to context in LabSound
-Doug Sanden



More information about the x3d-public mailing list