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

Remove backend globals #31

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft

Remove backend globals #31

wants to merge 2 commits into from

Conversation

Bear-03
Copy link
Contributor

@Bear-03 Bear-03 commented Jul 26, 2022

This PR aims to remove a lot of static globals, associating the data with each backend instance instead of using a HashMap and indexing it with the backend ID. I haven't run any benchmarks, but this should be more optimal as it uses many fewer Mutexes, and it uses no hashmaps at all.

In the case of WinRT, it also removes a lot of code duplicated between WinRt::speak and the MediaPlayer::MediaEnded callback.

I am sure that other globals like CALLBACKS, NEXT_BACKEND_ID and NEXT_UTTERANCE_ID, as well as the BackendId struct could be removed, but I wanted to get the green light first.

Of course, I'm also interested in implementing the other backends.

This also fixes #29, but if it is not merged, I can create another PR that only contains the fix.

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.

Strange behavior setting voices with WinRT
1 participant