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

Lazy initialize singleton mixer node #58

Merged
merged 1 commit into from
Aug 14, 2023

Conversation

junyaninflection
Copy link
Contributor

@junyaninflection junyaninflection commented Aug 13, 2023

This is a fix for issue 49. According to apple, the mainMixerNode singleton has an side effect on first access. This is why AudioPlayer initializer will stop existing background audio. The fix defer the access by making it inside a lazy var.

The audio engine constructs a singleton main mixer and connects it to the when first accessing this property. You can then connect additional audio nodes to the mixer

@dimitris-c
Copy link
Owner

Nice catch

Copy link
Owner

@dimitris-c dimitris-c left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +159 to +161
frameFilterProcessor = FrameFilterProcessor(mixerNodeProvider: {
engine.mainMixerNode
})
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could also be possible that the frameFilterProcessor be initialised when a relevant method is first used. But we could improve on another PR.

@dimitris-c
Copy link
Owner

I won't be able to make a release since I'm on annual leave. Do you mind creating one? I think you just need to bump versions 🙏

@dimitris-c dimitris-c merged commit 6f552e6 into dimitris-c:main Aug 14, 2023
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

Successfully merging this pull request may close these issues.

2 participants