mirror of
https://github.com/lightsoutgames/godot-tts
synced 2024-12-26 13:15:56 +00:00
Changes necessary to get working on Android.
This commit is contained in:
parent
c5f8e28028
commit
f0834feea5
4
TTS.gd
4
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):
|
||||
|
|
|
@ -23,7 +23,7 @@ android {
|
|||
buildToolsVersion "29.0.3"
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 18
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 29
|
||||
versionCode pluginVersionCode
|
||||
versionName pluginVersionName
|
||||
|
|
|
@ -3,6 +3,3 @@
|
|||
name="GodotTTS"
|
||||
binary_type="local"
|
||||
binary="godot-tts.aar"
|
||||
|
||||
[dependencies]
|
||||
remote=[]
|
||||
|
|
|
@ -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<String, String> params = new HashMap();
|
||||
tts.speak(text, mode, params);
|
||||
// this.utteranceId++;
|
||||
tts.speak(text, mode, null, this.utteranceId.toString());
|
||||
this.utteranceId++;
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
|
|
Loading…
Reference in New Issue
Block a user