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

Prevent Polly from making UI laggy #462

Merged
merged 1 commit into from
Aug 9, 2017
Merged

Prevent Polly from making UI laggy #462

merged 1 commit into from
Aug 9, 2017

Conversation

bsudekum
Copy link
Contributor

@bsudekum bsudekum commented Aug 7, 2017

try Data(contentsOf: url as URL) was really blocking up UI rendering. Removing this and moving to an async method for fetching data allows the UI to continue rendering while the data is fetched and unpacked. The UI during speaking is noticeably smoother.

/cc @willwhite @ericrwolfe @frederoni

@bsudekum bsudekum changed the title Fix polly voice smoothness Prevent Polly from making UI laggy Aug 7, 2017
@bsudekum bsudekum requested a review from frederoni August 7, 2017 23:44
@@ -111,18 +117,38 @@ public class PollyVoiceController: RouteVoiceController {
return
}

do {
let soundData = try Data(contentsOf: url as URL)
Copy link
Contributor

Choose a reason for hiding this comment

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

Specifically, it was this line that was bogging down the UI.

return
} else if let error = error {
// Cannot call super in a closure
strongSelf.callSuperSpeak(strongSelf.fallbackText, error: error.localizedDescription)
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to call super’s speak(_:error:) specifically? Why not call self.speak(_:error:)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@1ec5 that would result in the polly voice controller trying to fetch a new polly mp3 if it were to fail. The idea here is that if it fails, it falls back to the default speech synth.

@ericrwolfe ericrwolfe modified the milestone: v0.7.0-2 Aug 9, 2017
@bsudekum bsudekum merged commit e7585c0 into master Aug 9, 2017
@bsudekum bsudekum deleted the smooth-voice branch August 9, 2017 20:19
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.

3 participants