71 Commits

Author SHA1 Message Date
Jean-Michel Trivi
3218471bcd Modify the gain after filtering to prevent TTS clipping in en-US. 2009-09-01 13:46:43 -07:00
Jean-Michel Trivi
b009418048 Clean TTS logs: use a common TAG in the TTS service, don't show
an error when loading the native synth lib.
2009-08-31 14:46:18 -07:00
Jean-Michel Trivi
09f8db7ad3 Add a synchronous stop method to TTS synth engine so that upon its destruction,
if it was synthesing to a file, the latter can be deleted without
still being written to.
Clear the hashmap of SpeechItem to be stopped (mKillList) when the speech
queue is empty.
2009-08-31 11:39:20 -07:00
Jean-Michel Trivi
ab6ed2c2b9 Launch synthesis thread at max priority to prevent hicups in playback.
Return and log an error when an operation cannot be completed because
the speech queue is locked longer than the timeout period.
Log cleanup.
2009-08-28 09:25:11 -07:00
Jean-Michel Trivi
a3046b6f7f Implement clean killing of the TTS service.
If files were being synthesized to while the service was being killed,
it would have left partially written files (with no header). This CL
checks if the service is rendering to a file at the time the service
is destroyed: if it is, it will stop the rendering and deletes the file.
2009-08-26 17:06:52 -07:00
Jean-Michel Trivi
0deb41abc6 am 0950c5de: Merge change 21226 into donut
Merge commit '0950c5de864d1ad83ed96efc5c2d1569b4d36188' into eclair

* commit '0950c5de864d1ad83ed96efc5c2d1569b4d36188':
  Fix bug 2046705 where the output of the speech synthesizer is too low.
2009-08-18 08:44:51 -07:00
Jean-Michel Trivi
4fb7d882b2 Fix bug 2046705 where the output of the speech synthesizer is too low.
The language files for the SVOX Pico engine result in the output of
the synthesizer to be too soft, and barely audible on a phone speaker.
The change implements a low shelf filter on the output of the synthesis
and a drastic amplification. This works as intended because the
synthesized data contains too much energy in the lower frequencies that
is wasted on a phone speaker. Once filtered out, they leave room for
amplication to address the volume issue.
2009-08-14 10:05:19 -07:00
Jean-Michel Trivi
337cf910b3 am eccd6fdd: Merge change 20673 into donut
Merge commit 'eccd6fdd0d86b8610b738fc15c707eedc00ec9dc'

* commit 'eccd6fdd0d86b8610b738fc15c707eedc00ec9dc':
  Fix bug 2043140.
2009-08-12 12:04:40 -07:00
Jean-Michel Trivi
69e67a3e2e Fix bug 2043140.
A race condition is encountered when an application invokes shutdown()
on its TextToSpeech object while is has speak() requests still running.
Since the TTS service destructor releases the synthesizer resources and
sets the corresponding synth reference to null, an NPE was observed.
The fix consists in catching NPEs whenever the sNativeSynth object is
accessed, and return the matching error for the call.
This change is a "low risk" version of the fix for bug 2025765i (same
issue) which was reverted because it was higher risk than this CL:
it affected the logic of each call to sNativeSynth. This CL only sets
an error code when an NPE is fired because sNativeSynth is null.
2009-08-11 15:09:45 -07:00
Jean-Michel Trivi
ff14d457c4 am fbe89ec6: Revert "Fix bug 2025765."
Merge commit 'fbe89ec6404978da7899b944d989dd9f50a468b5'

* commit 'fbe89ec6404978da7899b944d989dd9f50a468b5':
  Revert "Fix bug 2025765."
2009-08-04 10:54:07 -07:00
Jean-Michel Trivi
fbe89ec640 Revert "Fix bug 2025765."
This reverts commit 9ebb59b8aa75cab1e5bb53983893b579abb63edd.
2009-08-04 09:23:18 -07:00
Android (Google) Code Review
7a17cf3418 am 377b21e9: Merge change 9502 into donut
Merge commit '377b21e9f531e3fec1a5849453f886b5462e4144'

* commit '377b21e9f531e3fec1a5849453f886b5462e4144':
  Fix bug 2025765.
2009-08-03 11:54:24 -07:00
Jean-Michel Trivi
9ebb59b8aa Fix bug 2025765.
Talkback produced a null pointer exception when being enabled and disabled
repeatedly due to a race condition between the onDestroy() of the service,
and the use of the service itself. The error occurs when one Talkback
thread initiates the destruction of the service (call to onDestroy()) when
it invokes shutdown() on its TextToSpeech instance (the client of the
service). At the same time, Talkback tries to say that "Accessibility" is
unchecked from another thread. During onDestroy(), the reference to the
TTS engine (sNativeSynth) is reset to null, which is used in the service
in speakInternalOnly(), and setLanguage().
The fix consists in the addition of a static variable that signals that
the service has entered onDestroy(). Once this flag is set, all method
invocations on sNativeSynth will be dismissed. Note that access to the
native resources used by sNativeSynth are synchronized at the native
layer, therefore preventing sNativeSynth.shutdown() to interfere with
a sNativeSynth.speak() call already underway.
2009-08-03 11:07:46 -07:00
Android (Google) Code Review
cdc0d941e8 am 2bad713f: Merge change 8860 into donut
Merge commit '2bad713f31d642d5350949b90b3abe00fbd9ca55'

* commit '2bad713f31d642d5350949b90b3abe00fbd9ca55':
  Fix bug 2017664
2009-07-30 06:56:37 -07:00
Jean-Michel Trivi
ed06578edd Fix bug 2017664
Removed the TTS_ prefix in the TextToSpeech class to follow the standard naming convention.
Moved the TTS-related intents from the Intent class to TextToSpeech and TextToSpeech.Engine.
Renamed the TextToSpeech.Engine constants that are used as extras for the
  ACTION_TTS_CHECK_TTS_DATA intent to prefix them with EXTRA_.
Cleaned up the other TextToSpeech.Engine constant to remove superfluous mentions of
  "TTS" in the name.
2009-07-29 11:26:10 -07:00
Android (Google) Code Review
0326beef19 am 79858fe2: Merge change 8678 into donut
Merge commit '79858fe2f5b088ad93e461ea94e544bfce3c2e09'

* commit '79858fe2f5b088ad93e461ea94e544bfce3c2e09':
  Fixing bug #2008185 - problem with the TTS dropping
2009-07-27 15:09:59 -07:00
Charles Chen
0dbc6a44bb Fixing bug #2008185 - problem with the TTS dropping
utterances under heavy load was caused by the speech
queue being locked. Switched to using a timeout with
tryLock so that the TTS service does not give up
immediately.
2009-07-27 14:09:58 -07:00
Eric Laurent
a553c25b33 Fix issue 1795088 Improve audio routing code
Initial commit for review.
Integrated comments after patch set 1 review.
Fixed lockup in AudioFlinger::ThreadBase::exit()
Fixed lockup when playing tone with AudioPlocyService startTone()
2009-07-23 06:03:39 -07:00
Jean-Michel Trivi
d702c357fc Increase the volume of the AudioTrack instance used for the speech synthesis. 2009-07-21 18:10:04 -07:00
Jean-Michel Trivi
cee3bd4d68 Reset the speech synth singleton to null when the service is destroyed
so it can be recreated when the service is initialized.
In the interface with the native synthesizer library, close the lib
in the finalizer, delete the global ref to the SynthProxy java object.
2009-07-21 14:22:25 -07:00
Jean-Michel Trivi
a73d5cd055 Make sure the speech synthesizer proxy is a singleton in the TTS service. 2009-07-21 10:13:41 -07:00
Jean-Michel Trivi
5e11a6ad00 Prevent the setLanguage() method in TextToSpeech to change the language
for all current TextToSpeech instances by only caching the language
value so it is used with each subsequent utterance for this instance.
Synchronize calls to the engine around a global mutex since the engine
isn't thread-safe, except for the stop() call which is meant to interrupt
the synthesis loop.
2009-07-20 16:07:57 -07:00
Charles Chen
342c329203 Fixing the random audio mangling problem (TTS becomes incomprehensibly fast) 2009-07-18 00:25:21 -07:00
Android (Google) Code Review
4b897aa99b Merge change 7829 into donut
* changes:
  Making sure that there are no calls made to the native TTS layer if the utterance is in the process of being canceled.
2009-07-17 21:39:26 -07:00
Charles Chen
b79370aad7 Making sure that there are no calls made to the native TTS
layer if the utterance is in the process of being canceled.
2009-07-17 20:57:21 -07:00
Jean-Michel Trivi
8b86da899a Remove obsolete playBuffer() method from the text-to-speech SynthProxy class. 2009-07-17 18:22:15 -07:00
Jean-Michel Trivi
19e53f7ae5 Delete global ref to the weak reference to the SynthProxy in the
native_finalize function, that was created in native_setup to prevent
leaking refs.
2009-07-16 20:13:12 -07:00
Charles Chen
c231fd0fe7 Fixing a race condition that causes synthesis to not be aborted
even if stop is called.
2009-07-16 11:29:34 -07:00
Android (Google) Code Review
83fa356589 Merge change 7356 into donut
* changes:
  Fixing a bug in how stop works - keep stop from always stopping the currently speaking item if that item does not belong to the app that is trying to do the stop.
2009-07-15 09:28:45 -07:00
Charles Chen
6f624239dc Fixing a bug in how stop works - keep stop from always stopping
the currently speaking item if that item does not belong to the
app that is trying to do the stop.

Also adds back the functionality of globally stopping speech that
was lost when utterance IDs were added (needed by screen reader).
2009-07-14 19:30:29 -07:00
Charles Chen
4a3368ffe8 Making sure that the audio buffers for speech are cleared
so that there are no leftovers which could cause mangled output.
2009-07-14 18:21:27 -07:00
Charles Chen
edb4fc3076 Cleaning up TtsService 2009-07-14 10:54:36 -07:00
Charles Chen
3ab2076d65 Implementing utterance ID callbacks for silence and pre-recorded files
(both generating and playing).
2009-07-13 21:21:01 -07:00
Charles Chen
78c9d0d2c5 Adding Utterance ID to the TtsService. 2009-07-13 17:46:19 -07:00
Jean-Michel Trivi
9440bce855 Propagate optional audio stream type to the creation of the audio resources
to enable the playback of TTS content on various stream types.
2009-07-13 11:34:30 -07:00
Charles Chen
630a8de44f Fixing TTS breakage. 2009-07-10 20:58:15 -07:00
Jean-Michel Trivi
d48ca22b9f Use the TTS queue constants in the TTS service as defined in the
TextToSpeech class.
2009-07-10 10:04:37 -07:00
Charles Chen
a9c5e4bf26 Adding tagging to utterances to track which app said what. 2009-07-10 09:43:03 -07:00
Charles Chen
be84e4134d Unbreaking the build. 2009-07-09 11:54:50 -07:00
Charles Chen
0a3d8744fe Adding a lock to stop so that stop will stop utterances
that are just starting up.
2009-07-09 09:51:33 -07:00
Charles Chen
2a8a2d76f1 Removing the ttsSynthDoneCallback logging. 2009-07-07 16:24:02 -07:00
Charles Chen
b02ced7e45 Cleaning up logs.
Initializing SpeechItem.mText to "" instead of null to
prevent a null from accidentally being used when it is a
non-text utterance.
2009-07-07 14:57:16 -07:00
Jean-Michel Trivi
d478cf09df Use the current Locale as the default language when TTS settings are not
found, rather than a hardcoded value stored in TextToSpeech.Engine.
2009-07-06 18:02:08 -07:00
Charles Chen
52ae06521a Fixes a compatibility issue with users that have the old TTS
installed already.
2009-07-06 16:10:32 -07:00
Charles Chen
a3f89295ad Propagating the error codes through the TtsService 2009-07-06 14:14:52 -07:00
Charles Chen
35b86c273a Adding tts result codes. 2009-07-06 10:51:48 -07:00
Charles Chen
4bca97ecaf Removing IPA - IPA is already handled by the phoneme tag. 2009-07-02 17:21:22 -07:00
Charles Chen
ebb814bbae Fixing synth to file to use the speech queue. 2009-06-30 12:03:06 -07:00
Jean-Michel Trivi
f07d824ba4 In TTS synthesis to file, remove hard coded values for the writing of the WAV header.
Corrected TTS Service manifest to allow writing to external storage.
Corrected memory management when the end of synthesis is signaled.
2009-06-30 09:50:12 -07:00
Jean-Michel Trivi
bbd63cb285 Fix bug where the default TTS Service country is initialized to the default language. 2009-06-29 17:31:05 -07:00