When speak() is immediately followed by a stop(), the speak may not be
stopped at all due to a race condition.
Bug: 63649835
Test: android.speech.tts.cts.TextToSpeechServiceTest#testSpeakStop
Change-Id: Iae5660b455f5d845aa119c902057e2ca7131ce1b
The previous implementation calls back the dispatcher only at the end
of run() loop. It means, if stop() is called after enqueueing and
before running, none of onSuccess, onStop, or onError is called for
the items in the queue.
Bug: 63649835
Test: android.speech.tts.cts.TextToSpeechServiceTest#testSpeakStop
Change-Id: Ib20cb0e9157859866f694439858a27369ba8026e
Also rename onUtteranceRangeStart to onRangeStart based on feedback from
the API council.
Bug: 35767714
Bug: 35767290
Test: cts-tradefed run cts-dev --module CtsSpeechTestCases
Change-Id: I2c17a06e401313d4f35e5ec4958c2251c195ef05
just after the AudioTrack is initialized.
This solve the issue with cached synthesis in which updateMarker was
called before AudioTracker initialization and we never got the
callbacks.
Test: Built android and flashed to a device.
Change-Id: I9053d1d046cc9a76aeedd307d5d48920e26e584d
The service can inform the framework at which frame a part of the input
is spoken, and that information is then relayed to the client.
This can be used to highlight the currently spoken word/sentence or to
resume synthesis requests at the start of the last word/sentence.
Test: manual
Change-Id: Ie20a6764a8788cc3539cb058425e55eb6fde07db
When multiple QUEUE_DESTROY messages arrive in a short timespan, some
messages were not flushed. This is because every QUEUE_DESTROY message
resets mFlushAll just before it starts playing itself. The solution
is to keep a counter of the amount of flushes that are still behind it on
the queue and keep flushing until the last one is reached.
Bug: 27555444
Change-Id: Ic24aa2250bf684e74b541907e4c57e0d5f0069ca
Also prefer AudioManager.AUDIO_SESSION_ID_GENERATE over
AudioSystem.AUDIO_SESSION_ALLOCATE, because
AudioSystem.AUDIO_SESSION_ALLOCATE is @hide.
Bug: 27562099
Change-Id: I5924554feb919db7f2390f5b062faedd515421af
The body of {@code} must not be HTML escaped. This is one of
several changes that fix the source in conjunction with a
doclava fix.
Bug: 25757239
Change-Id: Ib38a0fa2dd2a3d68e467f78a812071e763d7e881
a warning.
TextToSpeech.synthesizeToFile has only ever worked with 8bit and 16bit
PCM. In case of float PCM an invalid file would be generated and in case
of other encodings the TTS engine would crash.
Also add more annotations to SynthesisCallback.
Change-Id: I1c44a44509e9b53bb2e1b0f2044b1a5919875e1c
The name of the voices was not normalized in getVoices(), therefore if
you use getDefaultVoiceName, that name possibly doesn't appear in
getVoices(). The framework would then run into a NullPointerException.
This was caught by the cts tests. Also added a few more log statements.
BUG: 22115315
Change-Id: I51404ddcd1bc10dd3e1ddaac410cfa9873bf1438
When the synthesizer returns LANG_AVAILABLE or LANG_COUNTRY_AVAILABLE
for a certain locale, we strip the country and variant from the locale
before asking the synthesizer for the default voice name for this
locale.
This can prevent the synthesizer from picking the right locale. For
instance it prevents the synthesizer from picking en-gb if en-au is
requested, now it can only have a single preferred voice for all English
countries.
The solution is not to strip the country and variant from the locale.
This is not likely to break anything, because the input to
onGetDefaultVoiceNameFor was never expected to be a subset of all
supported language-country-variant combinations. The default
implementation handles this correctly.
Change-Id: I017f69d321039c7aa7a3ef5a09ba138e35b66670
(cherry picked from commit 4758e99783)
New UtteranceProgressListener callback that allows
to detect a call to TextToSpeech#stop() (or QUEUE_FLUSH usage)
from the same client, or a QUEUE_DESTROY usage from any other
client (Talkback uses it to preempt other users of TextToSpeech
queue). This change is required for seamless Books read aloud
feature+Talkback usage.
+ Fixes for broken tests/TtsTests
Bug: 17901521
Change-Id: I30d2f297bb7c8d05cbeb16f63e85c1be0cca5c84
Use a WeakReference to refer to the outer class to prevent leaks.
Ensure atomicity of access to the reference.
Bug: 17584947
Change-Id: I7ad7c7793b60fa125e04fc4d803ed905e8a00a95
- Make sure cancel is called when consumer of SpeechRecognizer calls
destroy.
- If consumer goes away, make sure to call cancel as well.
b/17584947 Pressing mic button in Music hoses audio
Change-Id: Ibe1198b37fe6167493a8694f9089d970f1eb07de
Due to recent fixes for TTS API review (b/17389935)
overloaded playSilence method became ambiguous when
the last argument is null. This change renames the new
method to playSilentUtterance solving the issue.
Also, since LMP API level is 21, I updated invalid
references to it as API level 20 inside speech.tts.
Bug: 17389935
Change-Id: I9f9fae988240d1cec45d44650e53ffc29803ccac
- New TextToSpeechService methods are no longer protected.
- s/getRequiresNetworkConnection/isNetworkConnectionRequired
- New TextToSpeec#play.. methods use a Bundle instead of a HashMap
- New synthesizeToFile(), addSpeech(), addEarcon() methods
take a File instead of a String with filepath.
- TextToSpeechService#s/isValidVoiceName/onIsValidVoiceName
Bug:17389935,17253934
Change-Id: Iec76f59015c34104683c050fe1ff1ceccd604134
This changes makes the initial, default language set and
the #setLanguage call with the default language as input
exactly the same.
Previously, the requests made after the initial default language
set were missing the name of the default voice.
+ Some tests clean-up. Some of them fail due to issues with
Locale#toLanguageTag upper-casing the variant field.
Change-Id: I5470617007fe45462b7198bf62a03eb5fe47a590
Expose the value used by the framework to generate an audio
session ID when a value isn't known.
Rename allocateAudioSessionId() to generateAudioSessionId()
as this operation doesn't "allocate" anything, and there is
no allocated resource to free after this operation.
Bug 16401631
Change-Id: I7a7bc05b39ea0b024ff225254eb755a9c85a2ad9
Regressinon in the L, side effect of the rewrite. In pre-L android,
UtteranceProgressListener#onDone was called (but only if client
received UtteranceProgressListener#onStart for the utterance in progress)
after client called TextToSpeech#stop. This changeset reinstates
this behaviour.
+ Removed not used fallback callback
Bug: 16149006
Change-Id: I2eb5ede0abe6f5717b07f09adad861465575c238
Voices allow to expose multiple backends/voice packs for a single
Locale. This is an attempt to port this feature from V2 API.
Bug: 15834470
Change-Id: I0117de238cfcf028bcec5344b8d65c960b96b98c