summaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/SettingsProvider/etc/bookmarks.xml4
-rw-r--r--packages/TtsService/jni/android_tts_SynthProxy.cpp23
-rwxr-xr-xpackages/TtsService/src/android/tts/SynthProxy.java10
-rwxr-xr-xpackages/TtsService/src/android/tts/TtsService.java15
4 files changed, 16 insertions, 36 deletions
diff --git a/packages/SettingsProvider/etc/bookmarks.xml b/packages/SettingsProvider/etc/bookmarks.xml
index 5fb6608..5af416a 100644
--- a/packages/SettingsProvider/etc/bookmarks.xml
+++ b/packages/SettingsProvider/etc/bookmarks.xml
@@ -53,6 +53,6 @@
shortcut="s" />
<bookmark
package="com.google.android.youtube"
- class="com.google.android.youtube.HomePage"
+ class="com.google.android.youtube.HomeActivity"
shortcut="y" />
-</bookmarks> \ No newline at end of file
+</bookmarks>
diff --git a/packages/TtsService/jni/android_tts_SynthProxy.cpp b/packages/TtsService/jni/android_tts_SynthProxy.cpp
index 64cdb5b..80eb3cb 100644
--- a/packages/TtsService/jni/android_tts_SynthProxy.cpp
+++ b/packages/TtsService/jni/android_tts_SynthProxy.cpp
@@ -286,6 +286,7 @@ android_tts_SynthProxy_native_finalize(JNIEnv *env, jobject thiz, jint jniData)
{
if (jniData) {
SynthProxyJniStorage* pSynthData = (SynthProxyJniStorage*)jniData;
+ env->DeleteGlobalRef(pSynthData->tts_ref);
delete pSynthData;
}
}
@@ -607,24 +608,6 @@ android_tts_SynthProxy_shutdown(JNIEnv *env, jobject thiz, jint jniData)
}
-// TODO add buffer format
-static void
-android_tts_SynthProxy_playAudioBuffer(JNIEnv *env, jobject thiz, jint jniData,
- int bufferPointer, int bufferSize)
-{
-LOGI("android_tts_SynthProxy_playAudioBuffer");
- if (jniData == 0) {
- LOGE("android_tts_SynthProxy_playAudioBuffer(): invalid JNI data");
- return;
- }
-
- SynthProxyJniStorage* pSynthData = (SynthProxyJniStorage*)jniData;
- short* wav = (short*) bufferPointer;
- pSynthData->mAudioOut->write(wav, bufferSize);
- //LOGI("AudioTrack wrote: %d bytes", bufferSize);
-}
-
-
static jobjectArray
android_tts_SynthProxy_getLanguage(JNIEnv *env, jobject thiz, jint jniData)
{
@@ -710,10 +693,6 @@ static JNINativeMethod gMethods[] = {
"(II)I",
(void*)android_tts_SynthProxy_setPitch
},
- { "native_playAudioBuffer",
- "(III)V",
- (void*)android_tts_SynthProxy_playAudioBuffer
- },
{ "native_getLanguage",
"(I)[Ljava/lang/String;",
(void*)android_tts_SynthProxy_getLanguage
diff --git a/packages/TtsService/src/android/tts/SynthProxy.java b/packages/TtsService/src/android/tts/SynthProxy.java
index 41ff92a..a0814aa 100755
--- a/packages/TtsService/src/android/tts/SynthProxy.java
+++ b/packages/TtsService/src/android/tts/SynthProxy.java
@@ -109,13 +109,6 @@ public class SynthProxy {
}
/**
- * Plays the given audio buffer.
- */
- public void playAudioBuffer(int bufferPointer, int bufferSize) {
- native_playAudioBuffer(mJniData, bufferPointer, bufferSize);
- }
-
- /**
* Returns the currently set language, country and variant information.
*/
public String[] getLanguage() {
@@ -180,9 +173,6 @@ public class SynthProxy {
private native final int native_setPitch(int jniData, int speechRate);
- // TODO add buffer format
- private native final void native_playAudioBuffer(int jniData, int bufferPointer, int bufferSize);
-
private native final String[] native_getLanguage(int jniData);
private native final int native_getRate(int jniData);
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 7c4996e..b3b580c 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -130,6 +130,8 @@ public class TtsService extends Service implements OnCompletionListener {
private HashMap<String, SoundResource> mUtterances;
private MediaPlayer mPlayer;
private SpeechItem mCurrentSpeechItem;
+ private HashMap<SpeechItem, Boolean> mKillList; // Used to ensure that in-flight synth calls
+ // are killed when stop is used.
private TtsService mSelf;
private ContentResolver mResolver;
@@ -158,6 +160,7 @@ public class TtsService extends Service implements OnCompletionListener {
mSpeechQueue = new ArrayList<SpeechItem>();
mPlayer = null;
mCurrentSpeechItem = null;
+ mKillList = new HashMap<SpeechItem, Boolean>();
setDefaultSettings();
}
@@ -396,6 +399,7 @@ public class TtsService extends Service implements OnCompletionListener {
if ((mCurrentSpeechItem != null) &&
mCurrentSpeechItem.mCallingApp.equals(callingApp)) {
result = nativeSynth.stop();
+ mKillList.put(mCurrentSpeechItem, true);
if (mPlayer != null) {
try {
mPlayer.stop();
@@ -445,6 +449,7 @@ public class TtsService extends Service implements OnCompletionListener {
((mCurrentSpeechItem.mType != SpeechItem.TEXT_TO_FILE) ||
mCurrentSpeechItem.mCallingApp.equals(callingApp))) {
result = nativeSynth.stop();
+ mKillList.put(mCurrentSpeechItem, true);
if (mPlayer != null) {
try {
mPlayer.stop();
@@ -578,7 +583,10 @@ public class TtsService extends Service implements OnCompletionListener {
setLanguage("", language, country, variant);
}
}
- nativeSynth.speak(speechItem.mText, streamType);
+ // Only do the synthesis if it has not been killed by a subsequent utterance.
+ if (mKillList.get(speechItem) == null){
+ nativeSynth.speak(speechItem.mText, streamType);
+ }
} catch (InterruptedException e) {
Log.e("TTS speakInternalOnly", "tryLock interrupted");
e.printStackTrace();
@@ -641,7 +649,10 @@ public class TtsService extends Service implements OnCompletionListener {
setLanguage("", language, country, variant);
}
}
- nativeSynth.synthesizeToFile(speechItem.mText, speechItem.mFilename);
+ // Only do the synthesis if it has not been killed by a subsequent utterance.
+ if (mKillList.get(speechItem) == null){
+ nativeSynth.synthesizeToFile(speechItem.mText, speechItem.mFilename);
+ }
} catch (InterruptedException e) {
Log.e("TTS synthToFileInternalOnly", "tryLock interrupted");
e.printStackTrace();