Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

It should be possible for a user to specify the AudioContext used by Flocking #298

Open
colinbdclark opened this issue Oct 22, 2020 · 0 comments

Comments

@colinbdclark
Copy link
Collaborator

Currently, there's no supported API that a user can use to provide the Web Audio AudioContext object that Flocking should use instead of creating its own. This should be an option that can be provided to an flock.environ component, and via a call to flock.init() for those in the imperative mindset.

For now, luckily, there is a workaround. Flocking stores its AudioContext as a singleton in a global variable, flock.webAudio.audioSystem.audioContextSingleton. Assigning an AudioContext instance to this variable prior to initializing Flocking will cause it to use that context instead of creating its own. For example:

var ac = new AudioContext();
flock.webAudio.audioSystem.audioContextSingleton = ac;
flock.init();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant