From f032bc7da536774a0b6a1c77632c65b935eee6fa Mon Sep 17 00:00:00 2001 From: Charles Chen Date: Fri, 26 Jun 2009 14:41:55 -0700 Subject: Adding in the playSilence method to TextToSpeech.java --- core/java/android/speech/tts/TextToSpeech.java | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java index 1502d98..41b25ec 100755 --- a/core/java/android/speech/tts/TextToSpeech.java +++ b/core/java/android/speech/tts/TextToSpeech.java @@ -410,7 +410,27 @@ public class TextToSpeech { public void playSilence(long durationInMs, int queueMode) { - // TODO implement, already present in TTS service + synchronized (mStartLock) { + if (!mStarted) { + return; + } + try { + // TODO support extra parameters, passing cache of current parameters for the moment + mITts.playSilence(durationInMs, queueMode, mCachedParams); + } catch (RemoteException e) { + // TTS died; restart it. + mStarted = false; + initTts(); + } catch (NullPointerException e) { + // TTS died; restart it. + mStarted = false; + initTts(); + } catch (IllegalStateException e) { + // TTS died; restart it. + mStarted = false; + initTts(); + } + } } -- cgit v1.1