From f0834feea5235b6f84fd28cf94dab3789019df2a Mon Sep 17 00:00:00 2001 From: Nolan Darilek Date: Tue, 18 Aug 2020 17:23:05 -0500 Subject: [PATCH] Changes necessary to get working on Android. --- TTS.gd | 4 ++-- build.gradle | 2 +- godot-tts.gdap | 3 --- src/main/java/games/lightsout/godot/tts/TTS.java | 9 +++------ 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/TTS.gd b/TTS.gd index 49d6236..84e11aa 100644 --- a/TTS.gd +++ b/TTS.gd @@ -10,8 +10,8 @@ signal done func _init(): if OS.get_name() == "Server" or OS.has_feature("JavaScript"): return - elif Engine.has_singleton("AndroidTTS"): - tts = Engine.get_singleton("AndroidTTS") + elif Engine.has_singleton("GodotTTS"): + tts = Engine.get_singleton("GodotTTS") else: TTS = preload("godot-tts.gdns") if TTS and (TTS.can_instance() or Engine.editor_hint): diff --git a/build.gradle b/build.gradle index 63a7cee..929dd34 100644 --- a/build.gradle +++ b/build.gradle @@ -23,7 +23,7 @@ android { buildToolsVersion "29.0.3" defaultConfig { - minSdkVersion 18 + minSdkVersion 21 targetSdkVersion 29 versionCode pluginVersionCode versionName pluginVersionName diff --git a/godot-tts.gdap b/godot-tts.gdap index f92fc2d..55d9304 100644 --- a/godot-tts.gdap +++ b/godot-tts.gdap @@ -3,6 +3,3 @@ name="GodotTTS" binary_type="local" binary="godot-tts.aar" - -[dependencies] -remote=[] diff --git a/src/main/java/games/lightsout/godot/tts/TTS.java b/src/main/java/games/lightsout/godot/tts/TTS.java index 582eb3e..ccfe20d 100644 --- a/src/main/java/games/lightsout/godot/tts/TTS.java +++ b/src/main/java/games/lightsout/godot/tts/TTS.java @@ -1,14 +1,12 @@ package games.lightsout.godot.tts; import java.util.Arrays; -import java.util.HashMap; import java.util.List; import org.godotengine.godot.Godot; import org.godotengine.godot.plugin.GodotPlugin; import android.accessibilityservice.AccessibilityServiceInfo; -import android.app.Activity; import android.content.Context; import android.speech.tts.TextToSpeech; import android.view.accessibility.AccessibilityManager; @@ -18,15 +16,14 @@ public class TTS extends GodotPlugin implements TextToSpeech.OnInitListener { private float rate = 1f; - // private Integer utteranceId = 0; + private Integer utteranceId = 0; public void speak(String text, boolean interrupt) { int mode = TextToSpeech.QUEUE_ADD; if (interrupt) mode = TextToSpeech.QUEUE_FLUSH; - HashMap params = new HashMap(); - tts.speak(text, mode, params); - // this.utteranceId++; + tts.speak(text, mode, null, this.utteranceId.toString()); + this.utteranceId++; } public void stop() {