GoogleChrome / omnitone

Spatial Audio Rendering on the web.
https://googlechrome.github.io/omnitone
Apache License 2.0
852 stars 114 forks source link

Renderer setters don't work until after initialize promise resolves #102

Open brianchirls opened 5 years ago

brianchirls commented 5 years ago

All of the setter methods on the renderers (e.g. setChannelMap, setRotationMatrix3) do nothing if they are called before the initialize promise resolves. There is no warning or error, and this behavior is not documented.

There isn't really any reason why these methods can't operate immediately, since they depend on objects created in _buildAudioGraph, which is run in the constructor, not in initialize. (Initialization only loads the HRIRs.)

This issue manifests, for example, as a bug in Resonance Audio Web SDK where the rotation matrix should be set immediately by an option to the constructor, but it does not take effect because the setRotationMatrix3 call on the Omnitone renderer does nothing.

capnmidnight commented 4 years ago

I had noticed that as well.

Between this issue, another bug in Omnitone that was swapping audio channels when using the higher-order ambisonic renderer, and the fact that this repo and Resonance haven't been updated in several years, I forked the two projects and fixed the issues here: https://github.com/capnmidnight/resonance-audio-web-sdk