diff options
3 files changed, 14 insertions, 12 deletions
diff --git a/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp b/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp index f410ee5..01cceb0 100644 --- a/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp +++ b/pico/compat/jni/com_android_tts_compat_SynthProxy.cpp @@ -626,7 +626,7 @@ static JNINativeMethod gMethods[] = { (void*)com_android_tts_compat_SynthProxy_stopSync }, { "native_speak", - "(ILjava/lang/String;Landroid/speech/tts/SynthesisRequest;)I", + "(ILjava/lang/String;Landroid/speech/tts/SynthesisCallback;)I", (void*)com_android_tts_compat_SynthProxy_speak }, { "native_isLanguageAvailable", @@ -678,7 +678,7 @@ jint JNI_OnLoad(JavaVM* vm, void* reserved) assert(env != NULL); jclass classSynthesisRequest = env->FindClass( - "android/speech/tts/SynthesisRequest"); + "android/speech/tts/SynthesisCallback"); if (classSynthesisRequest == NULL) { return -1; } diff --git a/pico/compat/src/com/android/tts/compat/CompatTtsService.java b/pico/compat/src/com/android/tts/compat/CompatTtsService.java index db1d9d8..af65ba4 100755 --- a/pico/compat/src/com/android/tts/compat/CompatTtsService.java +++ b/pico/compat/src/com/android/tts/compat/CompatTtsService.java @@ -17,6 +17,7 @@ package com.android.tts.compat; import android.database.Cursor; import android.net.Uri; +import android.speech.tts.SynthesisCallback; import android.speech.tts.SynthesisRequest; import android.speech.tts.TextToSpeech; import android.speech.tts.TextToSpeechService; @@ -105,9 +106,9 @@ public abstract class CompatTtsService extends TextToSpeechService { } @Override - protected void onSynthesizeText(SynthesisRequest request) { + protected void onSynthesizeText(SynthesisRequest request, SynthesisCallback callback) { if (mNativeSynth == null) { - request.error(); + callback.error(); return; } @@ -117,7 +118,7 @@ public abstract class CompatTtsService extends TextToSpeechService { String variant = request.getVariant(); if (mNativeSynth.setLanguage(lang, country, variant) != TextToSpeech.SUCCESS) { Log.e(TAG, "setLanguage(" + lang + "," + country + "," + variant + ") failed"); - request.error(); + callback.error(); return; } @@ -125,7 +126,7 @@ public abstract class CompatTtsService extends TextToSpeechService { int speechRate = request.getSpeechRate(); if (mNativeSynth.setSpeechRate(speechRate) != TextToSpeech.SUCCESS) { Log.e(TAG, "setSpeechRate(" + speechRate + ") failed"); - request.error(); + callback.error(); return; } @@ -133,13 +134,13 @@ public abstract class CompatTtsService extends TextToSpeechService { int pitch = request.getPitch(); if (mNativeSynth.setPitch(pitch) != TextToSpeech.SUCCESS) { Log.e(TAG, "setPitch(" + pitch + ") failed"); - request.error(); + callback.error(); return; } // Synthesize - if (mNativeSynth.speak(request) != TextToSpeech.SUCCESS) { - request.error(); + if (mNativeSynth.speak(request, callback) != TextToSpeech.SUCCESS) { + callback.error(); return; } } diff --git a/pico/compat/src/com/android/tts/compat/SynthProxy.java b/pico/compat/src/com/android/tts/compat/SynthProxy.java index 58b2a50..9b009c3 100755 --- a/pico/compat/src/com/android/tts/compat/SynthProxy.java +++ b/pico/compat/src/com/android/tts/compat/SynthProxy.java @@ -15,6 +15,7 @@ */ package com.android.tts.compat; +import android.speech.tts.SynthesisCallback; import android.speech.tts.SynthesisRequest; import android.util.Log; @@ -82,8 +83,8 @@ public class SynthProxy { return native_stopSync(mJniData); } - public int speak(SynthesisRequest request) { - return native_speak(mJniData, request.getText(), request); + public int speak(SynthesisRequest request, SynthesisCallback callback) { + return native_speak(mJniData, request.getText(), callback); } /** @@ -164,7 +165,7 @@ public class SynthProxy { private native final int native_stopSync(int jniData); - private native final int native_speak(int jniData, String text, SynthesisRequest request); + private native final int native_speak(int jniData, String text, SynthesisCallback request); private native final int native_isLanguageAvailable(int jniData, String language, String country, String variant); |