From 0b5cecc687dc5992e7f047eaa9be0a20e54810df Mon Sep 17 00:00:00 2001 From: Jonathan Hersh Date: Mon, 9 Feb 2015 18:02:01 -0800 Subject: [PATCH] Try to avoid extra synth timeouts --- SSAccessibility/SSSpeechSynthesizer.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SSAccessibility/SSSpeechSynthesizer.m b/SSAccessibility/SSSpeechSynthesizer.m index e800dd9..68322ad 100644 --- a/SSAccessibility/SSSpeechSynthesizer.m +++ b/SSAccessibility/SSSpeechSynthesizer.m @@ -84,6 +84,11 @@ - (void)enqueueLineForSpeaking:(NSString *)line { } dispatch_async(dispatch_get_main_queue(), ^{ + if (self.speakResetTimer) { + [self.speakResetTimer invalidate]; + _speakResetTimer = nil; + } + [self.speechQueue addObject:line]; [self _maybeDequeueLine]; }); @@ -155,6 +160,7 @@ - (void)voiceOverDidFinishAnnouncing:(NSNotification *)note { if (self.speakResetTimer) { [self.speakResetTimer invalidate]; + _speakResetTimer = nil; } NSDictionary *userInfo = [note userInfo];